今天在wnmp环境下安装yii框架的时候报了504的错误,然后查看nginx的错误日志报了以下的错误:
2017/03/19 19:47:03 [error] 12460#12392: *8 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: www.yii.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com"
接着查看php的错误日志,显示以下错误:
2017/03/19 19:36:30 [error] 12460#12392: *3 FastCGI sent in stderr: "PHP Notice: Use of undefined constant INTL_ICU_VERSION - assumed 'INTL_ICU_VERSION' in D:\wnmp\html\yii2\vendor\yiisoft\yii2\requirements\requirements.php on line 61
PHP Notice: Use of undefined constant INTL_ICU_VERSION - assumed 'INTL_ICU_VERSION' in D:\wnmp\html\yii2\vendor\yiisoft\yii2\requirements\requirements.php on line 67" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /yii2/requirements.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9002", host: "localhost"
基本可以确定是fastcgi没开启导致的问题了。
那么这个fastcgi是干什么吃的呢? 原来是是个cgi(Common GatewayInterface)通用网关接口,它用来连接nginx和PHP的,和php-cgi.exe有关系。 所以很明显,我以上的动作并没有搞过php-cgi.exe,所以导致没人CGI去处理nginx的连接吧,所以一直才会TIMEOUT。。。 用以下语句:
D:\wnmp\php>php-cgi.exe -b 127.0.0.1:9000 -c D:/wnmp/php/php.ini
启动了php-cgi,然后重新启动nginx,最后打开yii的页面,就没有出现504的错误了,问题解决。