Skip to content

PHP and nginx is not working #393

Closed
Closed

Description

@heyanlong

php-fpm

ERROR: unable to bind listening socket for address 127.0.0.1:9000 Invalid argument

Nginx

bind() to 0.0.0.0:81 failed (22: Invalid argument)

by windows 10 preview 14332.rs1_release.160422

Activity

  1. sunilmut commented on May 19, 2016

    @sunilmut
    Member

    This is related to #68. I took a deeper look at 'Nginx'. It first binds to an IPv4 address and then to an IPv6 address (to the same port by default) using the IPV6_V6ONLY option. Unfortunately, we are not able to support the scenario immediately and we have a bug tracking this.
    As an alternative, there are couple of options as workarounds:
    Edit the default configuration of Nginx to start at different ports on IPv4 and IPv6. Or, use either IPv4 or IPv6. The port configuration for Nginx is stored in '/etc/nginx/sites-enabled/default'. I was able to verify that both these workarounds work and the Nginx server starts successfully on build 14342. We know its not ideal, but at least gets your one step further.
    Meanwhile, we have an understanding of the bug on our side, but unfortunately, it might take some time to fix it because of dependencies outside of WSL.

  2. heyanlong commented on May 20, 2016

    @heyanlong
    Author

    Nginx server starts successfully on build 14342.
    But the process will not start work

    error.log

    2016/05/20 03:18:24 [alert] 98#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
    2016/05/20 03:18:24 [alert] 98#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
    2016/05/20 03:18:24 [alert] 98#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
    2016/05/20 03:18:24 [alert] 98#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
  3. cjgreen commented on Jun 29, 2016

    @cjgreen

    As mentioned in the following blog post here:

    Add the following line to /etc/nginx/nginx.conf:
    master_process off;

    Then restart nginx:
    sudo service nginx restart;

    Edit:
    This appears to only get nginx working for html files. When trying to load php files through php-fpm I receive the following error:
    2016/06/30 15:28:14 [alert] 458#0: *1 connect() failed (22: Invalid argument) while connecting to upstream, client: 127.0.0.1, server: REMOVED, request: "GET /REMOVED HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "REMOVED", referrer: "REMOVED"

  4. williamn commented on Jun 30, 2016

    @williamn

    I follow the steps taken as the blog post describe and it works. My nginx is now working.
    But I have not successful on FPM

    I got this when try to start the PHP FPM

    ERROR: failed to retrieve TCP_INFO for socket: Invalid argument

    Any idea why?

  5. sunilmut commented on Jul 5, 2016

    @sunilmut
    Member

    TCP_INFO socket option is currently not supported in WSL, and something we will look into adding. Thanks for the feedback and trying out WSL!

  6. PeterDraex commented on Jul 26, 2016

    @PeterDraex

    How can I prevent FPM from using TCP_INFO socket option? Thanks. Sunil Muthuswamy (@sunilmut) William (@williamn)

  7. loutian commented on Aug 5, 2016

    @loutian

    Chris Green (@cjgreen) I got the same error, did you solved it ?

  8. spagu commented on Nov 22, 2016

    @spagu

    any solution so far?

  9. heyanlong commented on Nov 22, 2016

    @heyanlong
    Author

    Mona Lisa (@spagu) i'm not retry

  10. stehufntdev commented on Jan 19, 2017

    @stehufntdev

    After adding signal driven IO support for unix stream sockets, I was able to run nginx locally and load the default site. Also confirmed that the errors were gone from the nginx error log. The fix should be out in insider builds soon.

    Can you please confirm if the issues with php are resolved?

  11. 14 remaining items

  12. WSLUser commented on Jan 4, 2018

    @WSLUser

    Sunil Muthuswamy (@sunilmut) I wasn't providing an issue. I'm just curious if dvaknheo has tested performance with the latest Insider build as I'm not able to install Insider builds. I don't normally work with nginx but do play slightly with php. I brought the article up as a case of eventually having a possible performance boost for utilizing Unix sockets vice tcp ports which is currently done in some situations such as using nginx

  13. sunilmut commented on Jan 4, 2018

    @sunilmut
    Member

    Nikita Ushakov (@DarthSpock) - Got it, thanks! A forward looking statement, but theoretically speaking (without any measurements), the way things are currently implemented and layered, I would not expect a difference in performance between WSL<->Win32 between TCP loopback and AF_UNIX sockets. Note that this is just in theory.

  14. CMYK99 commented on Jan 20, 2018

    @CMYK99

    In nginx error log there is such an error message.
    2018/01/21 00:29:22 [emerg] 35#35: io_setup() failed (38: Function not implemented)

  15. therealkenc commented on Jan 20, 2018

    @therealkenc

    2018/01/21 00:29:22 [emerg] 35#35: io_setup() failed (38: Function not implemented)

    Open a new one for that following CONTRIBUTING.md. Cant tell you if it is a dupe or not because not enough information provided. This issue (bind() to 0.0.0.0:81 failed (22: Invalid argument) was closed a long time ago along with #68.

  16. sunilmut commented on Jan 22, 2018

    @sunilmut
    Member

    @YouHeng1 - Yes, please open a new issue for this and also note any functionality issue that you might be observing with nginx.

  17. dvaknheo commented on Aug 27, 2018

    @dvaknheo

    yesterday night I upgrade unbuntu (for i want a php7.1 - swoole project). and then my php(both php7.0 and another download php7.2) is broken :(

    ERROR: failed to retrieve TCP_INFO for socket: Protocol not available (92)
    ERROR: pid 1031, fpm_socket_get_listening_queue(), line 420: failed to retrieve TCP_INFO for socket: Protocol not available (92)

    again! ,thought ,i set socket bind to 127.0.0.1:8999 .

    maybe ,my win10 need to upgrade 1803ver

    ////
    some month last i install Tencent WeGame and broken my WSL thought I re-install wsl can not solute. then I uninstall WeGame soluted .

    but this days my php is not broken , just after upgrade unbuntu .

  18. heyanlong commented on Aug 27, 2018

    @heyanlong
    Author

    dvaknheo
    多写代码,少玩游戏
    Write more code, play less games

  19. hparadiz commented on Nov 28, 2018

    @hparadiz

    This configuration works in Ubuntu WSL.
    Please note that fastcgi_buffering is off.
    Without this nginx will wait on PHP forever and never complete.

    location ~ \.php$ {
            proxy_set_header X-Forwarded-Proto $scheme;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_buffering off; # This must be here for WSL as of 11/28/2018
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PHP_VALUE "upload_max_filesize = 20M \n post_max_size=21M";
            include /etc/nginx/fastcgi.conf;
    }
  20. Babaktrad commented on Dec 3, 2018

    @Babaktrad

    This configuration works in Ubuntu WSL.
    Please note that fastcgi_buffering is off.
    Without this nginx will wait on PHP forever and never complete.

    location ~ \.php$ {
            proxy_set_header X-Forwarded-Proto $scheme;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_buffering off; # This must be here for WSL as of 11/28/2018
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    ```>         fastcgi_param PHP_VALUE "upload_max_filesize = 20M \n post_max_size=21M";
            include /etc/nginx/fastcgi.conf;

    It works for me. It was nearly two weeks that I was involved with this issue! Thanks a lot.

  21. PhillR commented on Dec 7, 2018

    @PhillR

    Henry Paradiz (@hparadiz) Hero answer, solved a long, outstanding problem for me. Thank you!

  22. phpcat100 commented on Jun 2, 2019

    @phpcat100

    thank you.

  23. tawhidulIKhan commented on Nov 25, 2019

    @tawhidulIKhan

    It works! thanks Henry Paradiz (@hparadiz)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions