[BlueOnyx:27222] Re: 5210R PHP Admin Flag not recognized on all Vsites

Michael Stauber mstauber at blueonyx.it
Wed Aug 28 13:18:29 -05 2024


Hi Rodrigo,

> mx httpd[507116]: AH00526: Syntax error on line 36 of 
> /etc/httpd/conf/vhosts/site11:
> 
> mx httpd[507116]: Invalid command 'php_admin_flag', perhaps misspelled 
> or defined by a module not included in the server configuration

That's really strange. Because we use 'php_admin_flag' on 5210R/5211R 
just fine. Here is a typical Vsite Apache configuration, which I grepped 
for just lines starting with "php_":

[root at 5210r ~]# cat /etc/httpd/conf/vhosts/site2|grep ^php_
php_admin_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_admin_flag allow_url_include Off
php_admin_value open_basedir 
/var/lib/php/session/:/usr/sausalito/configs/php/:/tmp/:/tmp:/home/solarspeed/php-8.1/share/pear:/home/.sites/site2/
php_admin_value post_max_size 512M
php_admin_value upload_max_filesize 512M
php_admin_value max_execution_time 900
php_admin_value max_input_time 900
php_admin_value max_input_vars 1000
php_admin_value memory_limit 1024M
php_admin_flag mail.add_x_header On
php_admin_value sendmail_path /usr/sausalito/sbin/phpsendmail
php_admin_value auto_prepend_file 
/usr/sausalito/configs/php/set_php_headers.php
php_flag display_errors Off
php_flag log_errors On
php_flag zlib.output_compression Off
php_flag magic_quotes_gpc Off
php_flag magic_quotes_runtime Off
php_flag zend.ze1_compatibility_mode Off
php_flag suhosin.session.encrypt Off
php_flag session.auto_start Off
php_value session.gc_maxlifetime 21600
php_value session.gc_divisor 500
php_value session.gc_probability 1
php_value mbstring.func_overload 0

So we use both "php_admin_flag" as well as "php_flag" and "php_value" 
and that just works without any issues.

The *only* reason why this would cause Apache to fail to start would be 
if the modules/libphp.so isn't loaded into Apache.

Please check your /etc/httpd/conf.modules.d/15-php.conf and it should 
looks like this on a 5210R:

-------------------------------------------------------------------------
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
   <IfModule prefork.c>
     LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
   </IfModule>
</IfModule>
-------------------------------------------------------------------------

If it doesn't? Then that is probably the problem. OR you used the GUI to 
switch the default PHP version to any other PHP version than the one 
provided by the OS.

In which case you might have a 
/etc/httpd/conf.modules.d/15-php.conf.orig_os, which you can copy back 
to /etc/httpd/conf.modules.d/15-php.conf

Then restart "httpd" and it should work again.

> We are trying to add /home/.sites/siteSite_number/  (from 1 to the 
> number of sites you have)
> to the global php configuration

I really wouldn't mess with the global PHP configuration too much beyond 
what the GUI allows you to do via "Server Management" / "Security" / "PHP".

And you *should* use PHP-FPM for the Vsites instead of PHP as DSO.

If you have any specific PHP options that you still MUST set and the GUI 
won't let you? You can always place *.ini files into ...

/home/sites/<VSITE>/wwwroot/php.d/

... that contain the specific PHP settings that you want to apply to 
that particular Vsite. Example:

[root at 5210r ~]# cat /home/sites/5210r1.smd.net/wwwroot/php.d/roundcube.ini
php_flag zlib.output_compression Off

Please note: The entries in these *.ini files must be in Apache style 
format. So "php_admin_flag", "php_flag" or "php_value".

When you place such files into these directories and save the PHP 
settings of the Vsite in the GUI? Then the data from these files is 
incorporated into the Apache PHP configuration of that Vsite and also 
goes into the PHP-FPM pool configuration of that Vsite or the php.ini of 
the Vsite (if it uses suPHP).

However: Only PHP settings that are not already GUI configurable will be 
treated this way.

Please let me know if that fixes your issues. If not, let me know and/or 
send a "Support Request" via the GUI so that I can take a look.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list