[Solved] Php + Apache on centos8 / centos7

Issues related to applications and software problems and general support
Post Reply
B_R_H
Posts: 4
Joined: 2020/09/06 12:06:58

[Solved] Php + Apache on centos8 / centos7

Post by B_R_H » 2020/11/20 08:07:44

Hi,

This is maybe not centos related?

I try to install centos8 + apache + php in Dockerfile as following
FROM centos:8
RUN yum upgrade -y
RUN yum install -y httpd php php-bcmath php-cli php-common php-gd php-intl php-ldap php-mbstring \
php-mysqlnd php-pear php-soap php-xml php-xmlrpc php-zip php-pgsql
ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"]
php is then version 7.2.24. That's ok, but I cannot run any php-script and error_log says
[Tue Nov 17 19:25:33.632102 2020] [core:notice] [pid 1:tid 140503399643456] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Nov 17 19:25:37.283663 2020] [proxy:error] [pid 9:tid 140502347220736] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Tue Nov 17 19:25:37.283769 2020] [proxy_fcgi:error] [pid 9:tid 140502347220736] [client 178.55.225.177:53078] AH01079: failed to make connection to backend: httpd-UDS
when running same Dockerfile with centos7 image FROM centos:7, php is little old 5.4.16, but php-script runs without problems.

Any ideas, what is missing from centos8?
Last edited by B_R_H on 2020/11/20 17:49:06, edited 1 time in total.

User avatar
remirepo
Posts: 409
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Php + Apache on centos8 / centos7

Post by remirepo » 2020/11/20 08:53:45

Use the ubi8-php* images ;)

On C8 PHP scripts are executed by FPM by default (so 2 services running)

So you need

1 container for php-fpm
1 container for httpd

An alternative way (used by official ubi8 images) is to switch back to prefork MPM and mod_php, but is not IMHO the right thing to do.
Remi's Repository - Forum - Blog

B_R_H
Posts: 4
Joined: 2020/09/06 12:06:58

Re: Php + Apache on centos8 / centos7

Post by B_R_H » 2020/11/20 09:16:40

Thank's
That's explains.
I started php-fpm inside container and then php seems to work.

No idea how php-fpm can find apache, when they are in different container, but it's another case :-)

User avatar
TrevorH
Forum Moderator
Posts: 29972
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Php + Apache on centos8 / centos7

Post by TrevorH » 2020/11/20 15:35:08

I'd also point out that CentOS 8.2 has both php:7.2 and php:7.3 modules and 7.2 is default. CentOS 8.3 also has a php:7.4 module.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 8 - General Support”