Install and deploy the PHP environment in CentOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.