There are a few ways to create a custom php.ini configuration directives for an apache website.
Create a phpinfo.php file with the following content within your document root.
View this file in your browser and look near the top for which Server API is running PHP.
If PHP is being run by CGI
If the phpinfo.php file’s output says PHP is being run by CGI, then simply place a php.ini file of your own in the site’s root directory.
If PHP is being run by Apache 2.0 Handler
If in the phpinfo.php file you see something like Server API | Apache 2.0 Handler
then use the .htaccess file to change PHP configuration settings.
Here is an example of the .htaccess Code
#format php_value setting_name setting_value #example php_value upload_max_filesize 10M
With Server API | Apache 2.0 Handler one may also use the Apache PHPINIDir directive to tell apache where to look for a custome php.ini file.
For this method, you will need access to the httpd.conf file or perhaps the httpd-vhosts.conf file where the apache directives for the site are configured.
Simply use the PHPINIDir directive followed by the directory where you want apache to look for the custom php.ini file. This directory is usually the document root.
Within the httpd.conf file (or httpd-vhosts), look for the directive of the site.
Then add the line: PHPINIDir /Users/Username/Sites/example.com like this (use your own directory info and site name, obviously):
... (other directives) ... PHPINIDir /Users/Leasure/Sites/ ServerName example.com DocumentRoot /Users/Username/Sites/example.com
Options FollowSymLinks AllowOverride All Order allow,deny Allow from all... (other directives) ...
PHPINIDir directive may only occur once or you will get an apache error.
Now the output of the phpinfo() function should show a value for “Loaded Configuration File” as /Users/Username/Sites/example.com.
To see this output, just take a look at the output of phpinfo.php file you made.
Look for “Loaded Configuration File” you should be able to see your custom php.ini file there.