php5 and php.ini

Ryan Schmidt ryandesign at macports.org
Wed Dec 6 13:14:24 PST 2006


On Dec 6, 2006, at 13:39, Mark Duling wrote:

> The php5 port installs
>
> php.ini-dist and
> php.ini-recommended
>
> and I see the binary is set to look for php.ini in /opt/local/etc, but
> strangely I never set this and php5  works fine for me.  How  does  
> it find
> the wonky mysqld.sock location?  And should I be using one of the  
> provided
> php.ini's?

As far as I understand, the PHP team recommends you use the settings  
in the file php.ini-recommended, hence the name. I recommend copying  
php.ini-recommended to php.ini, then opening it in an editor and  
spending some time reading through each option (they're well- 
commented) to see if the recommended setting is ok for you. I  
personally end up changing a few directives for my own use; you'll  
probably see some you'll want to change as well.

If you do not use a php.ini, PHP uses its own internal defaults,  
which I believe match the settings in php.ini-dist, which I believe  
are less secure (but more compatible with older PHP projects) than  
the recommended settings. I always prefer to use a php.ini, so it's  
perfectly clear what settings are being used.

As for how PHP knows where the MySQL socket is, I believe that if no  
location is specified in the php.ini, then PHP uses the location of  
the socket that's normal for the version of MySQL against which it's  
compiled. However, I see that in my local php.ini, I have explicitly  
specified the socket location:

mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock

I do not remember why I did that, or if it would work without that.




More information about the macports-dev mailing list