By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

parse errors being surpressed

P: n/a
I have two servers that have had PHP installed on them and...

<?php
echo 'hello, world!
?>

....displays a parse error on server A and doesn't display anything on
server B.

Any ideas as to what the problem is?

Jul 10 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a

yawnmoth wrote:
I have two servers that have had PHP installed on them and...

<?php
echo 'hello, world!
?>

...displays a parse error on server A and doesn't display anything on
server B.

Any ideas as to what the problem is?
yes, you need have the echo line ending with a colon like so:

echo "Sup world??";

why does it work on one server and not the other.. well not sure off
the top of my head but will be soemthing in the php.ini config. Do a
phpinfo(); on each machine to compare.

Flamer.

Jul 10 '06 #2

P: n/a
Rik
yawnmoth wrote:
I have two servers that have had PHP installed on them and...

<?php
echo 'hello, world!
>>
<?php
echo 'hello, world!';
?>
...displays a parse error on server A and doesn't display anything on
server B.
Run:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo 'hello, world!
?>

Grtz,
--
Rik Wasmus
Jul 10 '06 #3

P: n/a

yawnmoth wrote:
I have two servers that have had PHP installed on them and...

<?php
echo 'hello, world!
?>

...displays a parse error on server A and doesn't display anything on
server B.

Any ideas as to what the problem is?
Oh sorry, just read your question, thought you meant it worked on one
and not the other now I see it doesnt work on either, yes it wont, use
code as above, one php is set to output error to screen, the other, you
will probably find a file in the dir the script is in called error.log
and that will contain the error message there (which is a better option
for production servers).

Flamer.

Jul 10 '06 #4

P: n/a

Rik wrote:
yawnmoth wrote:
<snip>

Run:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo 'hello, world!
?>
That doesn't seem to help with parse errors (as evidenced by the fact
that that script displays nothing, as well), but it did get me thinking
that maybe I could try setting it in the .htaccess file.
Unfortunately, it'd appear that I can't create .htaccess files on this
server. I also tried dropping a php.ini file there with
display_errors=1 but that didn't help...

Jul 10 '06 #5

P: n/a

flamer di******@hotmail.com wrote:
yawnmoth wrote:
I have two servers that have had PHP installed on them and...

<?php
echo 'hello, world!
?>

...displays a parse error on server A and doesn't display anything on
server B.

Any ideas as to what the problem is?

Oh sorry, just read your question, thought you meant it worked on one
and not the other now I see it doesnt work on either, yes it wont, use
code as above, one php is set to output error to screen, the other, you
will probably find a file in the dir the script is in called error.log
and that will contain the error message there (which is a better option
for production servers).

Flamer.
Errors are also logged to the apache log file, usually someplace in
/var/log. if you're on a shared host or something, they usually
provide a symlink or something to the logging directory.

Jul 10 '06 #6

P: n/a
As several others have noted, your code has errors in it.

This code is giving parse errors because you are missing a quotation
mark ( ' ) and a semi-colon to end the statement.

<?php
echo 'hello, world!
?>

as posted by others try this instead:

<?php
echo 'hello, world!';
?>

As for the errors messages, check each server's php.ini and see what
level of error reporting each is setup for.

Jul 10 '06 #7

P: n/a

william.clarke wrote:
As several others have noted, your code has errors in it.

This code is giving parse errors because you are missing a quotation
mark ( ' ) and a semi-colon to end the statement.

<?php
echo 'hello, world!
?>

as posted by others try this instead:

<?php
echo 'hello, world!';
?>
When you're _trying_ to get parse errors, using syntactically correct
code isn't such a great idea ;)

Jul 11 '06 #8

P: n/a

yawnmoth wrote:
william.clarke wrote:
As several others have noted, your code has errors in it.

This code is giving parse errors because you are missing a quotation
mark ( ' ) and a semi-colon to end the statement.

<?php
echo 'hello, world!
?>

as posted by others try this instead:

<?php
echo 'hello, world!';
?>
When you're _trying_ to get parse errors, using syntactically correct
code isn't such a great idea ;)
Ah, I see. I don't habitually try to get parse errors...silly me, these
new trends in coding make me feel so old.

Jul 11 '06 #9

P: n/a

william.clarke wrote:
yawnmoth wrote:
<snip>
When you're _trying_ to get parse errors, using syntactically correct
code isn't such a great idea ;)

Ah, I see. I don't habitually try to get parse errors...silly me, these
new trends in coding make me feel so old.
If you're currious as to why I was trying to do this... I
recreationally write modifications to open source projects in PHP.
Someone had applied the changes that one of my modifications required
but found their site not to be working after the changes were made.
The problem, as it turned out, was that they replaced a } with a ), but
since their website didn't display syntax errors, it took me more time
to figure it out than it might have otherwise taken me.

Call it a new trend if you like. I wouldn't.

Jul 12 '06 #10

P: n/a
yawnmoth wrote:
If you're currious as to why I was trying to do this... I
recreationally write modifications to open source projects in PHP.
Someone had applied the changes that one of my modifications required
but found their site not to be working after the changes were made.
The problem, as it turned out, was that they replaced a } with a ), but
since their website didn't display syntax errors, it took me more time
to figure it out than it might have otherwise taken me.
Ah, that makes sense, because I was thinking "why would code with parse
errors ever leave your development environment?", but now I can see how
it would happen :) That sort of thing occasionally happens where I
work too, but the fact totally broken code gets released still
surprises me. I hope you've managed to sort out all the newly
introduced parse errors now.

Jul 12 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.