Install and deploy the PHP environment in CentOS
Environment
Virtual Machine: VMWare10.0.1 build-1379776
Operating System: 64-bit CentOS7
HTTP Server: Apache (httpd)
Procedure
The PHP environment requires support from the HTTP server. The HTTP server used in this article is Apache. You can also choose the popular Nginx.
View the DocumentRoot configuration value in the/etc/httpd/conf/httpd. conf file of the default Apache root directory.
1. install php
Yum install php-devel
2. Install common php extensions (optional, based on your actual needs)
Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
3. Restart apache to make php take effect.
Apachectl restart
4. Test the php Environment
Create info. php in the/var/www/html directory (Apache default root directory)
Vi/var/www/html/info. php
File Content
<? Php phpinfo ();?>
Access http: // localhost/info. php
Additional: mysql Test
Create mysql. php in the/var/www/html directory (default apache root directory)
Vi/var/www/htmml/mysql. php
File Content
<? Php
$ Con = mysql_connect ("localhost", "root", "root ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_db ("mysql", $ con );
$ Result = mysql_query ("SELECT * FROM user ");
While ($ row = mysql_fetch_array ($ result ))
{
Echo $ row ['user']. "". $ row ['host'];
Echo "<br/> ";
}
Mysql_close ($ con );
?>
Access http: // localhost/mysql. php
PHP 7, you deserve it
Experience PHP 7.0 on CentOS 7.x/Fedora 21
Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)
Nginx startup failure occurs during LNMP deployment.
Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)
Detailed php hd scanning PDF + CD source code + full set of teaching videos
Configure the php lnmp development environment in CentOS 6
PHP details: click here
PHP: click here