under linux php7 installation and configuration Apache

1 php

1.1 Preparations

Need to install Apache, you can skip installed, no installation can be seen here .

1.2 Download

Official website

1.3 unzip

tar -zxvf php-7.4.3.tar.gz
cd php-7.4.3

1.4 compile and install

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs

prefix for the installation location, behind the option to install apxs directory under the bin is apache. Well after:

make 
sudo make install

1.5 configuration files

Need to copy the php.ini file:

sudo cp php.ini-development /usr/local/lib/php.ini

2 Apache

In the conf / httpd.conf and finally add:

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

If php5 please amended as follows:

LoadModule php5_module modules/libphp5.so

Finally, restart apache service:

/usr/local/apache/bin/apachectl restart

3 Test

Under the new apache htdocs directory under a test.php:

<?php
    phpinfo()

Enter the browser ServerName apache configuration file with the file name, the author is localhost: 80.

localhost:80/test.php

Here Insert Picture Description
The above information that is success.

Guess you like

Origin blog.51cto.com/14415843/2476374