Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server and a local version of it on my hard drive.

I am trying to access the local version through localhost.

Entering localhost works, I enter the base html file and all that.

The problem is that I can't load my server's php.ini file. The system always just loads the default one and nothing else.

When I run phpinfo() it says:
(php.ini) Path: /etc/php5/apache2
Loaded Configuration File: /etc/php5/apache2/php.ini

I don't think there's any problem with my .htaccess file for that's identical to the one on the server.

I am suspecting there is something missing in /etc/apache2.
In it I have changed /etc/apach2/sites_enabled/000-default by changing document root and directory from /var/www to the path to my local instance of the server.

I find it a bit bizarre that the filename is 000-default and not just 'default'.

I have also changed document root and directory in /etc/apache2/sites_available/default.

I did by accident install first apache2, and then lamp, which i think also installs apache2 so maybe there could have been some misconfiguration due to that?

I have already restarted apache and the computer, but to no avail. The localhost-server-folder is always loading the php.ini in /etc/php5/apache2/php.ini.

How do I change which php.ini file is loaded locally?

share|improve this question
Why not change the contents of the one that is being loaded? – Ladadadada Jan 15 '13 at 20:01
Because I have a version control system which allows me to update my server's folder according to the local one. And having the php.ini file located outside my folder locally would complicate things as it would then be located in one place locally and another on server. – Hermann Ingjaldsson Jan 15 '13 at 20:03
It's also a point to just have control over which php.ini gets loaded. – Hermann Ingjaldsson Jan 15 '13 at 20:06
Google tells me you can do it. – Ladadadada Jan 15 '13 at 20:12
The correct syntax is PHPIniDir /path/to/folder. Use apachectl configtest to test your configuration – Daniel Vérité Jan 16 '13 at 13:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.