Jump to content


Photo

Mac OS web server and PHP errors


  • Please log in to reply
5 replies to this topic

#1 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 10 May 2006 - 05:31 PM

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?
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 May 2006 - 07:33 PM

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.

#3 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 10 May 2006 - 07:36 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 10 May 2006 - 07:37 PM

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.

Info: PHP Manual


#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 May 2006 - 07:40 PM

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 must 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.

#6 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 10 May 2006 - 08:06 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users