Programming

Apache 2.4 upgrade on Arch Linux

Update: Here is the follow-up, using Apache 2.4.9

This article has been written from memory afterwards, so it may be imprecise and/or incomplete but contains the main steps to a successful migration. I plan to complete it when I'll upgrade another machine. You should be able to find the missing instructions by following this thread on the Arch Linux forum.

After the upgrade from 2.2.x to 2.4.x, Apache throws an error because the current PHP package is not thread-safe. An option is to recompile it (not tested), another is to use the PHP FastCGI Process Manager:

$ yaourt -S php-fpm

and the already included Apache module mod_proxy_fcgi. Uncomment the following lines in /etc/httpd/conf/httpd.conf:

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

then comment this one:

#LoadModule mpm_event_module modules/mod_mpm_event.so

and add the mod_proxy_handler module:

LoadModule proxy_handler_module modules/mod_proxy_handler.so

We need to write proxy rules to avoid bad request or file not found errors. The path must be adapted to your configuration:

ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/www/$1
ProxyPassMatch ^/$ fcgi://127.0.0.1:9000/srv/http/www/index.php$1

In /etc/php/php-fpm.conf, change the listen directive:

listen = 127.0.0.1:9000
;listen = /run/php-fpm/php-fpm.sock

Activate the php-fpm service:

$ sudo systemctl enable php-fpm.service

Replace "enable" with "start" if you do not want/need it to start automatically at each boot; but you will have to start it manually whenever you need it to avoid Apache throwing a 503 "service unavailable" error.

Source

Back


Comments

No comment yet.

A remark, a suggestion? Do not hesitate to express yourself below. Just be courteous and polite, please.

If this field is left blank, you will appear as Anonymous.