Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need libphp7.so module to configure apache on Centos

I follow the tutorial of this link to use php7 or phpng on my Centos 6.5 with apache.

I can execute php scripts in the console but I would like to be able to run php scripts using the Apache Server.

I need some help because I can't find the libphp7.so module. I don't know if I have to build it or what.

like image 382
jmcordoba Avatar asked May 08 '15 14:05

jmcordoba


2 Answers

I believe you need to add --with-apxs2 to your configure script. According to the link you provided I do not see that in the configure flags. --with-apxs2 will "Build shared Apache 2.0 Handler module". You may also need to make sure in your apache configuration you have:

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

The first time I built php7 it just displayed the source rather than execute it, but adding that caused it to execute the code.

If you want to try it out with Docker I just created a Docker image for PHP7 at https://registry.hub.docker.com/u/silintl/php7/ You can also just view the Dockerfile which includes all the commands used to install and configure it.

like image 60
Phillip Avatar answered Oct 29 '22 06:10

Phillip


In my config file /etc/httpd/conf.modules.d/15-php.conf which is loaded by the parent config file /etc/httpd/conf/httpd.conf I found the following default configuration:

<IfModule !mod_php5.c>
  <IfModule prefork.c>
  LoadModule php7_module modules/libphp7.so
  </IfModule>
</IfModule>

<IfModule !mod_php5.c>
  <IfModule !prefork.c>
    LoadModule php7_module modules/libphp7-zts.so
  </IfModule>
</IfModule>

Using information provided by @JanePage and @PhilipShipley, i change it to this:

LoadModule php7_module modules/libphp7.so
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

and Apache started working fine.

like image 35
Isaiahiroko Avatar answered Oct 29 '22 04:10

Isaiahiroko