Jump to content

Mac OS web server and PHP errors


Buyocat

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?
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.