2

I would like to use a different PHP.INI file for each site hosted on a shared server.

I have modified the Apache vhosts file for each of the sites, adding the line…

PHPINIDir /srv/www/my-domain.com/

So the vhosts file /etc/apache2/sites-enabled/my-domain.com now reads thus…

<VirtualHost 123.54.67.89:80>
    ServerAdmin [email protected]
    ServerName my-domain.com
    ServerAlias www.my-domain.com
    DocumentRoot /srv/www/my-domain.com/www/
    ErrorLog /srv/www/my-domain.com/logs/error.log
    CustomLog /srv/www/my-domain.com/logs/access.log combined
    PHPINIDir /srv/www/my-domain.com/
</VirtualHost>

On reloading Apache I get the following error.

Syntax error on line 8 of /etc/apache2/sites-enabled/my-domain.com:
Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored
   ...fail!

Setting the PHPINIDir directive in just one of the vhosts files works, but then every site picks up that PHP.INI file.

We are running PHP5.3.2 on Ubuntu 10.04.

Any suggestions on how to achieve this?

P.S. The point of this is to have each site generating its own PHP error log.

1
  • add "/etc/apache2/sites-enabled/my-domain.com" to question
    – alvosu
    Feb 7, 2011 at 10:30

2 Answers 2

0

Have you already checked out php-fpm with apache's mod_fastcgi? It allows you to define exactly the configuration you need through pools, and you can even chroot the users! ;)

-2

The solution was to add a line to the vhost configuration file which set the specific PHP value I required. So rather than setting the path to php_error.log in a custom PHP.INI file for each site I modified the vhosts config file for each site as required.

So my vhost config file now reads thus…

<VirtualHost 123.54.67.89:80>
   ServerAdmin [email protected]
   ServerName my-domain.com
   ServerAlias www.my-domain.com
   DocumentRoot /srv/www/my-domain.com/www/
   ErrorLog /srv/www/my-domain.com/logs/error.log
   CustomLog /srv/www/my-domain.com/logs/access.log combined
   php_value error_log /srv/www/my-domain.com/logs/php_error.log
</VirtualHost>

I found the solution elsewhere on ServerFault.

1
  • 2
    You didn't answer your question. Defining php_value is not the same thing as having customized php.ini...
    – Alex G
    Dec 29, 2012 at 21:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .