Connect () Php-cgi.sock failed (2:no such file or directory) problem resolution

Source: Internet
Author: User
Connect () Php-cgi.sock failed (2:no such file or directory) problem resolution

In the LMNP server architecture, when you configure the nginx,php service, the following error occurs when you access the 127.0.0.1/index.php home page:

2339 Connect () to Unix:/home/xxx/php/var/php-cgi.sock failed (2:no such file or directory) while connecting to upstream, Client:xxxx

Please check the configuration of Nginx and PHP-FPM for the above problems:

1.nginx configuration file nginx.conf, locate the location where the PHP-FPM path is configured

Location ~\.php$ {    root/home/xxxx;    Fastcgi_pass Unix:/home/xxx/php/var/php-cgi.sock;    Fastcgi_index index.php;    Include fastcgi.conf;}

One of the Fastcgi_pass is to configure Nginx and php-fpm Interactive path, there are generally two ways

Sock way: Fastcgi_pass Unix:/home/xxx/php/var/php-cgi.sock;

HTTP mode: Fastcgi_pass 127.0.0.1;9000;

Choose one of these, but it must be consistent with the PHP-FPM configuration.

2.PHP-FPM configuration file php-fpm.conf, find where to configure the startup mode

<workers>    <section>    <value name= "listen_address" >127.0.0.1:9000</value>        ...// Omit other configurations    </section> </workers>

The configuration for 127.0.0.1:9000 and Nginx configuration Unix:/home/xxx/php/var/php-cgi.sock does not match, so cause error.

Modify the PHP-FPM configuration to:

/home/xxx/php/var/php-cgi.sock

or modify the Nginx configuration to:

Fastcgi_pass    127.0.0.1;9000;

Can solve the above problems.

This is the solution to connect () Php-cgi.sock failed (2:no such file or directory), more about topic.alibabacloud.com (www.php.cn)!

  • 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.