Custom php.conf how to preserve cpanel from overwriting it?

palav0s

Well-Known Member
Jul 15, 2011
55
0
56
Hello,

I would like to find out how can I make a custom php.conf suffice future updates or rebuilds.

From the Using Custom Configure Flags section of cpanel documenation.

[...]
Create the file that corresponds to the version of Apache or PHP for which you would like to add a custom configure flag.
In the file, enter the flag you wish to add.
The file will be parsed, and the options properly formatted before EasyApache adds them to the data structure.
See the example below for more information about formatting your custom flags.
Save the changes you have made to the file.
Since it's php version 5.x.x I create this file /var/cpanel/easy/apache/rawopts/all_php5
... and then passing the arguments as the example:

Code:
--with-flag

--path-to-flag=/usr/bin/flag

--my-option=
:confused: But how do I pass these arguments?

I would like to pass the following options:
Code:
FcgidConnectTimeout 20
MaxRequestLen 157286400
Thanks
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
44
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Rather than putting them into /usr/local/apache/conf/php.conf file, please try putting them into /usr/local/apache/conf/includes/pre_virtualhost_global.conf file. That file will not be overwritten on Apache updates.

After adding values to that file, you would need to run these commands:

Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110715
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
 

palav0s

Well-Known Member
Jul 15, 2011
55
0
56
Rather than putting them into /usr/local/apache/conf/php.conf file, please try putting them into /usr/local/apache/conf/includes/pre_virtualhost_global.conf file. That file will not be overwritten on Apache updates.
/usr/local/apache/conf/includes/pre_virtualhost_global.conf file is only for the php.conf ?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
44
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
No, it isn't only for the php.conf file contents that you want to add. It can be used for anything that needs to be global right before the VirtualHost entries in the httpd.conf file.
 

palav0s

Well-Known Member
Jul 15, 2011
55
0
56
No, it isn't only for the php.conf file contents that you want to add. It can be used for anything that needs to be global right before the VirtualHost entries in the httpd.conf file.
A "silly" question(?) how it differentiates that the configuration I entered there (in usr/local/apache/conf/includes/pre_virtualhost_global.conf file) is for the php.conf file or another config file?

Thanks for your response Tristan.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
44
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
If you are prepending your entries with FcgidName such as FcgidIdleTimeout, then it is apparent to Apache how to handle the request. Otherwise, you can always wrap them in an If statement such as:

Code:
<IfModule mod_fcgid.c> 
FcgidIdleTimeout 300 
FcgidIdleScanInterval 120 
FcgidProcessLifeTime 600 
FcgidIOTimeout 600 
FcgidMinProcessesPerClass 0 
FcgidMaxProcessesPerClass 4
</IfModule>
Of note, the above is just an example configuration not a recommendation for values.