Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not ...

I
I think you have php mode set which doesn't support php_admin_flag. Please check if the following solves it:
Code:
cd /usr/local/directadmin/custombuild
./build update
./build php
./build rewrite_confs
was having same problem and this steps works for me!!
 
Dear forum,

I currently experience the same problem and I've done all I could in this thread, along with Googling to try and fix this issue.

After using the update custombuild button and update all, the edit options section no longer seems to work and although it's off-topic, I'd still like to mention the thrown error that made me do the decission changing up PHP versions:

Code:
Parse error: syntax error, unexpected '?' in /usr/local/directadmin/plugins/custombuild/admin/tabs/edit_options.php on line 33

Some servers had it, some don't. Those that did have it had in common that all of them were operating under PHP 5.6 or below.
I have made the change of going from PHP 5.6 as the default php with php1_mode mod_php and 8.0 with php2_mode php-fpm to switching the 2 of them, meaning 8.0 mod_php as first choice and 5.6 php-fpm as 2nd choice.

Immediately after this change, nothing bad happens besides the now incorrectly chosen PHP versions on all hosting accounts as they were now on 8.0 instead of 5.6. But that is beside the point. I switch the versions around for each user and that fixes that. When things do break is when I execute the following command:

Code:
cd /usr/local/directadmin/custombuild
./build rewrite_confs

It will immediately break with the following message:

Code:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.


Code:
[root@vps01 ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2022-01-05 17:39:07 CET; 6s ago
  Process: 10209 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 10209 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

Jan 05 17:39:07 vps01.jk.nl systemd[1]: Starting The Apache HTTP Server...
Jan 05 17:39:07 vps01.jk.nl httpd[10209]: AH00112: Warning: DocumentRoot [/home/denoord/domains/dev.heerhugowaarddenoord.nl/public_html] does not exist
Jan 05 17:39:07 vps01.jk.nl httpd[10209]: AH00526: Syntax error on line 33 of /usr/local/directadmin/data/users/ovnh/httpd.conf:
Jan 05 17:39:07 vps01.jk.nl httpd[10209]: Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration
Jan 05 17:39:07 vps01.jk.nl systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 05 17:39:07 vps01.jk.nl systemd[1]: Failed to start The Apache HTTP Server.
Jan 05 17:39:07 vps01.jk.nl systemd[1]: Unit httpd.service entered failed state.
Jan 05 17:39:07 vps01.jk.nl systemd[1]: httpd.service failed.
[root@vps01 ~]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/php80/lib/php/extensions/no-debug-zts-20200930/imagick.so (/usr/local/php80/lib/php/extensions/no-debug-zts-20200930/imagick.so: cannot open shared object file: No such file or directory), /usr/local/php80/lib/php/extensions/no-debug-zts-20200930/imagick.so.so (/usr/local/php80/lib/php/extensions/no-debug-zts-20200930/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.0.14 (cli) (built: Jan  5 2022 17:08:01) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v4.0.14, Copyright (c) Zend Technologies

My PHP specs as-is right now are:

php1_release=8.0
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm
mod_ruid2=no

I've made the change from 8.0 mod_php to php-fpm after finding out it could break this exact flag, same with mod_ruid2 which was initially set to yes. Php 3 and 4 are not present.

I've ./build the php versions 4 times at this point, always fixing itself until I use ./build rewrite_confs . I have not yet tried a ./build_all, but I'm deliberately not wanting to perform one right now as for 1 it's late in the office hours at the time of writing this and I have yet to set 163 domains to 5.6, and 2 there's no clear reason for me to do so.

I'm looking forward to hearing from everyone for suggestions at this point.

Edit: my priority right now is not the non-functioning imagick as that's only 1 specific domain that doesn't have priority over everything not working as intended right now to begin with.
 
Did you see this?
AH00112: Warning: DocumentRoot [/home/denoord/domains/dev.heerhugowaarddenoord.nl/public_html] does not exist
When I'm looking with nslookup, this subdomain can't be found so there is no A record present either.
And the directory does not exists, this is no apache or php issue.
 
Did you see this?

When I'm looking with nslookup, this subdomain can't be found so there is no A record present either.
And the directory does not exists, this is no apache or php issue.
Apologies, I did not. Because the error seemed very similar to the mode set that was not compatible with the setup I initially had, I just saw the same pattern without realising the error had changed in fact. Reading 101. After deleting said domain, along with 2 other domains with the same notification, running the ./build rewrite_confs command again still gave me the trouble I was initially having though
Code:
[root@vps01 custombuild]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2022-01-05 18:22:02 CET; 3s ago
  Process: 26469 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 29072 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 29072 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

Jan 05 18:22:02 vps01.jk.nl systemd[1]: Starting The Apache HTTP Server...
Jan 05 18:22:02 vps01.jk.nl httpd[29072]: AH00526: Syntax error on line 33 of /usr/local/directadmin/data/users/ovnh/httpd.conf:
Jan 05 18:22:02 vps01.jk.nl httpd[29072]: Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration
Jan 05 18:22:02 vps01.jk.nl systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 05 18:22:02 vps01.jk.nl systemd[1]: Failed to start The Apache HTTP Server.
Jan 05 18:22:02 vps01.jk.nl systemd[1]: Unit httpd.service entered failed state.
Jan 05 18:22:02 vps01.jk.nl systemd[1]: httpd.service failed.
[root@vps01 custombuild]#
 
Oke that's better otherwise it could make things confusing or somebody (like me) gives you answers based on wrong assumptions.
Just to be sure, can you post line 33 of that specific httpd.conf of the user?
 
I've noticed some other php_admin_flags within the same section, so I'll include them too
Code:
        <Directory /home/ovnh/domains/ovnh.nl/public_html/2007>
                Options +Includes -Indexes
                php_admin_flag engine ON
                <IfModule !mod_php6.c>
                        php_admin_flag safe_mode OFF
                </IfModule>
                php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
                php_admin_value open_basedir /home/ovnh/:/tmp:/usr/local/lib/php/
        </Directory>
 
Looks to me as a custom httpd.conf thing or maybe old not converted php 5.x or something like that. Did you or the user create some custom vhost section anywhere?

For php-fpm 7.x and higher it should look like this:
Code:
<Directory "/home/user/public_html">
                <FilesMatch "\.(inc|php|phtml|phps|php74)$">
                        AddHandler "proxy:unix:/usr/local/php74/sockets/user.sock|fcgi://localhost" .inc .php .phtml .php74
                </FilesMatch>
        <IfModule mod_fcgid.c>
                SuexecUserGroup user user
        </IfModule>
</Directory>

There are no php_admin flags used in there.

But now just something comes in to my mind. You are using mod_php in combination with php-fpm? Are you also having mod_ruid2 in effect or what are you using with the mod_php then? Because you can't combine mod_php with mod_ruid2 in a multi php config with php-fpm.
That will cause issues.

I don't know if you have a reason to still use mod_php, but if not, it's best to set everything to php_fpm and than rebuild again.
Also... tip: push your users to upgrade their scripts so you don't have to support ancient php versions anymore.;)
 
You are using mod_php in combination with php-fpm? Are you also having mod_ruid2 in effect or what are you using with the mod_php then? Because you can't combine mod_php with mod_ruid2 in a multi php config with php-fpm.
That will cause issues.
I'm aware of this and I've already set this to the following, and it still gave me the above problems:

My PHP specs as-is right now are:

php1_release=8.0
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm
mod_ruid2=no
 
So you rebuild both all php versions first again and after that did the rewrite_confs again, correct?
If not, try that first.

If yes, and the content of that httpd.conf is still the same, then something there is wrong. Did you or the users made any custom httpd configuration to add these php admin flags? Because I can't recall ever having seen php admin flags in that httpd conf without custimization. I could be wrong. Or it's old config values which are not changed.
 
So you rebuild both all php versions first again and after that did the rewrite_confs again, correct?
If not, try that first.
I did. However, it feels like I'm more in for doing a ./build_all right now. This is currently in progress and I expect it to take about half an hour.
Did you or the users made any custom httpd configuration to add these php admin flags? Because I can't recall ever having seen php admin flags in that httpd conf without custimization. I could be wrong. Or it's old config values which are not changed.
It feels like it's most likely the latter one, which in turn might be a bug introduced when the config at the time looked like this:

php1_release=5.6
php1_mode=mod_php
php2_release=8.0
php2_mode=php-fpm
mod_ruid2=yes

I used these commands while the config was as above:

Code:
cd /usr/local/directadmin/custombuild
./build set php2_release 5.6
./build set php1_release 8.0
./build php n
./build rewrite_confs

Edited for chronological clarity.
Edit 2: I will not perform
Code:
./build rewrite_confs
as I just want to go home right now and not risk having to ./build the whole thing again.
 
might be a bug introduced when the config at the time looked like this:
Oh yes that's a good chance because combining php-fpm and mod_php with mod_ruid2 in multi-php will cause issues.

as I just want to go home right now and not risk having to ./build the whole thing again.
I can imagine that. Then maybe tomorrow have a look how that http.conf looks now. If it does not contain the php admin flags you should be fine to run the rewrite_confs again. If they still contain them, then somewhere there must be a custom config.
 
Then maybe tomorrow have a look how that http.conf looks now. If it does not contain the php admin flags you should be fine to run the rewrite_confs again. If they still contain them, then somewhere there must be a custom config.
Oh yeah. It's definitely something custom made. It looks like this was added in, although I don't know how to make this fixable for the time being. I'll have to discuss this with some people irl. Thank you very much for pointing me into the right direction, it definitely seems like this is the issue.
 

Attachments

  • chrome_oyswCwYEoa.png
    chrome_oyswCwYEoa.png
    95 KB · Views: 154
Thank you very much for pointing me into the right direction, it definitely seems like this is the issue.
You're welcome. Have your talk with the people.
Maybe it's possible to remove the customized vhost, create the new modern vhosts (with the rewrite_confs so everything works again and then it might be possible to add the lines in again as far as needed. Probably that might do the trick.
 
Back
Top