WAMP crashes easily those days: Some notes on PHP configuration Mon, Sep 14. 2009
I've upgrade my WAMP(Windows+Apache+MySQL+PHP) to lastest versions, but Apache crashes more often then it used to be due to incorrect configuring PHP.
Now I've finially got a stably working development environment. And here is some notes:
go-pear.batdose not work.When initializing as usual using
go-pear.batcommand, I got an error message:- phar "E:\HTTPD\php-5.3.0-Win32-VC9-x86\PEAR\go-pear.phar" does not have a signature
- PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in E:\HTTPD\php-5.3.0-Win32-VC9-x86\PEAR\go-pear.phar on line 1236
So,
go-pear.bardid not work for me, but:is all right.- php -dphar.require_hash=0 PEAR\go-pear.phar
Xdebugmakes Apache crashes everytime.As I said, I've upgraded all components to it's lastest version: Apache, version 2.2.13 form offical site, PHP, version VC9 x86 Thread Safe, MySQL, version 5.1.38-community.
Following Xdebug manual, I have to download the one matches the PHP version I'm using. So, I downloaded Xdebug 2.0.5 5.3 VC9 (32 bit), made modification to php.ini to enable Xdebug, and restart Apache.
From now on, Apache crashed everytime I call
phpinof()function. I've tried some solution from Google ,but none of them works. Though, one page remains me of the version of PHP. And I found this on PHP for Windows download page:
Change my PHP from VC6 to VC9, re-configure all settings and download Xdebug 2.0.5 5.3 VC96(32 bit), it works!Which version do I choose?
If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP
If you are using PHP with IIS you should use the VC9 versions of PHP
Can't make new folder when installing PEAR.
After solve problems above, I came to a new one, When installing PEAR, ater set the dirs, PHP began to download and install PEAR components, installation programe breaks and shows:
- Unable to create Temporary directory for processing E:\HTTPD\php\PEAR\tmp.
- Run this script as administrator or pick another location.
I'm sure nothing is wrong about dir premission. Solved this problem, I'm also sure that few people may face this, because it is due to the immature hardlink mechanism on Windows Server 2008.
I made hardlink named php to folder php-5.3.0-Win32-VC6-x86 and I was running the programe in php folder. After I change my current folder to php-5.3.0-Win32-VC6-x86, it goes well.
Conclusion: harklink on Windows is still a load of crap.
神奇的土地上发生的神奇的错误 Thu, Dec 27. 2007
梨花体小诗一首做题记:
毫无疑问
我犯的错误
是全天下
最神奇的
在 long long ago 的某一天,偶的 Windows 2003 + Apache 2.2 + PHP 5 + MySQL 5.1 突然访问所有的页面都非常慢,打开一个页面,甚至是什么都不做的页面,都要等上好几秒钟,一个简单的 phpinfo(); 居然花了 8s。
偶的 WAMP 环境是多少年一直免安装升级上来的,这些古董配置都是偶千调万改才定下来的最优化的配置。但是就是找不到错误原因。
今天 reinstall Windows 2003,趁机全新的安装了一下 AMP 环境,发现默认配置下,PHP 页面速度非常正常,但是把 php.ini 文件修改成我要的,就立马恢复超级慢的状态。预示 diff 出所作的修改,逐条测试,直到最后发现,只要 extentions 加载 php_mysql.dll 或者 php_mysqli.dll,就会变慢,多次测试的结果都证明了这个结论。
在 Google 上使劲找和 php、mysql、slow 相关的页面,都没有任何相关的问题,难道今天偶 RP 大爆发碰到了千年不遇的超级难题?
搜索这个关键字无果,不过发现最新的 Apache 2.2 的 conf 文件结构发生了变化,于是顺便看看相关的文档,决定把自己用了 n 年的 PHP4/PHP5 共存的虚拟主机配置文件重新修正一下。偶以前都是图省事,用的是 CGI 方式驱动 PHP,关键配置如下:
- ScriptAlias /php5/ "e:/httpd/php5/"
- AddType application/x-httpd-php .php
- Action application/x-httpd-php "/php5/php-cgi.exe"
这个方法以前用的好好的,从 PHP4 就这样写,一直用到现在,虽然说效率低一点,不过开发的时候不在乎,能用就行了。最新的 Apache 2.2 里面推荐用的是 Module 方法,照猫画虎修改如下:
- LoadModule php5_module e:/HTTPD/php5/php5apache2_2.dll
- AddType application/x-httpd-php .php
- PHPIniDir "e:/HTTPD/php5"
好像很早就有这种加载的方法,汗,偶一直到现在才开始使用。当把 PHP 由 CGI 变成 Module 方式加载后,居然页面速度神奇的正常了。即使加载了 php_mysql.dll 也没有任何问题。真抓狂,实在想不出来这两个有什么关系,但是事实却是就是正确了。
同时发现最新的 Apache 的 conf 文件由以前的一个 httpd.conf 变成了以现在一个 httpd.conf 和 extra/httpd-*.conf 结合,结构更加清晰了,不错。赞 Apache 一个。
