Novice to ask questions about database connectivity

Source: Internet
Author: User
Tags php mysql phpinfo
$a =mysql_connect ("127.0.0.1", "root", "123456");
mysql_select_db ("MyWeb", $a);
mysql_query ("Set character set ' UTF8 '");
$sql = "SELECT * from ' Test ' limit 1";
$query =mysql_query ($sql, $a);
$data =mysql_fetch_array ($query);
Var_dump ($data);
echo 111;
?>
Directly with the browser open no problem, why with cmd PHP Open will error?


Reply to discussion (solution)

The CLI and the Web use different php.ini
PHP.ini of CLI mode? PHP MySQL show.

Find the php.ini used under the CLI, then extension=php_mysql.dll the front, remove it, and take it.

To find out what to use under the CLI? php.ini
OK
Phpinfo ();
?>
Save? phpinfo.php
Then, yes.
PHP phpinfo.php
Find loaded_configuration File = ' xxxx ' in the Out

XXXX is the use of PHP.ini road?

I printed it, I didn't find loaded_configuration File, I'm win7.

PHP--ini

Loaded Configuration File = ' xxxx '
?? Just?

Loaded Configuration File = ' xxxx '
?? Just?


I can't find it under the Win7.

PHP--ini
Take a look at the.

PHP--ini
Take a look at the.


Oh the original to use PHP--ini print out, thank you, has been solved, knot paste

PHP--ini
Take a look at the.

Well, that makes sense. I think so, too.
  • 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.