Build a PHP server environment on CentOS

Source: Internet
Author: User

You can also use the one-click Auto-Deploy Environment tool, see the user developed this tool

http://www.centos.bz/2013/08/ezhttp-tutorial/
Installation Apache:yum install httpd httpd-devel boot apache:/etc/init.d/httpd Start now enter the IP address of the server, you should see the Apache service page, the port does not lose, Apache default is to use 80 port installation mysql:yum install MySQL mysql-server boot mysql:/etc/init.d/mysqld start installation phpyum install PHP Php-devel restart Apache to make PHP effective/etc/init.d/httpd Restart at this point you can create a php file code in the directory:/var/www/html/: <?php phpinfo(); ?>
Then access this file, you can see some PHP information, php.ini configuration file path can be seen on this page to install PHP extensions yum  install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpcAfter installing the extension you need to restart apache/etc/init.d/httpd Restart test MySQL link successful php code <?php$con = mysql_connect ("[Email protected]@@",  "@@", "@@"), if (! $con) {die (' Could not connect: '. Mysql_error ()); } mysql_select_db ("MyDB", $con); $result = mysql_query ("SELECT * from Sys_user"); while ($row = Mysql_fetch_array ($result)) {echo $row [' UserName ']. " " . $row [' PassWord ']. " " .  $row [' id '];  echo "<br/>"; } mysql_close ($con);? > can pass the above code into the directory/var/www/html/can see the implementation of the situation

Build a PHP server environment on CentOS

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.