You are not logged in.

#1 2014-03-06 23:39:29

Potomac
Member
Registered: 2011-12-25
Posts: 528

[solved] apache 2.4 doesn't work with php package

Today I updated apache and php :


[2014-03-06 23:46] [PACMAN] upgraded apache (2.2.26-1 -> 2.4.7-1)
[2014-03-06 23:46] [PACMAN] upgraded php (5.5.9-1 -> 5.5.10-1)
[2014-03-06 23:46] [PACMAN] upgraded php-apache (5.5.9-1 -> 5.5.10-1)
[2014-03-06 23:46] [PACMAN] upgraded php-mcrypt (5.5.9-1 -> 5.5.10-1)

but I notice that apache 2.4 fails to start ( I use the new apache 2.4 configuration file ) :

journalctl -xn :

 Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
 AH00013: Pre-configuration failed
httpd.service: control process exited, code=exited status=1

I don't understand, I followed the wiki for the lamp installation, do you know a solution ?

Last edited by Potomac (2014-03-07 16:34:47)

Offline

#2 2014-03-07 00:01:53

progandy
Member
Registered: 2012-05-17
Posts: 5,259

Re: [solved] apache 2.4 doesn't work with php package

I'd use mod_proxy_fcgi and php-fpm to pass files from apache to php.
http://wiki.apache.org/httpd/PHP-FPM
http://garajau.com.br/blog/2013/12/apac … roxy_fcgi/


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2014-03-07 00:08:02

Potomac
Member
Registered: 2011-12-25
Posts: 528

Re: [solved] apache 2.4 doesn't work with php package

I have seen these pages but it's not easy to understand,

in fact I don't understand what to do, I installed php-fpm package but after I don't know what things I must change in /etc/httpd/conf/httpd.conf,

it would be great if someone can update the wiki page about LAMP and php :

https://wiki.archlinux.org/index.php/LAMP

Offline

#4 2014-03-07 00:44:49

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,402
Website

Re: [solved] apache 2.4 doesn't work with php package

What part are you stuck on? I've just upgraded to httpd 2.4 and it was fairly straight forward to get php working with php-fpm and mod_proxy_fcgi.

One thing you might have missed is that php-fpm listens on a unix socket by default, you need to change that to a network socket in the config file before starting the php-fpm service.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2014-03-07 00:55:32

Potomac
Member
Registered: 2011-12-25
Posts: 528

Re: [solved] apache 2.4 doesn't work with php package

I need to know what things I must add in /etc/httpd/conf/httpd.conf after installing php-fpm,

I don't understand this part :

Edit the configuration for a vhost of your choice, and add the following line to it:

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1 

what is a vhost ?

with apache 2.2 I didn't need a vhost,

Do I need to add "LoadModule php5_module modules/libphp5.so" and "Include conf/extra/php5_module.conf" in /etc/httpd/conf/httpd.conf ?

Offline

#6 2014-03-07 01:12:32

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,402
Website

Re: [solved] apache 2.4 doesn't work with php package

If you're not using vhosts (virtual hosts [1]) then putting the declaration at the bottom of the httpd.conf should work.


[1] https://httpd.apache.org/docs/2.2/vhosts/examples.html


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2014-03-07 01:34:52

Potomac
Member
Registered: 2011-12-25
Posts: 528

Re: [solved] apache 2.4 doesn't work with php package

Ok I put :

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1

but I get a 503 error,

after a search in google I found that I need to edit the configuration of php-fpm, by setting the listen option :

listen = 127.0.0.1:9000

instead of :

listen = /run/php-fpm/php-fpm.sock

It works for the php files located in "/srv/http", but it doesn't work for my php files who are located in my home directory  (userdir directory option in apache ), I get the error "file not found" if I click on php file,

that's why a more clear LAMP wiki page would be great for newbies who want to use apache 2.4 and php-fpm,

I notice also that phpmyadmin package doesn't work with apache 2.4 :

AH00526: Syntax error on line 7 of /etc/httpd/conf/extra/httpd-phpmyadmin.conf:
apachectl[4743]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

Last edited by Potomac (2014-03-07 01:44:00)

Offline

#8 2014-03-07 09:47:32

lonaowna
Member
Registered: 2013-03-25
Posts: 28

Re: [solved] apache 2.4 doesn't work with php package

I am also having quite some trouble with the Apache update... It is very unclear to me why the old way using the php-apache package no longer works. And if it no longer works, what should it be replaced by?

I have also filed a bug report about phpmyadmin: FS#39213.

Last edited by lonaowna (2014-03-07 09:50:16)

Offline

#9 2014-03-07 09:49:50

freaks
Member
Registered: 2010-11-10
Posts: 63

Re: [solved] apache 2.4 doesn't work with php package

up i have the same problem ? so i retrograted all the packages to stay in previous version of apache tongue

Offline

#10 2014-03-07 10:43:09

sembei
Member
Registered: 2014-03-07
Posts: 2

Re: [solved] apache 2.4 doesn't work with php package

I made php work with vhosts including these lines in each vhost (inside Directory):

                RewriteEngine On
                RewriteCond /path/to/your/documentroot%{REQUEST_URI} !-s
                RewriteCond /path/to/your/documentroot%{REQUEST_URI} !-l
                RewriteRule ^.*$ fcgi://localhost:9000/path/to/your/documentroot/index.php [P,NC,L]

and not the ProxyPassMatch line.

But now php can't use postgresql or mysql. ¿php-fpm is not using standard php.ini file to load extensions?

Sorry, totally messed up config files. Still trying to make php work (vhosts, phpmyadmin, phppgadmin...)

Last edited by sembei (2014-03-07 12:03:19)

Offline

#11 2014-03-07 11:14:25

jesusignazio
Member
Registered: 2014-03-07
Posts: 14

Re: [solved] apache 2.4 doesn't work with php package

Now it works for me.
But I have to type http://localhost/html.php instead of http://localhost

Potomac you can try with adding another ProxyPassMatch line for the another dir.

Offline

#12 2014-03-07 11:37:04

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

Re: [solved] apache 2.4 doesn't work with php package

Good morning everybody

I've got the same problem, i haven't enabled cgi (because i use may server only for tt-rss).
I have install and configure php-fpm and mod_fcgid.
But I can't start httpd daemon.

Do I need to enable cgi as it was explain in the arch wiki for lamp : Using php5 with apache2-mpm-worker and mod_fcgid ?

Offline

#13 2014-03-07 11:46:40

jb234
Member
From: Norway
Registered: 2009-06-22
Posts: 25
Website

Re: [solved] apache 2.4 doesn't work with php package

I am also having this issue.

But maybe it is simply php-apache that needs to be compiled with thread support?

"Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP."

"php5 with apache2-mpm-worker and mod_fcgid" is kind of a totally different configuration. The upgrade seems to break a legit configuration.

Offline

#14 2014-03-07 12:01:04

gadelat
Member
Registered: 2013-03-11
Posts: 49

Re: [solved] apache 2.4 doesn't work with php package

I have same problem. Apache stopped working after upgrade and I don't know how to reconfigure it to make it work again.

Offline

#15 2014-03-07 12:08:50

jesusignazio
Member
Registered: 2014-03-07
Posts: 14

Re: [solved] apache 2.4 doesn't work with php package

gadelat wrote:

I have same problem. Apache stopped working after upgrade and I don't know how to reconfigure it to make it work again.

First of all, you have to replace the httpd.conf with the newer httpd.pacnew in /etc/httpd/conf/

After that, you have to install php-fpm and add the line in /etc/php/php-fpm.conf:

listen = 127.0.0.1:9000

instead of:

listen = /run/php-fpm/php-fpm.sock

Finally add the following line in /etc/httpd/conf/httpd.conf:

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

Start/Restart php-fpm and httpd daemons

Now it works for me, except phpmyadmin

Last edited by jesusignazio (2014-03-07 12:10:26)

Offline

#16 2014-03-07 12:10:03

guru42
Member
Registered: 2010-10-06
Posts: 4

Re: [solved] apache 2.4 doesn't work with php package

Me to!
After installing and configuring the php-fpm package my info.php in the document root /srv/http is working again, but roundcube and phpmyadmin still failed.

Offline

#17 2014-03-07 12:11:00

allencch
Member
Registered: 2011-03-25
Posts: 118

Re: [solved] apache 2.4 doesn't work with php package

Potomac wrote:

Ok I put :

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1

but I get a 503 error,

after a search in google I found that I need to edit the configuration of php-fpm, by setting the listen option :

listen = 127.0.0.1:9000

instead of :

listen = /run/php-fpm/php-fpm.sock

It works for the php files located in "/srv/http", but it doesn't work for my php files who are located in my home directory  (userdir directory option in apache ), I get the error "file not found" if I click on php file,

that's why a more clear LAMP wiki page would be great for newbies who want to use apache 2.4 and php-fpm,

I notice also that phpmyadmin package doesn't work with apache 2.4 :

AH00526: Syntax error on line 7 of /etc/httpd/conf/extra/httpd-phpmyadmin.conf:
apachectl[4743]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

@Protomac, thank you. Your solution very good. I have the same problem, including httpd-phpmyadmin.conf. But the phpmyadmin is not yet solved and also the userdir.

Last edited by allencch (2014-03-07 12:33:39)

Offline

#18 2014-03-07 12:34:22

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

Re: [solved] apache 2.4 doesn't work with php package

If i don't add this line to http.conf
- LoadModule php5_module modules/libphp5.so
- Include conf/extra/php5_module.conf
and if remove in httpd-vhost.conf
- php_admin_value open_basedir none
it seems to work better

But all the directory appears instead of the php page.

Last edited by Bob le pirate (2014-03-07 12:42:53)

Offline

#19 2014-03-07 13:08:55

sembei
Member
Registered: 2014-03-07
Posts: 2

Re: [solved] apache 2.4 doesn't work with php package

Working with phppgadmin and phpmyadmin. Had to create a virtual host for each.

Still no working with aliases.

Offline

#20 2014-03-07 13:09:50

smirky
Member
From: Bulgaria
Registered: 2013-02-23
Posts: 277
Website

Re: [solved] apache 2.4 doesn't work with php package

jesusignazio wrote:

...

Thank you for the shared hints. Really helped me smile It was dragging me the whole morning!


Personal spot  ::  https://www.smirky.net/  ::  Try not to get lost!

Offline

#21 2014-03-07 13:12:26

teh_jazzman
Member
Registered: 2014-03-07
Posts: 1

Re: [solved] apache 2.4 doesn't work with php package

The new configuration by default uses an event based Multi Processing Module. As long as PHP isn't compiled threadsave, you can switch to the prefork MPM, which doesn't use threads.

In your httpd.conf find the line that loads the event MPM:

LoadModule mpm_event_module modules/mod_mpm_event.so

Replace it with one that loads the prefork MPM:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Of course you still need to load the PHP5 module (libphp5.so) and the corresponding config file somewhere.

Offline

#22 2014-03-07 13:53:12

archtom
Member
Registered: 2011-05-04
Posts: 58

Re: [solved] apache 2.4 doesn't work with php package

teh_jazzman wrote:

The new configuration by default uses an event based Multi Processing Module. As long as PHP isn't compiled threadsave, you can switch to the prefork MPM, which doesn't use threads.

In your httpd.conf find the line that loads the event MPM:

LoadModule mpm_event_module modules/mod_mpm_event.so

Replace it with one that loads the prefork MPM:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Of course you still need to load the PHP5 module (libphp5.so) and the corresponding config file somewhere.

Perfect, thank you, that solved it for me! wink

Offline

#23 2014-03-07 13:58:01

siriru
Member
Registered: 2013-04-20
Posts: 3

Re: [solved] apache 2.4 doesn't work with php package

archtom wrote:
teh_jazzman wrote:

The new configuration by default uses an event based Multi Processing Module. As long as PHP isn't compiled threadsave, you can switch to the prefork MPM, which doesn't use threads.

In your httpd.conf find the line that loads the event MPM:

LoadModule mpm_event_module modules/mod_mpm_event.so

Replace it with one that loads the prefork MPM:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Of course you still need to load the PHP5 module (libphp5.so) and the corresponding config file somewhere.

Perfect, thank you, that solved it for me! wink

For me too ! Thank you !

Offline

#24 2014-03-07 14:08:18

robin67
Member
From: the Netherlands
Registered: 2012-02-18
Posts: 45

Re: [solved] apache 2.4 doesn't work with php package

allencch wrote:
Potomac wrote:

Ok I put :

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1

but I get a 503 error,

after a search in google I found that I need to edit the configuration of php-fpm, by setting the listen option :

listen = 127.0.0.1:9000

instead of :

listen = /run/php-fpm/php-fpm.sock

It works for the php files located in "/srv/http", but it doesn't work for my php files who are located in my home directory  (userdir directory option in apache ), I get the error "file not found" if I click on php file,

that's why a more clear LAMP wiki page would be great for newbies who want to use apache 2.4 and php-fpm,

I notice also that phpmyadmin package doesn't work with apache 2.4 :

AH00526: Syntax error on line 7 of /etc/httpd/conf/extra/httpd-phpmyadmin.conf:
apachectl[4743]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

@Protomac, thank you. Your solution very good. I have the same problem, including httpd-phpmyadmin.conf. But the phpmyadmin is not yet solved and also the userdir.


You should make sure /usr/share/webapps/ and /etc/webapps are included in the line of open_basedir in /etc/php/php.ini
Also remove the line with "php_admin_value open_basedir" from /etc/httpd/conf/extra/httpd-phpmyadmin.conf

Then just add in your apache conf files the following 2 lines for phpmyadmin redirection to php-fpm :
    ProxyPassMatch ^/phpmyadmin/(.*\.php)$ fcgi://127.0.0.1:9000/usr/share/webapps/phpMyAdmin/$1
    ProxyPassMatch ^/phpmyadmin(.*/)$ fcgi://127.0.0.1:9000/usr/share/webapps/phpMyAdmin$1index.php

My /etc/httpd/conf/extra/httpd-phpmyadmin.conf now looks like

        Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"

        <Directory "/usr/share/webapps/phpMyAdmin">
                AllowOverride All
                Options FollowSymlinks
                Require all granted
        </Directory>

With this I can use phpmyadmin as always by going to http://myserver/phpmyadmin

Last edited by robin67 (2014-03-07 15:17:42)

Offline

#25 2014-03-07 14:30:53

allencch
Member
Registered: 2011-03-25
Posts: 118

Re: [solved] apache 2.4 doesn't work with php package

teh_jazzman wrote:

The new configuration by default uses an event based Multi Processing Module. As long as PHP isn't compiled threadsave, you can switch to the prefork MPM, which doesn't use threads.

In your httpd.conf find the line that loads the event MPM:

LoadModule mpm_event_module modules/mod_mpm_event.so

Replace it with one that loads the prefork MPM:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Of course you still need to load the PHP5 module (libphp5.so) and the corresponding config file somewhere.

But I get the Access forbidden! in phpMyAdmin, and so does userdir.

Offline

Board footer

Powered by FluxBB