View Full Version : php.ini – Sessions locally? and display_errors...

02-13-2006, 01:56 AM
I've got a test server set up on my Mac with PHP5 and mySQL, and I've got two problems that I believe can be solved through the PHP settings on my local machine.

First, the new buld of PHP seems to default the 'display_errors' setting in PHP to 'Off', and I'd like to turn it on. I've found several online posts about how to edit your php.ini file, and I've gone in the edited my php.ini file and changed the 'display_errors' to 'On', and uncommented the line, yet it still does not work. If anyone knows how to fix that, or have any ideas of what I might have done wrong, that'd be great.

And then I'm working with a login/admin setup that I'd like to test locally, but sessions does not seem to work on my machine. It works when I upload it via FTP to my hosting server, but not locally. I'm thinking that there might be a setting for this in my php.ini file as well. Anyone have any ideas?


02-13-2006, 02:09 AM
did you restart apache after changing your php.ini?
the php.ini is usually well commented, so you could look through it and see what to change. you could also run this on your host:

<?php phpinfo(); ?>
and you can find all the settings they have set and just mimic those in your php.ini

02-14-2006, 12:46 AM
Yea, I restarted Apache, and checking my phpinfo() was what brought it to my attention that the 'display_errors' parameter was set to Off in the first place. I changed it to 'On' in my php.ini—I did remove a '; - ' from the beginning of that line in the php.ini, was I not supposed to do that? Other than that I'm not really sure why it's not working? Anyone have any other ideas? Thanks...

02-14-2006, 01:21 AM
are you sure you are editing the right php.ini ? check the output of phpinfo() for 'Configuration File' , if its not a full path e.g /etc/php.ini (not a clue where that would be on a mac) then php can't find the file and is working on built-in defaults , if there is a full path , is that the file you are actually editing ?

02-15-2006, 08:27 AM
Yes, I was editing the file that shows up in my phpinfo(), which was at /usr/local/php5/lib/php.ini . This was my exact process in the terminal:

sudo pico /usr/local/php5/lib/php.ini - enter
Ctrl-W and search for 'display_errors'

changed this: ; - display_errors = Off [Security]
to this: display_errors = On [Security]

then ctrl-O to save it.

The change still seems to be present even when i reopen the php.ini file, or restart apache, but still says 'Off' in my phpinfo() file. Any more ideas? I know this is just nuts...

02-15-2006, 02:29 PM
how about typing the following from a shell:

locate php.ini

hopefully that'll list all locations of your php.ini.
if that fails (or OS X doesn't come with locate, I have no idea if it does), try:

find / -name php.ini

02-15-2006, 03:04 PM
I dont think it makes a difference but lose the [Security] bit & check that that directive is not duplicated elsewhere in the php.ini ...

also check that error_reporting is actually turned on in the first place , e.g
error_reporting = E_ALL & ~E_NOTICE

as a last resort , edit your httpd.conf file and add ...

php_admin_value display_errors on

02-15-2006, 03:34 PM
You're changing the wrong thing - the first instance of "display_errors" is for documentation purposes. If you go further down the file, you will find a second one, which is the one you have to change.