Recently, Apache has released version 2.4 and right after I did the upgrade, apache stopped working. It said :
httpd: Syntax error on line 153 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_authn_alias.so into server: /etc/httpd/modules/mod_authn_alias.so: cannot open shared object file: No such file or directory
And it kept bugging me. I tried to install this whatever mod_authn_default, but couldn’t find a clue how to do it. So I tried to comment the corresponsing line in httpd.conf byt ended up more errors in other modules.
I was mistaken. I couldn’t use the new .conf file after upgrading. Then I renamed httpd.conf.pacnew as httpd.conf and did the needed changes as in my previous post.
$ sudo mv /etc/httpd/conf/httpd.conf.pacnew /etc/httpd/conf/httpd.conf
But then, I got this fancy error when starting httpd.
Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
I was like, “Whaaaaaaaatttt??? “. But after going through some posts regarding this on few forums, I figured it out. You can read more about it from here.
So first, I installed php-fpm using pacman.
$ sudo pacman -S php-fpm
And uncommented following lines in httpd.conf. (In my case, they were already uncommented.)
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Then edited php-frm.conf
by :
$ sudo nano /etc/php/php-fpm.conf
and changed the listening option
from :
listen = /run/php-fpm/php-fpm.sock
to:
listen = 127.0.0.1:9000
Both lines were there and I just had to comment one and uncomment the other.
Then I enabled and started the php-fpm service.
$ sudo systemctl enable php-fpm $ sudo systemctl start php-fpm
Then I added the following line into httpd.conf which does the magic trick. If you have separate vhosts, add this to the needed ones.
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1
At last, open httpd.conf and look for
LoadModule mpm_event_module modules/mod_mpm_event.so
and replace it with
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
Now you’re done..!! You can use PHP peacfully in new Apache. But you still may encounter problems in phpMyAdmin.