skip to Main Content

I have a server that run Centos 6. Recently I upgrade the php to 7.2 using remi repo and apache 2.4 using the sclo(httpd24).

[user@server1 ~]$ httpd -v
Server version: Apache/2.4.34 (Red Hat)
Server built:   May 28 2020 08:47:33

[user@server1 ~]$ php -v
PHP 7.2.33 (cli) (built: Aug  4 2020 10:02:54) ( NTS )

My issue is if i put an phpinfo() in /var/www/html, my browser didn’t show anything, and if i open the source i only see the php code.

How do i connect the apache and php together?
Thanks..

2

Answers


  1. Have you made sure that inside the apache server configuration httpd.conf file you are correctly pointing to the php.so file??

    You need to make sure the LoadModule php7_module /path/to/the/[email protected]/version/libphp7.so line is in your configuration. If you recently changed the PHP to 7.2 you need to modify the line so it points to the correct php version.

    In my case I use the php 7.2, 7.3 and 7.4 versions for different purposes and inside my httpd.conf file i have the following lines:

    #LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
    #LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
    LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
    

    As you can see each version point to a different so file, you need to find the correct one for the 7.2 version and point to it by commenting or uncommenting them depending on the php version.

    Login or Signup to reply.
  2. I upgrade the php to 7.2 using remi

    Package in my repository are build against base httpd version 2.2.

    You still can use httpd 2.4 (from SCL), but in this case you need to use FPM

    Read: PHP Configuration Tips

    BTW, as CentOS 6 is close to its end of life (in a few months), I heartily recommend you use a more recent version of CentOS (7 or 8 both have httpd 2.4 by default)

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