Jump to content

Archived

This topic is now archived and is closed to further replies.

Buyocat

Mac OS web server and PHP errors

Recommended Posts

Hi I am having a problem getting my mac to display errors for PHP when I use it as a server. I set up web sharing and am able to load up PHP and HTML files without a hitch. I checked to make sure that I'm running the right version of PHP, v. 5, and this brings us to the problem. I have created a set of classes (Abstract -> normal) and I call the normal one in the index page (I use __autoload if it makes any difference) it looks like this:

<?php
error_reporting(E_ALL);
function __autoload ($class) {
$path = eregi_replace ('_', DIRECTORY_SEPARATOR, $class);
require ('./Class/'.$path.'.php');
}
$item = new Library_Book ('Catch-22', 'Joseph Heller', 'New York Press', 'Satire');
$item->writeOut();
?>


as you might notice I tried setting the error reporting to all (which I believe I read would report all erros), still I do not get error messages, just a blank screen. This might suggest that there was some fatal error, but when I upload the same code to a web server running PHP 5 the code executes correctly. Does anyone know how I can get some indication of what's wrong?

Share this post


Link to post
Share on other sites
Your server most likely has display_errors turned off therefore no errors are displayed. error_reporting changes the level at which PHP reports the errors it wont display the errors to the browser unless display_errors is set to on. However if there are any errors then they will be written to a log file, usually in the system log.

Share this post


Link to post
Share on other sites
Thanks for the reply, I don't see any log file being written, so maybe I can try to change things so the PHP displays errors, this isn't ever going to be live so I don't think I need to worry about prying eyes. Is there any easy way to do that (change error display settings)? Once upon a time I tried to tweak the php.ini file following some instructions I found, but that didn't seem to have any effect.

Share this post


Link to post
Share on other sites
The error display settings are all found in php.ini, so if you're going to tweak something, that's where it would be at.

Share this post


Link to post
Share on other sites
To change the way PHP functions you need to edit the php.ini file. Any changes you make needs to be saved. Now the important part. You [b]must[/b] restart the Apache server or what ever server you are running for the new changes to take affect, otherwise any changes made to the php.ini file will not become available until the next reboot of the server.

Share this post


Link to post
Share on other sites
Thanks, Wild, for you help. I managed to find and try:
ini_set("display_errors","1");
and it has worked. I was lead to believe, from php.net where I found this, that it won't handle fatal errors, but it seems that my computer-server is compaining about something non-fatal (although it was something that wasn't caught by my other server). I'll try to troubleshoot this, maybe I'll come back if I can't figure it out.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.