Download PHP:
Website address: http://cn2.php.net/
Download page: Http://cn2.php.net/get/php-7.1.6.tar.gz/from/a/mirror
Click to download
TAR-ZXF Decompression
Help can be viewed through the./configure--help.
Configuration: note with-apxs2 httpd path and With-pdo-mysql path.
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/httpd/bin/apxs--with-config-file-path=/usr/local/lib --with-pdo-mysql=/usr/local/mysql--with-zlib-dir=/usr/lib
You may encounter an error: Configure error Xml2-config not found. Please check your LIBXML2 installation
Workaround:
Check if the LIBXM package is installed [[email protected] software]# Rpm-qa |grep libxml2libxml2-2.6.26-2.1.12libxml2-python-2.6.26-2.1.12 Reinstall the LIBXML2 and libxml2-devel packages, Yum installs the new version will be prompted to update, Updates can be updated, do not skip the line. [[email protected]/]# yum install libxml2[[email protected]/]# yum install libxml2-devel-y find out if xml2-config file exists [[E Mail protected]/] # Find/-name "Xml2-config"/usr/bin/xml2-config and then re-executes./configure--prefix=/usr/local/php--WITH-APX S2=/usr/local/httpd/bin/apxs--with-config-file-path=/usr/local/lib--with-pdo-mysql=/usr/local/mysql-- With-zlib-dir=/usr/lib
Configuration succeeded:
Make a soft connection to the header file of MySQL before making it. Because MySQL installs the time to specify the directory, does not make the soft connection, still cannot find the header file.
Ln-s/usr/local/mysql/include/*/usr/local/include/
Perform make compilation
Perform a make install installation
Php.ini-production copy in the installation package to/usr/local/php/lib/
CP Php.ini-production/usr/local/lib/php.ini
Find LoadModule Php7_module in the httpd.conf configuration file modules/libphp7.so
If there is no search (which is generally searchable), add this instruction to the httpd.conf configuration file so that Apache can load the libphp7.so module and parse the PHP file.
Add a second instruction in the httpd.conf configuration file: <filesmatch "\.ph (p[2-6]?| tml) $ "> SetHandler application/x-httpd-php</filesmatch>
This instruction tells Apache to encounter file names with. php,. PhP2,. PhP3,. PhP4,. php5,. PHP6, or phtml end files using the Libphp7.so module for parsing. where "\.ph (p[2-6]?| TML) $ "is a regular expression that you can change as long as you conform to the PCRE regular expression syntax.
Next, in Vim search "DirectoryIndex" string, you can see already have index.html, add index.php index.phtml after index.html
Go to/usr/local/apache2/htdocs directory: Cd/usr/local/apache2/htdocs Create a test file: Touch t.php with vim to open it add: <?php phpinfo ();? > can then be accessed via the browser:
If the PHP page cannot be parsed and the httpd service needs to be restarted, it is best to kill each process before restarting.
If you encounter such an error:
Error 324 (net::err_empty_response): The server is disconnected and no data is sent.
Find PHP.ini, plus configure
error_reporting = E_all & ~e_notice
, ignore E_notice error, restart Apache to solve the problem.
If the browser is still not open, you need to turn off the firewall.
/etc/init.d/iptables stop
Execute commands php prompt command not found solution
Yum Install Php-devel
Linux installation PHP