PHP connection MySQL exception under Linux

Source: Internet
Author: User
PHP connection MySQL error on Linux
My PHP version is the 5.2.13,ysql version is 5.0, when executing the following statement
$con = mysql_connect ($host _port, $user, $passwd);
Reported an error:
PHP Fatal error:call to undefined function mysql_connect ()

I looked at the information in the next phpinfo () with the following two options: '--with-mysql=shared,/usr '--with-mysqli=shared,/usr/bin/mysql_config '
In addition, in my/etc/php.ini view Extension_dir = "/usr/lib64/php/modules", in the/usr/lib64/php/modules this directory, but found no mysql.so files.
I tried it under:
Put
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/dbd/mysql/mysql.so
Under the mysql.so copy to/usr/lib64/php/modules, then execute once
$con = mysql_connect ($host _port, $user, $passwd);
Still reported: Call to undefined function mysql_connect ()

Excuse me, do I have to pack some bags? Like Php-mysql and papache2-mod_php, these two bags.
------Solution--------------------
Has MySQL started yet? Service MySQL start or service mysqld start
Or look at it and error log

------Solution--------------------
You look at the permissions of the user who executed PHP on mysql.so.
  • 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.