Jump to content

[SOLVED] Location and number of php.ini files


Recommended Posts

I was wondering how many php.ini files should I have on my server (dedicated) and where should I put them.  When I run php info it tells me there is one in /usr/lib.  If I look on my server, i have about 12 more in other directories.  Any help would be appreciated.  Thanks.

 

Ryan

Link to comment
Share on other sites

PHP generally only reads ini files from two locations. The configuration file path (generally /etc/php5 or similar) is where you main php.ini file should reside. Then there is also an additional file path (generally /etc/php5/conf.d or similar) where you can place individual ini file (eg; mysql.ini) containing options for specific extensions.

 

Any other ini files outside of these paths will not generally be read. However there is the PHPINIDir option available from within your httpd.conf file or even .htaccess which will allow you to specify a php.ini on a per site/virtual-host bases.

Link to comment
Share on other sites

Thanks for the clarification.  When i run phpinfo(), it tells me that my php.ini file is in /usr/lib.  I am assuming this is where the file was put when php was installed on my server.  If this is where phpinfo() shows my file, is it safe to assume this is the one it's reading?  If so, I will remove the others.

Link to comment
Share on other sites

If this is where phpinfo() shows my file, is it safe to assume this is the one it's reading?

 

Yes, but whoever installed php is a bafoon. The /etc directory is generally reserved for configuration files, hence it is also usually protected against its contents being overiden when applications are installed / upgraded. /usr offers no such protection.

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.