Deployment CentOS Installation PHP Environment

Source: Internet
Author: User

Environment

Virtual machine: VMWare10.0.1 build-1379776

Operating system: CentOS7 64-bit

HTTP Server:apache (httpd)

Steps

PHP environment requires HTTP server support, this article uses the HTTP server for Apache, you can also choose the more popular nginx.

Apache default root directory View location/etc/httpd/conf/httpd.conf File View documentroot configuration values

1. Install PHP

Yum Install PHP php-devel

2, install php Common extension (optional, according to their 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 effective

Apachectl restart

4. Test the PHP environment

Create a new info.php in the/var/www/html directory (Apache default root directory)

VI /var/www/html/info. php

File contents

Phpinfo ();?>

Visit http://localhost/info.php

Additional: MySQL Test

Create a new mysql.php in the/var/www/html directory (Apache default root directory)

VI /var/www/htmml/mysql.php

File contents

<?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);?>

Visit http://localhost/mysql.php

Deployment CentOS Installation PHP Environment

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.