I need libphp7.so module to configure apache on Centos

强颜欢笑 提交于 2019-12-12 09:42:42

问题


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.


回答1:


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.




回答2:


Thanks Phillip who gaves some clues for this issue, but in my case I've solved my problem this way :

1 - Copy the Library php7.so that you have into apache module directory with this command : sudo cp /etc/httpd/modules/libphp7.so /opt/bitnami/apache2/modules

2 - Add in your Apache config file following code :

LoadModule php7_module ./modules/libphp7.so SetHandler application/x-httpd-php

And PHP worked fine after that !



来源:https://stackoverflow.com/questions/30126134/i-need-libphp7-so-module-to-configure-apache-on-centos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!