PDA

View Full Version : I want to disable the NOTICE in php in terminal



Mostafatherock
October 12th, 2011, 12:28 PM
Hi everyone

I want to run php files in the terminal but every time it gives me a NOTICE

My ubntun is 10.10 and I'm using php5

I tried to disable the NOTICE from the php.ini by replacing


error_reporting = E_ALLTo be


error_reporting = E_ALL & ~E_NOTICE & ~E_WARNINGThis is what I'm trying to do

I want to run this script in the terminal


#!/usr/bin/php5
<?php
$x=he;
$y=llo;
echo $x.$y;
echo "\n";
echo strlen("This is the the sentence");
?>and this is the out put


mostafa@mostafa:/var/www$ ./1.php

PHP Notice: Use of undefined constant he - assumed 'he' in /var/www/1.php on line 3
PHP Notice: Use of undefined constant llo - assumed 'llo' in /var/www/1.php on line 4
hello
24

I Just want to disable this notice ... how can I do that ??

An Sanct
October 12th, 2011, 01:13 PM
$x=he;
$y=llo;

are unknown, follow the advice the server gives you! "assumend 'he'" and "assumend 'llo'"

means the code should be
$x='he';
$y='llo';

After this modification, the warning will disappear. But warning will still stay present (you want that!)

Mostafatherock
October 12th, 2011, 02:59 PM
errrrrrrr ..... I didn't continue reading the rest of the notice :D :D

Thanks alot An Sanct, it's working perfect now !!