Permission denied for 7.4 mod_php

micheld

Verified User
Joined
Apr 5, 2006
Messages
56
Location
NL
I have problems on php version 7.4

I see in the error log many Permission denied
PHP Warning: fputs() expects parameter 1 to be resource, bool given i
PHP 8.2 is works fine. But not all webapplications running on that version. Normal i use fpm for other servers and works fine. I try that but that same problem.
Looks like there is no apache group for php 7.4..

I try to reinstall:
cd /usr/local/directadmin/custombuild
./build update
./build php n
./build rewrite_confs

I already fix this problem:
Apache 2.4.27 and higher will not negotiate http2 with mpm_prefork. Please do not use mod_php or disable http2 in the directadmin.conf

/usr/local/directadmin/directadmin set http2 0
service directadmin restart

And do it again
cd /usr/local/directadmin/custombuild
./build update
./build php

See my options.conf
#PHP Settings
php1_release=7.4
php1_mode=mod_php
php2_release=8.2
php2_mode=suphp
php3_release=no
php3_mode=php-fpm
php4_release=no
php4_mode=php-fpm
secure_php=yes
php_ini=no
php_timezone=Europe/Amsterdam
php_ini_type=production
x_mail_header=yes

#MySQL Settings
mysql=5.7
mariadb=10.4
mysql_inst=mariadb
mysql_backup=yes
mysql_backup_gzip=no
mysql_backup_dir=/usr/local/directadmin/custombuild/mysql_backups
mysql_force_compile=no

#WEB Server Settings
webserver=apache
http_methods=ALL
litespeed_serialno=trial
modsecurity=no
modsecurity_ruleset=comodo
apache_ver=2.4
apache_mpm=auto
mod_ruid2=no
userdir_access=no
harden_symlinks_patch=yes
use_hostname_for_alias=yes
redirect_host=wwxxxxx.xxx.xx
redirect_host_https=no

#WEB Applications Settings
phpmyadmin=yes
phpmyadmin_public=yes
phpmyadmin_ver=5
squirrelmail=no
roundcube=yes
webapps_inbox_prefix=no

#ClamAV-related Settings
clamav=no
clamav_exim=yes
modsecurity_uploadscan=no
proftpd_uploadscan=no
pureftpd_uploadscan=no
suhosin_php_uploadscan=no

#Mail Settings
exim=yes
eximconf=yes
eximconf_release=4.5
blockcracking=no
easy_spam_fighter=no
spamd=rspamd
sa_update=daily
dovecot=yes
dovecot_conf=yes
mail_compress=no
pigeonhole=no

#FTP Settings
ftpd=pureftpd

#Statistics Settings
awstats=no
webalizer=yes

#CustomBuild Settings
custombuild=2.0
custombuild_plugin=yes
autover=no
bold=yes
clean=yes
cleanapache=yes
clean_old_tarballs=yes
clean_old_webapps=yes
downloadserver=files6.directadmin.com

#Cronjob Settings
cron=yes
cron_frequency=weekly
email=X@xxx,nl
notifications=yes
da_autoupdate=yes
updates=yes
webapps_updates=yes

#CloudLinux Settings
cloudlinux=no
cloudlinux_beta=no
cagefs=no

#Advanced Settings
autoconf=yes
automake=yes
libtool=yes
curl=yes
new_pcre=yes
ssl_configuration=intermediate

unit=no
unofficial_mirrors=no
redis=yes
csf=no

I hope someone can help me
 
If I'm not mistaken, you can't combine mod_php with php-fpm. So you have to change your first php version.
Why don't you use php-fpm there anyway? This way also httpd2 can be used too.

Another option is to disable php 8.2 so you only have 1 php version and then use mod_ruid2 in combination with mod_php.

Ofcourse 8.2 is a high version, you can also put 8.1 in between to test if that works for you. But I would suggest to use php-fpm everywhere.
 
Okay, I didn't know that, but it does explain why this doesn't work. And understand now the group problem.

Normally I always use php-fpm on al servers but after an update php fpm stopped working for 7.4 and 8.2 and I had to solve it fast and tried another php type that partly works.
So i have 2 different types PHP can always be only 1 type but with different versions correct?
 
So i have 2 different types PHP can always be only 1 type but with different versions correct?
I don't quite underastand your question. What to you mean with 1 type of different versions? You mean the mode?
Can you create an example of what you mean?

If it's the php mode what you mean, then I'm not 100% sure. I know that to have php-fpm working with something else, it might be necessary to not use mod_php but it is possible with mod_fcgi. Again, not 100% sure.
It's not really explained in the docs, at least I can't find it.
 
Hi Richard,
By type i mean only use one of:
- mod_php
- lsphp
- suphp
- fastcgi
- php-fpm
of these and no combination?

So i must use example mod_php for 7.4 and 8.2?
And not 7.4 mod_php and 8.4 php-fpm
Best regards,
Michel
 
mod_php need mod_ruid2, but php-fpm not need. try enable it and rebuild php

in the past I use mod_php with php-fpm too but due too much problem I use all php-fpm now.



I guest, it will break change between mod_php and php-fpm due mod_ruid2
 
of these and no combination?
If I'm not mistaken you can combine php-fpm with fastcgi.
For other combinations I don't know.

However I do know that you can't use mod_ruid2 in a multi-php environment. It will also cause issues.
We've use only 1 php version with mod_php and mod_ruid2 for a very long time. But since we went over to php-fpm (about 2 or 3 years ago) I don't want to go back anymore.

Normally I always use php-fpm on al servers but after an update php fpm stopped working
Pity you didn't have the time to find out why it stopped working, because probably it was something small. Working with php-fpm gives a big freedom for the users, and the option to see if their websites are compatible with newer versions, because they can easily switch between php versions.

At this moment we are running php7.4 as main, and then 8.0 and 8.1. But very soon 8.1 will be the default and then 8.2 as second choice and 7.4 as last choice, so users have some time to upgrade their scripts/websites, before we will remove 7.4 somewhere begin next year.
 
mod_php need mod_ruid2, but php-fpm not need. try enable it and rebuild php

in the past I use mod_php with php-fpm too but due too much problem I use all php-fpm now.



I guest, it will break change between mod_php and php-fpm due mod_ruid2

When i do that i see
WARNING: It's not recommended to use apache with mod_ruid2 & suPHP enabled. It's a redundant and slow combination. mod_ruid2 does not support CentOS8/9

When the error came up with php fpm I searched the forum but didn't find a solution. So i try fo fix it using
mod_php and suphp. And it works but not fine.

I don't remember the error message. I should do it again. But then there is a chance that there will be a downtime if 7.4 and 8.2 running on php-fpm
 
that's right, mod_php need mod_ruid2, it help to solve permission issued.
Example: folder with perm 0755 will not work. ( Your app can't read/write in that folder unless you set 0777).

that's why it doesn't work. Downtime probably coming from DDOS attack. or less setting to handle many client. like "pm.max_children". default will be 10
 
Example: folder with perm 0755 will not work. ( Your app can't read/write in that folder unless you set 0777).
With mod_ruid2 this is no issue, then you don't need 777 anymore and 755 will be enough.

mod_ruid2 does not support CentOS8/9
Hmmz... I didn't know that one. In that case it might be better to use php-fpm then.

But then there is a chance that there will be a downtime if 7.4 and 8.2 running on php-fpm
Correct, but you now know how to fix that right? You can test it at night time if you want.
I'm mostly awake at night, although I put out the pc around 01.00 or 01.30 nowadays. But if you want to test, I'm from the Netherlands too, then we can agree some time tonight at your convenience (before 02.00 hours) and then you can post the problem on the forum and I can see if I know how to fix that fast.

If it doesn't work, others might help with the error notice later, but in the meantime you can put your fix back so everything works and then the customers aren't bothered by your test.
 
Hi Richard, I really appreciate that. Of course I want to go back to php-fpm. Then all webservers are the same.

I can perform the update after 21 hours, I have already discussed this. I know how to go back indeed
 
I have to go out at 21.00 hours but I'll be back around 21.30 so if you want to do it this evening it's oke. Let's see if we can fix things for you.
Maybe @jamgames2 is here this evening too, who knows we might get lucky and find the cause of the issue.
 
I do this only build php 7.4 fpm:
/usr/local/directadmin/directadmin set http2 1
service directadmin restart

cd /usr/local/directadmin/custombuild
./build update
./build php

#PHP Settings
php1_release=7.4
php1_mode=php-fpm
php2_release=no
php2_mode=php-fpm
php3_release=no
php3_mode=php-fpm
php4_release=no
php4_mode=php-fpm
secure_php=yes
php_ini=no
php_timezone=Europe/Amsterdam
php_ini_type=production
x_mail_header=yes

#MySQL Settings
mysql=5.7
mariadb=10.4
mysql_inst=mariadb
mysql_backup=yes
mysql_backup_gzip=no
mysql_backup_dir=/usr/local/directadmin/custombuild/mysql_backups
mysql_force_compile=no

#WEB Server Settings
webserver=apache
http_methods=ALL
litespeed_serialno=trial
modsecurity=no
modsecurity_ruleset=comodo
apache_ver=2.4
apache_mpm=auto
mod_ruid2=no
userdir_access=no
harden_symlinks_patch=yes
use_hostname_for_alias=yes
redirect_host=xxx
redirect_host_https=yes

#WEB Applications Settings
phpmyadmin=yes
phpmyadmin_public=yes
phpmyadmin_ver=5
squirrelmail=no
roundcube=yes
webapps_inbox_prefix=no

#ClamAV-related Settings
clamav=no
clamav_exim=yes
modsecurity_uploadscan=no
proftpd_uploadscan=no
pureftpd_uploadscan=no
suhosin_php_uploadscan=no

#Mail Settings
exim=yes
eximconf=yes
eximconf_release=4.5
blockcracking=no
easy_spam_fighter=no
spamd=rspamd
sa_update=daily
dovecot=yes
dovecot_conf=yes
mail_compress=no
pigeonhole=no

#FTP Settings
ftpd=pureftpd

#Statistics Settings
awstats=no
webalizer=yes

#CustomBuild Settings
custombuild=2.0
custombuild_plugin=yes
autover=no
bold=yes
clean=yes
cleanapache=yes
clean_old_tarballs=yes
clean_old_webapps=yes
downloadserver=files6.directadmin.com

#Cronjob Settings
cron=yes
cron_frequency=weekly
email=xxxx
notifications=yes
da_autoupdate=yes
updates=yes
webapps_updates=yes

#CloudLinux Settings
cloudlinux=no
cloudlinux_beta=no
cagefs=no

#Advanced Settings
autoconf=yes
automake=yes
libtool=yes
curl=yes
new_pcre=yes
ssl_configuration=intermediate

unit=no
unofficial_mirrors=no
redis=yes
csf=no

This is the last items i see:
Make complete
Installing shared extensions: /usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/
Installing header files: /usr/local/php74/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
imagick 3.7.0 PHP extension has been installed successfully.
Enabling php-fpm74 in systemd...
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm74.service -> /etc/systemd/system/php-fpm74.service.
Restarting apache.
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xe" for details.
Rewriting all users httpd.conf files, please wait...
Debug mode. Level 10

dataskq: command: action=rewrite&value=httpd
PHP 7.4.32 Installed.

It works but restart
[root@www16 custombuild]# service php-fpm74.service status
Redirecting to /bin/systemctl status php-fpm74.service
● php-fpm74.service - The PHP FastCGI Process Manager
Loaded: loaded (/etc/systemd/system/php-fpm74.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-10-03 21:23:50 CEST; 6min ago
Process: 1337749 ExecReload=/bin/kill -USR2 $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 1336830 (php-fpm74)
Status: "Processes active: 0, idle: 17, Requests: 2233, slow: 0, Traffic: 7req/sec"
Tasks: 14 (limit: 49493)
Memory: 133.2M
CGroup: /system.slice/php-fpm74.service
├─1336830 php-fpm: master process (/usr/local/php74/etc/php-fpm.conf)
├─1338563 php-fpm: pool frw(
├─1338564 php-fpm: pool pl
├─1338565 php-fpm: pool we
├─1338566 php-fpm: pool gte
├─1338567 php-fpm: pool ccc
├─1338578 php-fpm: pool rg
└─1339283 php-fpm: pool gg

Oct 03 21:23:50 xx.xxx.nl systemd[1]: Starting The PHP FastCGI Process Manager...
Oct 03 21:23:50 xx.xxx.nl systemd[1]: Started The PHP FastCGI Process Manager.
Oct 03 21:24:47 xx.xxx.nl systemd[1]: Reloading The PHP FastCGI Process Manager.
Oct 03 21:24:47 xx.xxx.nl systemd[1]: Reloaded The PHP FastCGI Process Manager.

I change some usernames and website urls.

seems to be working now 10 minutes. Before that it also worked but many restarts every minute httpd.service failed.
 
Last edited:
Everything seems to be going well. thanks for your support. I now remember when it go wrong a lot of restarting the services last errors.

But thank you all for now
 
Oke at first my apology's that i'm way later, totally forgot about it. If something like that happens again, send me a pm then I'm notified and come back when I forget. I feel a bit ashamed now. 😶‍🌫️

As for the building process.
It indeed looks good now, but I'm still wondering. If you encounter this issue again;
See "systemctl status httpd.service" and "journalctl -xe" for details.
The execute those commands and see what error it throws, so we can investigate what's causing this.

However, it might already be that the automatic rewrite of alle users httpd.conf files and http already fixed what caused the issue.

Keep your eye on it, and if odd things happen, let us know.
If things keep working well, you can add for example php 8.1 and 8.2 because 7.4 will be EOL fairly soon.
 
Back
Top