I wanna explain how you can specify php.ini config for a web running using apache web server with mode_php. That way your website in virtual host can have its own php.ini instead of having the default php.ini
i’m not guarantee that this work for you, but I’ve tested for one virtualhost but i’m tried again its fail for other virtual host.
i’m running my server on debian 7.6
- Let’s take a look for your php info server
Create php file, the name is up to you i suggested (info.php) in the root document for your website in open in browser. The file will display lots of useful information about your php version running on your server, and also php.ini location.nano /var/www/web1/info.php
<?php phpinfo(); ?>
no open in your browser (e.g. http://rupi.co/info.php)
as you see at the image, the web server currently using php.ini is located in the path directory /etc/php5/apache2/php.ini - Custom php.ini for each website run on your server
Now we’ll copy the default php.ini that located ini (/ect/php5/apache2/php.ini ono my server debian) to the directery /var/www/web1/ is where my example.com website located and use current php.ini in /var/www/web1 directory. the command is :cp /etc/php5/apache2/php.ini /var/www/web1/
that use in debian, so now we can modify php.ini in /var/www/web1/php.ini
After that let’s open the vhost configuration of your website rupi.co and add PHPINIDir line to it :<VirtualHost *:80> [...] PHPINIDir <em>/var/www/web1</em> <em>[...]</em> <em></VirtualHost></em> <em>
PHPINIDir must contain the directory where the php.ini file for the web site is located.
- Restart Apache afterwards:
service apache2 restart