You are not logged in.

#76 2014-03-16 04:32:47

ihermit
Member
From: Memphis, TN
Registered: 2013-08-30
Posts: 4
Website

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

Thanks for the help everyone!

For those still having the problem of dir files showing up, change:

<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

Offline

#77 2014-03-19 19:50:15

johnnyq
Member
Registered: 2010-02-26
Posts: 13

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

Hi,
I followed wiki, but I have one problem. I have set Listen 127.0.0.1:9000 in httpd.conf so that Apache doesn't listen to outside requests, but because of that it doubles listen option from php-fpm.conf. In result only one of them can be started (ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)).
So I'd like to ask how to configure them both so that php-fpm listens at 127.0.0.1:9000 and Apache doesn't answer to outside requests and doesn't gloom onto all bound IP addresses?

Offline

#78 2014-03-19 20:12:58

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

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

Use port 80 or 8080 for apache httpd, not 9000


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

Offline

#79 2014-03-19 21:29:18

johnnyq
Member
Registered: 2010-02-26
Posts: 13

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

Obviously :-$. I'm playing with it too long today. Thanks progandy.

Offline

#80 2014-03-23 20:55:16

viky
Member
Registered: 2014-03-07
Posts: 8

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

Sorry, but can I bump this thread. My issue wasn't solved and I'm really hopeless now.
I can still downgrade apache back to 2.26, but that's not what I want.
thanks

viky wrote:

Hello everybody,
Today I upgraded to apache-2.4 and it's failing to start:

bře 09 17:38:08 avava systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
bře 09 17:38:09 avava systemd[1]: httpd.service never wrote its PID file. Failing.
bře 09 17:38:09 avava systemd[1]: Failed to start Apache Web Server.
bře 09 17:38:09 avava systemd[1]: Unit httpd.service entered failed state.

I tried:

 chmod /run/httpd to http
 remove /run/httpd
 specify another pidfile location in http.conf

but nothing worked. Any ideas whats wrong?
Thanks in advance.

EDIT: also changing pidfile location doesn't work
It seems that it's apache bug. All the locations are writeable and apache PidFile directive has no effect.

Offline

#81 2014-03-23 21:13:10

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

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

What is the full output of

# systemctl status httpd.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

#82 2014-03-23 21:17:13

viky
Member
Registered: 2014-03-07
Posts: 8

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

[viky@avava conf]$ sudo systemctl status httpd.service -l
httpd.service - Apache Web Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: failed (Result: resources) since Ne 2014-03-23 21:51:37 CET; 3s ago
  Process: 13593 ExecStart=/usr/bin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 18769 (code=exited, status=1/FAILURE)

bře 23 21:51:36 avava systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
bře 23 21:51:37 avava systemd[1]: httpd.service never wrote its PID file. Failing.
bře 23 21:51:37 avava systemd[1]: Failed to start Apache Web Server.
bře 23 21:51:37 avava systemd[1]: Unit httpd.service entered failed state.
[viky@avava conf]$

Offline

#83 2014-03-23 21:52:59

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

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

Okay, that looks fine. Can you also post the contents of /usr/lib/tmpfiles.d/apache.conf and the output of

ls -ld /run/httpd

and

# systemctl status systemd-tmpfiles-setup.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

#84 2014-03-24 07:48:36

viky
Member
Registered: 2014-03-07
Posts: 8

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

sorry for late response I fell asleep

[viky@avava ~]$ cat /usr/lib/tmpfiles.d/apache.conf 
d /run/httpd 0755 root root -
[viky@avava ~]$ ls -ld /run/httpd
drwxr-xr-x 2 root root 80 24. bře 08.40 /run/httpd
[viky@avava ~]$ sudo systemctl status systemd-tmpfiles-setup.service
systemd-tmpfiles-setup.service - Create Volatile Files and Directories
   Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static)
   Active: active (exited) since Pá 2014-03-14 16:30:49 CET; 1 weeks 2 days ago
     Docs: man:tmpfiles.d(5)
           man:systemd-tmpfiles(8)
 Main PID: 192 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/systemd-tmpfiles-setup.service

bře 14 16:30:49 avava systemd[1]: Started Create Volatile Files and Directories.

Offline

#85 2014-03-24 23:06:43

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,222
Website

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

Since I stupidly spent quite some time debugging this myself, it might come in handy for someone else: Don't forget to uncomment the include-line for the extra/httpd-vhosts.conf-file when you're merging your httpd.conf.pacnew-file :-(

HTH.

Offline

#86 2014-03-25 21:30:47

viky
Member
Registered: 2014-03-07
Posts: 8

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

I have nothing wrong with my vhost conf. And even apache 2.4.9 still not create pid file.
Can somebody look at those logs up here, if there's something wrong please?
I can't find anything for days. thanks

Offline

#87 2014-03-25 21:45:17

anatolik
Developer
Registered: 2012-09-27
Posts: 458

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

Show us content of /var/log/httpd/ files.


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#88 2014-03-25 22:05:01

piter85
Member
Registered: 2013-05-09
Posts: 6

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

@viky I had the same problem.

Seeing in /var/log/httpd/error.log after a failed start of apache i noted that it didn't find a module : mod_slotmem_shm.

I added it in /etc/httpd/conf/httpd.com and now apache starts well.

I hope it will help you smile

Bye

Offline

#89 2014-03-26 13:19:28

viky
Member
Registered: 2014-03-07
Posts: 8

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

@piter85
Thanks a lot it was the missing slotmem_shm_module.
Now I'm kinda ashamed that I tried everything except checking log files carefully.
So sorry and thanks again smile

Offline

#90 2014-04-15 09:57:09

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 355

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

Caspian wrote:

Apache is not working for me since the upgrade to 2.4. I'm getting the following error:

Syntax error on line 59 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_authn_default.so into server: /etc/httpd/modules/mod_authn_default.so: cannot open shared object file: No such file or directory

Suggestions?


Apache 2.4 doesn't have an authn_default module -- you must be using an old httpd.conf file?

A list of all modules provided by Apache 2.4 can be found here

Look through the list of mod_authn_* modules to figure out which one you need.  mod_authn_file is probably the most common, and you will also need mod_authn_core

Offline

#91 2014-04-15 10:00:04

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 355

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.


The question is why isn't PHP compiled to be threadsafe, given the default Apache package httpd.conf configuration?  Isn't this a bug that should be filed against the PHP package?

Offline

#92 2014-04-15 11:12:04

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

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

PHP recommends to compile it non-threadsafe: http://www.php.net/manual/en/install.unix.apache2.php

Offline

#93 2014-04-15 13:47:08

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 355

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

lonaowna wrote:

PHP recommends to compile it non-threadsafe: http://www.php.net/manual/en/install.unix.apache2.php

I figured it was something like this.  Thanks -- this is good to know.

Given the preponderance of people who use PHP, it sounds like the Apache default should set to prefork rather than event.

Offline

#94 2014-04-15 15:11:38

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

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

pgoetz wrote:

Given the preponderance of people who use PHP, it sounds like the Apache default should set to prefork rather than event.

Yeah, that's what I thought too. But event is the Apache default, so the devs want to stick with that (FS#39218):

JGC wrote:

The upstream default for apache is using mpm_event. We won't switch the default MPM to prefork for just PHP.

Offline

#95 2014-04-15 16:13:41

anatolik
Developer
Registered: 2012-09-27
Posts: 458

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

lonaowna wrote:

But event is the Apache default, so the devs want to stick with that (FS#39218)

Yep, event MPM is the one recommended by Apache as faster MPM with less memory consumption. PHP folks prefer to stick to old prefork because of the thread-safety problems in third-party libs.

My guess is that over time, when apache24 and event MPM will be used more often, PHP environment will become more thread-safe and switch to event MPM by default.

Last edited by anatolik (2014-04-15 16:14:41)


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#96 2014-04-15 17:27:57

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 355

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

My only follow up comment to this is that

  • Given the popularity of PHP used with Apache

  • that the Arch PHP package is compiled without threading support

  • and that the default httpd.conf in the Arch Apache package uses threading

this should be documented directly in the /etc/httpd/conf/httpd.conf file like this:

...
LoadModule mpm_event_module modules/mod_mpm_event.so
# If you plan to use mod_php, you need to comment the preceding line and uncomment the following.  (See the LAMP#PHP Wiki page for details.)
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
...

Last edited by pgoetz (2014-04-15 17:29:50)

Offline

#97 2014-06-05 14:34:58

sir3x
Member
Registered: 2014-06-05
Posts: 1

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

I found after changing the mod prefork and doing the other suggested mods that the only other thing I really needed to do was add the following code to the httpd.conf and my php worked magically !

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Last edited by sir3x (2014-06-05 14:35:16)

Offline

#98 2014-06-05 19:34:49

garyamort
Member
Registered: 2014-06-05
Posts: 6

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

Potomac wrote:

Today I updated apache and php :

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


There are a number of solutions - the main issue is the you can't use multithreaded mpm and the single threaded php apache module.

You can switch to prefork and move on.

You can configure php-fpm instead, which isn't all that difficult but does have the issue that fastcgi has subtly different global variables[$_ENV, $_GET, etc].

Lastly you can make a copy of the php source files, edit PKGBUILD and add  '--enable-maintainer-zts \' to the end of the _phpconfig options, then run makepkg and install the thread safe version.

In the end, I've had a large number of problems with the extremely Arch PHP compile options[compiling almost every extension as a shared library causes some really weird errors with sockets and filters] - so I went with the last solution.   Once I'm done mucking about I'll push my changes up to github if anyone else wants to use a slightly better tuned php package.

Offline

Board footer

Powered by FluxBB