skip to Main Content

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

2

Answers


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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search