two-bees

使用curl请求是超时,查了下资料原来是端口被占用,造成了死锁,记录下

首先要知道为什么会出现死锁?

  在我们访问页面的时候这个端口进程就已经被使用,当我们再在页面中curl请求其他页面因为没有其他的端口,php-cgi当然还要使用9000,就造成了阻塞所以就死锁了。

运行环境:windows + nginx + php

解决方法:

打开cmd,执行

D:\App_self\phpstudy\PHPTutorial\php\php-7.0.12-nts\php-cgi.exe -b 127.0.0.1:9001 -c D:\App_self\phpstudy\PHPTutorial\php\php-7.0.12-nts\php.ini

注意,cmd窗口不要关闭

再在请求页的vhost配置文件中修改

        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

这里的fastcgi_pass要改成127.0.0.1:9001,即cmd开启的端口。

over

推荐一个nginx+php-cgi的运行原理,很不错,要常看

 http://www.cnblogs.com/mangguoxiansheng/p/5967745.html

 

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-05-12
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-08-23
  • 2021-10-12
  • 2021-11-20
猜你喜欢
  • 2021-11-20
  • 2021-11-20
  • 2022-01-07
  • 2021-06-12
  • 2021-11-20
相关资源
相似解决方案