question about apache 2.4 virtual host config

LAZer

Well-Known Member
Jan 18, 2010
86
3
58
at net :D
Hi , I have finally migrated my server from centos 5.3 apache 2.2 cpanel 56 to cents 7.3 apache 2.4 cpanel 64.
I have some problems in configuring virtual hosts as many configurations is changed.

I used to have per user php.ini file outsite of users directory.
I have read some pages regarding how to apply such a change in easyapache 2.4 :

The cPanel PHPRC PHP Patch for EasyApache 4 - EasyApache 4 - cPanel Documentation
PHP Handlers - EasyApache 4 - cPanel Documentation

The suphp.conf file
The suphp.conf file includes the [phprc_paths] section. Use this section to lock a particular PHP handler to its default php.ini file. To lock a particular PHP handler to its default php.ini file, uncomment the appropriate line in the [phprc_paths] section.

The suPHP_ConfigPath configuration directive sets the path to the php.ini file. Set the suPHP_ConfigPath directive in either the httpd.conf file or an .htaccess file.

  • To prevent the use of this directive in .htaccess files, remove the Options parameter from the Apache AllowOverride directive.
  • The [phprc_paths] settings in the suphp.conf file overrride any suPHP_ConfigPath settings.


I currently have the setting of php 5.6 with fpm : off .
the settings in /etc/suphp.conf in the part of [phprc_paths] settings are all commented. ( no active rules defined there. )
when I use .user.ini in public_html directory of <cphostuser> some directives change , but some are ignored.
for example I want to set File_uploads : off in multiphp ini editor , and have a restricted disable_functions , but allow them for some users via their own php.ini file.

when i set file_uploads=on in public_html\.user.ini then i check phpinf() it does not change .
but some other directives work for example display_errors=on works.

then I set suphp_ConfigPath in .htacceass and copy a full php.ini to a directory and set its path here. it works fine and the "loaded configuration path" changes to this php.ini that I set.

now I want to have this suphp_ConfigPath in the virtual host config of that user instead of .htaccess file that user may change it.

as this link says :
Modify Virtualhost Containers With Include Files - EasyApache - cPanel Documentation

Without SSL /usr/local/apache/conf/userdata/std/2_4/$user/$includename.conf

I put that php.ini code to this config
/usr/local/apache/conf/userdata/std/2_4/<cphostuser>/user.conf

then I update virtual host configs :
/scripts/ensure_vhost_includes --user=cphostuser

but It doesn't read the suphp code to change the php.ini address like what it does from .htaccess file.
any solutions ?
 

LAZer

Well-Known Member
Jan 18, 2010
86
3
58
at net :D
from the comments in httpd.conf I could find the correct address for includes config .

the address in 2_4 easyapache 4 is : /etc/apache2/conf.d/userdata/std/2_4/<username>/<user>.conf
I used to place configs in /usr/local/apache/conf/userdata/std/2_4/
which didn't work. but it worked in 2_2 and 2....
maybe linking this directory to the new address fixes it . anyways I'll upload my configs to this new directory.

also I could make it read suPHP_ConfigPath by using <Directory /home/<user>/public_html> command.


<Directory /home2/<username>/public_html>
suPHP_ConfigPath /home/ini/<username>/
</Directory>
and updating httpd config using script and restarting httpd. works. it completely changed the loaded configuration php.ini path in phpinfo of the user.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
I put that php.ini code to this config
/usr/local/apache/conf/userdata/std/2_4/<cphostuser>/user.conf
the address in 2_4 easyapache 4 is : /etc/apache2/conf.d/userdata/std/2_4/<username>/<user>.conf
I used to place configs in /usr/local/apache/conf/userdata/std/2_4/
Hello,

You can find the updated documentation on how to make changes to the Virtual Host include files with EasyApache 4 at:

Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

Thank you.