PHP syntax error causes no output

PHP syntax error causes no output

am 10.10.2007 16:28:39 von NerdRevenge

I just started a new project on a new virtual server.
If I write a small script, it executes fine.

If there is an error in the small script, I get no output at all,
but the browser shows "done."

here is the small script:
session_start();
$debug=1;
if ($debug) {
error_reporting(E_ALL);
echo "
SESSION:
";
print_r($_SESSION);
echo "
POST:
";
print_r($_POST);
echo "
";
}
echo " duh";
echo "double duh";
?>

If I remove the semicolon after echo " duh"; to generate a syntax
error, I get no output at all. no error is reported in the browser.

Any ideas ?

bill

Re: PHP syntax error causes no output

am 10.10.2007 16:33:31 von Tyno Gendo

bill wrote:
> I just started a new project on a new virtual server.
> If I write a small script, it executes fine.
>
> If there is an error in the small script, I get no output at all, but
> the browser shows "done."
>
> here is the small script:
> > session_start();
> $debug=1;
> if ($debug) {
> error_reporting(E_ALL);
> echo "
SESSION:
";
> print_r($_SESSION);
> echo "
POST:
";
> print_r($_POST);
> echo "
";
> }
> echo " duh";
> echo "double duh";
> ?>
>
> If I remove the semicolon after echo " duh"; to generate a syntax error,
> I get no output at all. no error is reported in the browser.
>
> Any ideas ?
>
> bill

Check the error_reporting and display_errors in php.ini

I get this on our live servers all the time but we can't turn the
reporting on, so I usually download to an internal dev machine
and test on there with all errors/display on.

Re: PHP syntax error causes no output

am 10.10.2007 16:36:15 von NerdRevenge

bill wrote:
> I just started a new project on a new virtual server.
> If I write a small script, it executes fine.
>
> If there is an error in the small script, I get no output at all, but
> the browser shows "done."
>
> here is the small script:
> > session_start();
> $debug=1;
> if ($debug) {
> error_reporting(E_ALL);
> echo "
SESSION:
";
> print_r($_SESSION);
> echo "
POST:
";
> print_r($_POST);
> echo "
";
> }
> echo " duh";
> echo "double duh";
> ?>
>
> If I remove the semicolon after echo " duh"; to generate a syntax error,
> I get no output at all. no error is reported in the browser.
>
> Any ideas ?
>
> bill

I forgot to mention that this is a new php5 installation on a
remote host. But the same thing happens when I request it be
executed as php4 (by changing the extension to php4).
bill

Re: PHP syntax error causes no output

am 10.10.2007 17:03:45 von zeldorblat

On Oct 10, 10:33 am, Tyno Gendo wrote:
>
> I get this on our live servers all the time but we can't turn the
> reporting on, so I usually download to an internal dev machine
> and test on there with all errors/display on.

Why not turn the reporting on and display off? That way you'll at
least have a logfile to examine when bad things happen.

Re: PHP syntax error causes no output

am 10.10.2007 17:04:58 von zeldorblat

On Oct 10, 10:28 am, bill wrote:
> I just started a new project on a new virtual server.
> If I write a small script, it executes fine.
>
> If there is an error in the small script, I get no output at all,
> but the browser shows "done."
>
> here is the small script:
> > session_start();
> $debug=1;
> if ($debug) {
> error_reporting(E_ALL);
> echo "
SESSION:
";
> print_r($_SESSION);
> echo "
POST:
";
> print_r($_POST);
> echo "
";
> }
> echo " duh";
> echo "double duh";
> ?>
>
> If I remove the semicolon after echo " duh"; to generate a syntax
> error, I get no output at all. no error is reported in the browser.
>
> Any ideas ?
>
> bill

You need to enable error reporting and/or display errors in php.ini.
If it's turned off there and there's a syntax error your call to
error_reporting() will never happen since the code cannot be compiled,
much less executed.

Re: PHP syntax error causes no output

am 10.10.2007 17:07:03 von NerdRevenge

Tyno Gendo wrote:
> bill wrote:
>> I just started a new project on a new virtual server.
>> If I write a small script, it executes fine.
>>
>> If there is an error in the small script, I get no output at all, but
>> the browser shows "done."
>>
>> here is the small script:
>> >> session_start();
>> $debug=1;
>> if ($debug) {
>> error_reporting(E_ALL);
>> echo "
SESSION:
";
>> print_r($_SESSION);
>> echo "
POST:
";
>> print_r($_POST);
>> echo "
";
>> }
>> echo " duh";
>> echo "double duh";
>> ?>
>>
>> If I remove the semicolon after echo " duh"; to generate a syntax
>> error, I get no output at all. no error is reported in the browser.
>>
>> Any ideas ?
>>
>> bill
>
> Check the error_reporting and display_errors in php.ini
>
> I get this on our live servers all the time but we can't turn the
> reporting on, so I usually download to an internal dev machine
> and test on there with all errors/display on.

php.ini has a blank for display_errors and 2047 for error_reporting.

using ini_set, what are valid values for display_errors ?
bill

Re: PHP syntax error causes no output

am 12.10.2007 16:41:45 von NerdRevenge

Tyno Gendo wrote:

> Check the error_reporting and display_errors in php.ini
>
> I get this on our live servers all the time but we can't turn the
> reporting on, so I usually download to an internal dev machine
> and test on there with all errors/display on.

php.ini has a blank for display_errors and 2047 for error_reporting.

using ini_set, what are valid values for display_errors ?
bill

Re: PHP syntax error causes no output

am 12.10.2007 17:58:33 von Jerry Stuckle

bill wrote:
> Tyno Gendo wrote:
>
>> Check the error_reporting and display_errors in php.ini
>>
>> I get this on our live servers all the time but we can't turn the
>> reporting on, so I usually download to an internal dev machine
>> and test on there with all errors/display on.
>
> php.ini has a blank for display_errors and 2047 for error_reporting.
>
> using ini_set, what are valid values for display_errors ?
> bill
>

You can't use ini_set to display syntax errors. Since there is a syntax
error, none of the code gets executed - including syntax errors.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: PHP syntax error causes no output

am 12.10.2007 22:09:21 von NerdRevenge

Jerry Stuckle wrote:
> bill wrote:
>> Tyno Gendo wrote:
>>
>>> Check the error_reporting and display_errors in php.ini
>>>
>>> I get this on our live servers all the time but we can't turn the
>>> reporting on, so I usually download to an internal dev machine
>>> and test on there with all errors/display on.
>>
>> php.ini has a blank for display_errors and 2047 for error_reporting.
>>
>> using ini_set, what are valid values for display_errors ?
>> bill
>>
>
> You can't use ini_set to display syntax errors. Since there is a syntax
> error, none of the code gets executed - including syntax errors.
>

Well, heck. I can reach the ceiling by pulling myself up by my
bootstraps.

Because the web host runs php as a fastcgi, they had to create a
php.ini in my cgi-bin directory that I could edit.

Thanks all, now all is well.

bill

Re: PHP syntax error causes no output

am 13.10.2007 04:09:53 von Jerry Stuckle

bill wrote:
> Jerry Stuckle wrote:
>> bill wrote:
>>> Tyno Gendo wrote:
>>>
>>>> Check the error_reporting and display_errors in php.ini
>>>>
>>>> I get this on our live servers all the time but we can't turn the
>>>> reporting on, so I usually download to an internal dev machine
>>>> and test on there with all errors/display on.
>>>
>>> php.ini has a blank for display_errors and 2047 for error_reporting.
>>>
>>> using ini_set, what are valid values for display_errors ?
>>> bill
>>>
>>
>> You can't use ini_set to display syntax errors. Since there is a
>> syntax error, none of the code gets executed - including syntax errors.
>>
>
> Well, heck. I can reach the ceiling by pulling myself up by my bootstraps.
>
> Because the web host runs php as a fastcgi, they had to create a php.ini
> in my cgi-bin directory that I could edit.
>
> Thanks all, now all is well.
>
> bill
>

A poor workaround. Get a development system going. You should never
have display_errors enabled on a production system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================