-1

I am trying to configure php installation to use multiple php.ini Is this it feasible?

Thanks,

0

1 Answer 1

-1

TL;DR Add PHPIniDir to Apache conf file and ensure that folder contains a version of php.ini suited to your requirements.

A little more information would be required to ensure a full answer, but I'll make an assumption and take it that you're working with a LAMP server, and require making a custom PHP.ini for each server hosted under Apache (vhost). If so, it's a simple procedure for having one (Apache) server host multiple vhosts and each vhost having it's own php.ini file.

  1. Create your new vhost, with it's own folder (assuming /var/www/vhostA)
  2. Create the html folder (housing the document root) in /var/www/vhostA/html
  3. Copy your existing php.ini file (typically /etc/php5/apache2/php.ini) to /var/www/vhostA/php.ini
  4. Edit the php.ini (as per 3) as you require it for vhostA's purposes
  5. Edit the vhost configuration file and add PHPIniDir /var/www/vhostA
  6. Restart Apache

An example Apache vhost configuration file would (therefore) read something like this:

<VirtualHost 1.2.3.4:80> DocumentRoot /var/www/vhostA/html <Directory "/var/www/vhostA/html"> Options -Indexes </Directory> PHPINIDir /var/www/web1 ErrorLog ${APACHE_LOG_DIR}/vmhostA-error.log CustomLog ${APACHE_LOG_DIR}/vmhostA-access.log combined </VirtualHost> 
Sign up to request clarification or add additional context in comments.

1 Comment

Where was any mention made of Apache in the question?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.