Configure MySQL and PHP in Ubuntu 12.04 to solve the problem of mysql_connect undefined.

Source: Internet
Author: User
    1. Install MYSQL client or MySQL server,Sudo apt-Get install mysql-ClientOrSudo apt-Get install mysql-Server.
    2. Install the php5-mysql in/etc/PhP5/CONF. d/The Directory displays MySQL. INI file; at this time, calling mysql_connect directly in PHP will cause the undefined problem. This is because the MySQL module of PHP has been installed, but it is not enabled yet in PHP, you must manually enable the MySQL module.
    3. Copy the mysql. ini file to the/etc/PhP5/CLI/CONF. D and/etc/PhP5/apache2/CONF. d directories respectively (This step is very important!).
    4. Restart Apache,Sudo apachectl restart.
    5. UseCodeTest. If the connection is successful, PHP and MySQL have been configured successfully.
 
   

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.