[Wind Horse clan _php] PHP connects to MySQL

Source: Internet
Author: User

  1. Let PHP emit hi as a base
    1. Http://www.cnblogs.com/sows/p/5990157.html
  2. Configure Apache: /apache/conf/httpd.conf
    1.   
  3. Create a PHP configuration file. /apache/php/
    1. Copying files
  4. Configure PHP.ini. /apache/php/php.ini
    1. Load MySQL
    2. Load path
  5. Start the MySQL service
    1. If mysql> can be displayed at the command line, the operation succeeds
  6. In Apache's default Web site directory, create mysql.php. /apache/htdocs/
    1. Create mysql.php
    2. Writing mysql.php
      1<?PHP2     //1. Connect to the database3     $link=mysql_connect(' localhost ', ' root ', ' root ');4 5     //2. Determine if the database is connected successfully6     if($link){7         //If the connection succeeds, $link is a resource and the resource is automatically converted to a Boolean type (TRUE)8         Echo"Connection succeeded";9     } Ten     Else{ One         Echo"Connection Failed";  A     }         -?>

       
  7. Open Browser, enter http://localhost/mysql.php
    1. See if you succeed

[Wind Horse clan _php] PHP connects to MySQL

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.