<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-cn">
		<id>http://wiki.blueidea.com/index.php?action=history&amp;feed=atom&amp;title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL</id>
		<title>PHP在DOS命令行下不能连接MySQL - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.blueidea.com/index.php?action=history&amp;feed=atom&amp;title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL"/>
		<link rel="alternate" type="text/html" href="http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;action=history"/>
		<updated>2026-04-29T12:00:18Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2544&amp;oldid=prev</id>
		<title>2008-05-02T21:58:44 蓝色</title>
		<link rel="alternate" type="text/html" href="http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2544&amp;oldid=prev"/>
				<updated>2008-05-02T21:58:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2008-05-02T21:58:44的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:PHP]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:PHP&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]][[category:CakePHP&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，一是 MediaWiki 的升级，都是通过在 DOS 窗口下运行升级脚本，二是 cakephp 框架的脚本生成器console。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，一是 MediaWiki 的升级，都是通过在 DOS 窗口下运行升级脚本，二是 cakephp 框架的脚本生成器console。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>蓝色</name></author>	</entry>

	<entry>
		<id>http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2449&amp;oldid=prev</id>
		<title>2008-03-30T17:48:38 蓝色</title>
		<link rel="alternate" type="text/html" href="http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2449&amp;oldid=prev"/>
				<updated>2008-03-30T17:48:38Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2008-03-30T17:48:38的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:PHP]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:PHP]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，一是 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;MedaiWiki &lt;/del&gt;的升级，都是通过在 DOS 窗口下运行升级脚本，二是 cakephp 框架的脚本生成器console。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，一是 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;MediaWiki &lt;/ins&gt;的升级，都是通过在 DOS 窗口下运行升级脚本，二是 cakephp 框架的脚本生成器console。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;好了，在DOS窗口下运行PHP脚本最容易碰到的问题就是不能连接MySQL，提示语句类似这样&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;好了，在DOS窗口下运行PHP脚本最容易碰到的问题就是不能连接MySQL，提示语句类似这样&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>蓝色</name></author>	</entry>

	<entry>
		<id>http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2444&amp;oldid=prev</id>
		<title>2008-03-30T06:14:28 蓝色</title>
		<link rel="alternate" type="text/html" href="http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2444&amp;oldid=prev"/>
				<updated>2008-03-30T06:14:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2008-03-30T06:14:28的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第14行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第14行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;另外，有时还需要在环境变量里增加PHP的路径，这样才能方便的在DOS窗口下使用PHP。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;另外，有时还需要在环境变量里增加PHP的路径，这样才能方便的在DOS窗口下使用PHP。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;附：PHP在DOS下的PHP.INI的载入是先找PHP目录，如果没有再找WINDOWS目录。所以如果设置WINDOWS目录下的PHP.INI不生效，要先检查是不是在PHP目录下也有PHP.INI文件。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>蓝色</name></author>	</entry>

	<entry>
		<id>http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2440&amp;oldid=prev</id>
		<title>蓝色：新页面: category:PHP  PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，...</title>
		<link rel="alternate" type="text/html" href="http://wiki.blueidea.com/index.php?title=PHP%E5%9C%A8DOS%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5MySQL&amp;diff=2440&amp;oldid=prev"/>
				<updated>2008-03-30T05:14:55Z</updated>
		
		<summary type="html">&lt;p&gt;新页面: &lt;a href=&quot;/index.php?title=%E5%88%86%E7%B1%BB:PHP&quot; title=&quot;分类:PHP&quot;&gt;category:PHP&lt;/a&gt;  PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:PHP]]&lt;br /&gt;
&lt;br /&gt;
PHP在 apache 和 IIS 里运行，网上已经有太多的文章了，但是PHP在DOS窗口下运行，对很多人来说还是个新鲜事，我也只用到过两次，一是 MedaiWiki 的升级，都是通过在 DOS 窗口下运行升级脚本，二是 cakephp 框架的脚本生成器console。&lt;br /&gt;
&lt;br /&gt;
好了，在DOS窗口下运行PHP脚本最容易碰到的问题就是不能连接MySQL，提示语句类似这样&lt;br /&gt;
&lt;br /&gt;
 Fatal error: Call to undefined function mysql_connect()&lt;br /&gt;
&lt;br /&gt;
通常这种情况就是 mysql 扩展没有打开，但PHP.INI里已经设置了啊。而且WEB一切正常。但仔细一想DOS窗口下和WEB是在不同的两套体系下的，当然会有不一样。那就肯定是PHP.INI没有生效了。&lt;br /&gt;
&lt;br /&gt;
考虑到我是安装的 EasyPHP 套件，所以把 apache 目录下的 PHP.INI 拷贝到 php 目录下。问题解决。&lt;br /&gt;
&lt;br /&gt;
附：一般普通人都是直接安装PHP安装程序，所以PHP.INI都会被默认安装到 c:\windows 目录下，所以这个问题并不普遍，倒是使用这些方便的整合型套件时，PHP.INI都不会在默认的位置，所以在DOS窗口下会连接数据库失败。&lt;br /&gt;
&lt;br /&gt;
另外，有时还需要在环境变量里增加PHP的路径，这样才能方便的在DOS窗口下使用PHP。&lt;/div&gt;</summary>
		<author><name>蓝色</name></author>	</entry>

	</feed>