SetEnv PHP_INI_SCAN_DIR not working

ssgill

Verified User
Joined
May 9, 2012
Messages
164
Hello, i am running Apache/2.4.12 with PHP Version 5.3.29 as FPM/FastCGI.

From Directadmin Admin Panel -> Custom HTTPD Configurations

I added this line to Custom HTTPD Configurations section for one account.
Code:
SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/|USER|/php/

checked /usr/local/directadmin/data/users/useraccount/httpd.conf and it does contain the line.

Code:
<VirtualHost xxx.xxx.xx.xxx:80 >
SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/useraccount/php/

From Custom HTTPD Configurations, Clicked on link (php-fpm 5.3) next to user account and added this line in custom1 section
Code:
php_value[short_open_tag] =  On

Checked /usr/local/directadmin/data/users/useraccount/php/php-fpm53.conf.custom1
and it does contain the above line.

Restarted apache, and its not parsing the user php.ini file at all.
This is from phpinfo()

Configuration File (php.ini) Path /usr/local/php53/lib
Loaded Configuration File /usr/local/php53/lib/php.ini
Scan this dir for additional .ini files /usr/local/php53/lib/php.conf.d
Additional .ini files parsed /usr/local/php53/lib/php.conf.d/10-directadmin.ini, /usr/local/php53/lib/php.conf.d/50-webapps.ini

Anything that i am missing to enable scanning of user ini files.

Thanks
 
Hello,

You don't need to use PHP_INI_SCAN_DIR with FPM/FastCGI.
Use /usr/local/directadmin/data/users/<username>/php/<domain>.ini instead.
 
Thanks Alex for quick reply, i created mydomain.com.ini in said location "/usr/local/directadmin/data/users/<username>/php/" and added these lines in there
PHP:
short_open_tag = On[/QUOTE]
Restarted apache and still phpinfo shows it off for both local and master value.
 
Please use "Custom HTTPd Configuration" functionality on DirectAdmin admin level, it allows customizing PHP-FPM configuration for specific domains and set PHP values there.
 
Please use "Custom HTTPd Configuration" functionality on DirectAdmin admin level, it allows customizing PHP-FPM configuration for specific domains and set PHP values there.
Tried that, please check my initial post. There are other 3 files in there created by directadmin but apache/php is not scanning this folder
/usr/local/directadmin/data/users/domainname/php/

Code:
-rw-r--r-- 1 root     root       20 Mar 13 14:23 domainname.com.ini
-rw-r--r-- 1 root     root      634 Mar 13 12:32 php-fpm53.conf
-rw-r--r-- 1 diradmin diradmin   31 Mar 13 12:32 php-fpm53.conf.custom1
-rw-r--r-- 1 diradmin diradmin    0 Mar 13 12:32 php-fpm53.conf.custom2
 
Did you restart PHP-FPM?

I had not restarted PHP-FPM, so restarted it.

Code:
[root@matrix2 php]# service php-fpm53 restart
Redirecting to /bin/systemctl restart  php-fpm53.service
[root@matrix2 php]#

Result is still the same.
 
Tried that, please check my initial post. There are other 3 files in there created by directadmin but apache/php is not scanning this folder
/usr/local/directadmin/data/users/domainname/php/

Code:
-rw-r--r-- 1 root     root       20 Mar 13 14:23 domainname.com.ini
-rw-r--r-- 1 root     root      634 Mar 13 12:32 php-fpm53.conf
-rw-r--r-- 1 diradmin diradmin   31 Mar 13 12:32 php-fpm53.conf.custom1
-rw-r--r-- 1 diradmin diradmin    0 Mar 13 12:32 php-fpm53.conf.custom2

Your php-fpm53.conf file should contain the customizations done. I see you have incorrect ownership set (root, instead of diradmin), please try changing the ownership and customizing the template again. Additionally, you may call the following commands to get php-fpm53.conf rewritten (to get the changes from php-fpm53.conf.custom1 included):
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d
 
Thanks Martynas, i manually changed file ownership and then ran rewrite command, restarted PHP-FPM and apache still the result was same. So for now i have enabled it globally but still would like to figure out why it was not working. If you have any more suggestions i would like to try them.

Thanks
 
I had not restarted PHP-FPM, so restarted it.

Result is still the same.

Do you have original virtual host templates? Or customized?

Code:
ls -la /usr/local/directadmin/data/templates/virtual_host2*.conf
ls -la /usr/local/directadmin/data/templates/custom/virtual_host2*.conf
 
Back
Top