• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

[PPP-18133] Plesk 12.5, php_admin_value in domain httpd.conf

BastienB

New Pleskian
Hello,

I have a big problem with the new plesk 12.5, i updated 10 servers from 12.0.18 to 12.5 yesterday and now all of my domains have "Performance settings" lines in their httpd.conf :
Code:
<IfModule sapi_apache2.c>
                                php_admin_flag engine on

                                # General settings
                                php_admin_value open_basedir "/var/www/vhosts/domain.com/:/tmp/"
                                # Performance settings
                                php_admin_value max_execution_time 60
                                php_admin_value max_input_time 60
                                # Additional directives

                        </IfModule>

                        <IfModule mod_php5.c>
                                php_admin_flag engine on

                                # General settings
                                php_admin_value open_basedir "/var/www/vhosts/domain.com/:/tmp/"
                                # Performance settings
                                php_admin_value max_execution_time 60
                                php_admin_value max_input_time 60
                                # Additional directives

                        </IfModule>

The big problem is the two lines php_admin_value max_execution_time 60 and php_admin_value max_input_time 60, the scripts that use ini_set("max_execution_time", 120) won't change the max execution time because of the "php_admin_value" in the conf.
I can't use a unique max_execution_time for my projects, I have some long script to update big database, so using the plesk interface to specify a per domain max_execution_time is not an option for me as it would set a long max_execution_time on each script of the website, and it's not good.

Why plesk is not using php_value instead of php_admin_value ? Is there a way to prevent plesk from adding thes two lines in each vhost ? I really don't understand why you call these two lines "Performance settings", it's a big regression and cause a lot of trouble on every server I own... By the way I don't understand why you want to put these two lines beacause in the global php.ini, the max_execution_time and max_input_time are already set to 60. For the memory_limit there is not a line, because in plesk and in php.ini it's set to 128M, why you don't do the same for these 2 parameters ?

Thank you for your help.

Regards
 
Last edited:
Hello, @BastienB

Thank you for reporting the issue. I confirm that it's bug with ID PPP-18133 in our internal tracker. I hope it'll be fixed in upcoming microupdates.

Unfortunately, I cannot suggest you any workaround.
 
Hello,

I found a temporary fix, but it's using custom templates and it may cause trouble in case of future update of the default template, but for the moment it helps me a lot.

Attached to this reply is the file domainVirtualHost.php I added in custom templates in /usr/local/psa/admin/conf/templates/custom/domain/

So what I did is just replace php_admin_value lines by a comment :
Code:
$return = $VAR->includeTemplate('service/php.php', array(
        'enabled' => $VAR->domain->physicalHosting->php,
        'safe_mode' => $VAR->domain->physicalHosting->phpSafeMode,
        'dir' => $OPT['ssl'] ? $VAR->domain->physicalHosting->httpsDir : $VAR->domain->physicalHosting->httpDir,
        'settings' => $VAR->domain->physicalHosting->phpSettings,
    ));
   echo preg_replace("/php_admin_value\smax_[a-z]+_time\s[0-9]+/", "#removed by custom template", $return);
If you prefer, you can replace php_admin_value by php_value (i don't use plesk settings for php, that's why i removed the lines completely)
Code:
$return = $VAR->includeTemplate('service/php.php', array(
        'enabled' => $VAR->domain->physicalHosting->php,
        'safe_mode' => $VAR->domain->physicalHosting->phpSafeMode,
        'dir' => $OPT['ssl'] ? $VAR->domain->physicalHosting->httpsDir : $VAR->domain->physicalHosting->httpDir,
        'settings' => $VAR->domain->physicalHosting->phpSettings,
    ));
   echo preg_replace("/php_admin_value\s(max_[a-z]+_time\s[0-9]+)/", "php_value $1", $return);

You can use a one liner script to update all your servers quickly, put this script and the domainVirtualHost.php.txt (add a txt extension to prevent code execution) file in a location you can access with wget and then just type wget -O - http://YOUR_WEBSITE/plesk_template.sh | bash

Here is the content of plesk_template.sh
Code:
#/bin/bash
mkdir -p /usr/local/psa/admin/conf/templates/custom/domain/
cd /usr/local/psa/admin/conf/templates/custom/domain/
wget -O domainVirtualHost.php http://YOUR_WEBSITE/domainVirtualHost.php.txt
/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

Hope this helps.

Regards
 

Attachments

  • domainVirtualHost.php.txt
    13.4 KB · Views: 0
  • plesk_template.sh.txt
    257 bytes · Views: 0
Back
Top