简体   繁体   中英

httpd.conf: Cannot load modules/libphp7.so into server: /usr/local/httpd/modules/libphp7.so: cannot open shared object file: No such file or directory

I use php7.1 in my linux:

I can check it:

# php -v
PHP 7.1.16 (cli) (built: Jun 25 2018 08:12:28) ( ZTS )

so in my http.conf , I add the module:

LoadModule php7_module modules/libphp7.so

Then I restart the apache by ./apachectl restart , there I get the bellow error:

httpd: Syntax error on line 154 of /usr/local/httpd/conf/httpd.conf: Cannot load modules/libphp7.so into server: /usr/local/httpd/modules/libphp7.so: cannot open shared object file: No such file or directory

I putting this here, so it might help someone. by using this you can install any version of php7.x

This is process to install apache and php7.1 on Centos7

yum install -y yum-utils

Apache instalaltion

yum -y install httpd

PHP 7 rpm (which also include php7.1, php7.2 php7.3 php7.4)

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 

use remi-php71 for php7.1 or remi-php72 or remi-php73 or remi-php74 for other php7.x version

yum-config-manager --enable remi-php71

It will install php version from above enabled repo

yum -y install php

This will automatically put libphp7.so file in module folder and solve above problem in question

You need to install Apache's SAPI for PHP. Install the following packet: php-apache Then restart your httpd server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM