1

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?

john-jones
  • 75
  • 13
  • 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. – john-jones Jan 15 '13 at 20:03
  • It's also a point to just have control over which php.ini gets loaded. – john-jones Jan 15 '13 at 20:06
  • So you can apply the same deploy script to your dev server as your production server, or just symlink /etc/php5/apache2/php.ini -> /path/to/your/php.ini. – Ladadadada Jan 15 '13 at 20:08
  • It's been so long since I setup that server I can't even remember everything about how it was done. The symlink point is interesting but it would mean the version control system has to take care of files and folders spread out over the computer system. I would really like to avoid that. – john-jones Jan 15 '13 at 20:11
  • 1
    [Google tells me you *can* do it](http://stackoverflow.com/questions/10386188/change-php-ini-location). – Ladadadada Jan 15 '13 at 20:12
  • It's also been said that what works on one computer may well not work on another. – john-jones Jan 15 '13 at 20:12
  • My httpd.conf file is empty, and when I add PHPIniDir="path to folder of server" then apache crashes on restart. – john-jones Jan 15 '13 at 20:21
  • 1
    The correct syntax is `PHPIniDir /path/to/folder`. Use `apachectl configtest` to test your configuration – Daniel Vérité Jan 16 '13 at 13:44

0 Answers0