10.3: Where to find and edit the php.ini file

Nov 12, '03 10:32:00AM

Contributed by: Anonymous

Upon doing a clean install of Panther and reconfiguring Apache via the /etc -> http -> httpd.conf file to enable PHP, I noticed that some settings have changed. In paticular, register_globals is off by default now.

After some searching on the net, I couldn't find anything that told me where to look for php.ini to change this setting. However, when I ran the phpinfo() command, in the output it shows that the php.ini is loaded from /etc, and not /usr/local/, like the sites I found describing the same problem.

So to properly set up your PHP environment, you can copy another php.ini to /etc or copy the /etc/php.ini.default to /etc/php.ini and edit the file accordingly. After you're done, restart Apache to have the settings take effect.

[robg adds: This one bit me, too -- PHP recommends register_globals be set to off, so Apple did the right thing by setting it that way. However, many scripts, such as Geeklog!, require register_globals to be on. If it's off, Geeklog appears to mostly work, but it stops loading pages after the header. It took me a bit of digging to figure out the php.ini location, so hopefully this hint will help some others in the same boat.]

Comments (23)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031104115822608