Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP error message wont show in safari!

PHP error message wont show in safari!
Thread Tools
maCCer
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 22, 2005, 06:38 PM
 
i got some parse error in my php file, when i browse the php file using safari, it just gave me blank page instead of telling me the error message, i do not know what should i do about this, thx for help
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
jay3ld
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 22, 2005, 07:50 PM
 
try this

add to top of php file right below <?php

ini_set('display_errors','1');
     
insha
Senior User
Join Date: Nov 2003
Location: Middle of the street
Status: Offline
Reply With Quote
Oct 22, 2005, 11:39 PM
 
You can do any one of the following:

1) check the log file for php. Open Console (Applications-Utilities-Console) and look at the logs under the "/var/logs/" for "httpd" it will list the php errors.

2) Set "error_reporting = E_ALL" in the "Error Handling and Logging" in PHP's configuration file.
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 03:08 AM
 
Originally Posted by insha
You can do any one of the following:

1) check the log file for php. Open Console (Applications-Utilities-Console) and look at the logs under the "/var/logs/" for "httpd" it will list the php errors.

2) Set "error_reporting = E_ALL" in the "Error Handling and Logging" in PHP's configuration file.
This is what in my config file:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; error_reporting is a bit-field. Or each number up to get desired error
; reporting level
; E_ALL - All errors and warnings
; E_ERROR - fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
;
; Examples:
;
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors except for notices
;
error_reporting = E_ALL
But seems still not working
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 03:15 AM
 
Originally Posted by jay3ld
try this

add to top of php file right below <?php

ini_set('display_errors','1');
This does not work too
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
jay3ld
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 03:20 AM
 
thats odd...

what version of php you have?

you can also try phps homepage
http://www.php.net/
they might have your answer there somewhere.

have you tried with other browsers to make sure it isnt safaris fault

one last note.

having @ infront of anything will tell it not to display errors for that part of the phrasing.
so if everything does... that could be why also
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 03:20 AM
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>php_testing</title>
</head>

<body>
<?php
ini_set('display_errors','1');
$my_array=("one","Two","Three")
foreach ($my_array as $value)
echo "Value is:".$value;
}
?>

</body>
</html>


The above is the code i am running, first of all $my_array=("one","Two","Three") should be $my_array=array("one","Two","Three"); , second, the foreach should have a "{", all those error will not be shown if i run it in safari and FF, both browsers just gave me a BLANK SCREEN, more help needed guys.
Thank you
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 03:26 AM
 
Originally Posted by jay3ld
thats odd...

what version of php you have?

you can also try phps homepage
http://www.php.net/
they might have your answer there somewhere.

have you tried with other browsers to make sure it isnt safaris fault

one last note.

having @ infront of anything will tell it not to display errors for that part of the phrasing.
so if everything does... that could be why also
thx for that reply, all i have done is downloaded the MAMP form http://www.mamp.info/en/home/, i even got a widget can start or stop the server and switch the PHP version between 4 and 5, i am running PHP 5 at this moment, and i have tried PHP 4 as well, same story
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
registered_user
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
Oct 23, 2005, 09:38 AM
 
Sounds like you're running php on your local Mac.

Fire up Utilities->Console.app

take a gander at httpd.error log
     
ameat
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Oct 23, 2005, 11:28 AM
 
dude, try viewing source on your "blank" browser page to see what's actually been kicked back by the server. if you see your php source, then your server hasn't been configured correctly...
     
mania
Mac Enthusiast
Join Date: Aug 2001
Location: Durango CO
Status: Offline
Reply With Quote
Oct 23, 2005, 03:36 PM
 
after such an error in the terminal type

tail /var/log/httpd/error_log

you are most likely missing a semicolon or a bracket
The Bitcastle
graphic design, web development, hosting
     
jay3ld
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 23, 2005, 05:12 PM
 
Originally Posted by maCCer
<?php
ini_set('display_errors','1');
$my_array=("one","Two","Three")
foreach ($my_array as $value)
echo "Value is:".$value;
}
?>

theres a few errors in that... allot

try this one
[php]
<?php
ini_set('display_errors','1');
$my_array=("one","Two","Three");
foreach ($my_array as $value)
{
echo "Value is:".$value;
}
?>
[/php]

$my_array=("one","Two","Three") needed a ; at the end $my_array=("one","Two","Three");

the foreach statement needed a start bracket since you have an end one after the echo {

that should do it.
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 24, 2005, 01:59 AM
 
thx all, i have figured it out.
The problem is inside the config file, where the default display_error="Off", so the error message wont show up when some syntax error happened.
however, i have got a new problem, when i got i syntax error ,say, at line 13, the actual line number i got in the error message is EVEN not close to 13, most of time, the line number always be my first line of PHP code, AND, i have try the same PHP code, and same syntax error in Windows(apache, php5), it gave me much closer error line number, which in some perspective makes more sense to me if i am finding syntax error among 500 lines of PHP code. therefore, can someone explain this a bit, and lead me a way to resolve that problem, thanks in advance
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
jay3ld
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 24, 2005, 06:14 PM
 
php doesnt read spaces and returns (except for the stuff in the "" but still dont read returns)

so im guessing when you miss something like a ; it thinks its still going on that line.
not 100% sure on that but maybe the php site will have some insight if you read though it.
     
genevish
Mac Enthusiast
Join Date: Jan 1999
Location: Marietta, GA, USA
Status: Offline
Reply With Quote
Oct 24, 2005, 07:35 PM
 
Originally Posted by maCCer
thx all, i have figured it out.
The problem is inside the config file, where the default display_error="Off", so the error message wont show up when some syntax error happened.
however, i have got a new problem, when i got i syntax error ,say, at line 13, the actual line number i got in the error message is EVEN not close to 13, most of time, the line number always be my first line of PHP code, AND, i have try the same PHP code, and same syntax error in Windows(apache, php5), it gave me much closer error line number, which in some perspective makes more sense to me if i am finding syntax error among 500 lines of PHP code. therefore, can someone explain this a bit, and lead me a way to resolve that problem, thanks in advance
What type of file is it saved as? Windows, Mac or Unix? If you're not sure, tell us what editor you're using to edit the file... (my thinking is that it's saved with Windows line breaks, which the Mac isn't reading.)
Scott Genevish
scott AT genevish DOT org
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Oct 25, 2005, 05:53 AM
 
Originally Posted by genevish
What type of file is it saved as? Windows, Mac or Unix? If you're not sure, tell us what editor you're using to edit the file... (my thinking is that it's saved with Windows line breaks, which the Mac isn't reading.)
I am using Dreamweaver MX on a Mac, and i save in on the mac as well.
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:02 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,