Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


nginx + php-fpm won't work
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

nginx + php-fpm won't work

Script: https://gist.github.com/lifehome/9b01629b78e5e627601f

It pops out "No input file specified." in the browser after installation, and keeps popping out error in log

2014/12/21 14:50:23 [error] 12345#0: *18 FastCGI sent in stderr: "Unable to open primary script: /path/to/index.php (No such file or directory)" while reading response header from upstream, client: 1.2.3.4, server: example.org, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/wordpress-fpm.socket:", host: "example.org"

Where /path/to/index.php is reachable, and while all the html files are reachable by the clients, I highly doubt this is a FPM issue.

Any idea? (My problem at SO: http://stackoverflow.com/questions/27561355/no-input-file-specified-php-fpm-and-nginx)

Comments

  • blackblack Member
    edited December 2014

    It's probably a permission issue.

  • I could image the following potential issues:

    • the /path/to/index.php is not accessible to nobody user
    • the nginx does not have privilege for the php-fpm socket.
  • Pyr02k1Pyr02k1 Member
    edited December 2014

    http://blog.martinfjordvald.com/2011/01/no-input-file-specified-with-php-and-nginx/

    For the return/debug section
    http://blog.martinfjordvald.com/2013/06/debugging-nginx-errors/

    Possible... I've done it once.
    http://www.linuxquestions.org/questions/linux-server-73/fastcgi-cannot-find-php-files-after-i-created-nginx-chroot-environment-4175447842/

    And finally... The arch wiki typically is a good resource to follow even if you need to locate your distro specific commands. They tend to be very in depth and I've rarely had one of their wiki guides fail to function when finishing setup.
    https://wiki.archlinux.org/index.php/nginx
    Edit: that's is if all else fails and you want to try a quick reinstall.

    It really does sound like a permission error, but not an accessible versus not since you've done a 777 for testing. It sounds more as if it's a chroot or bad path kind of issue.

  • @black said:
    It's probably a permission issue.

    I've ran "chmod -R 777 /path/to/index.php", no luck with that.

    @bookstack said:
    I could image the following potential issues:

    • the /path/to/index.php is not accessible to nobody user
    • the nginx does not have privilege for the php-fpm socket.

    Permission explained above, and the privilege thing, I've been using the same user 'httpd' for php-fpm pool.d configuration and upon nginx compile, could you tell more about how does the privilege thing works?

  • @Pyr02k1 said:
    SNIP

    I've spent days and nights before with the first link you provided, and no luck on changing params of SCRIPT_FILENAME, nor the chroot problem bugs me.

    @$request_filename;" put into the location / {} block, it outputs correctly without having trouble to recgonize the /path/to/index.php

    So it bugs me alot. And, the issue is not really related to chroot issue as I cleared out all the chroot env/var.

    Might go and try your quick advice...

  • file php-fpm.sock exists or not?.

  • Pyr02k1Pyr02k1 Member
    edited December 2014

    It's a difficult thing to troubleshoot without actually doing the troubleshooting. You mentioned having removed all chroot vars... why? It's probably not the issue, but a rule of thumb when you're modifying stuff, especially anything that could break stuff down the line or cause you security headaches later, test along the way. Did you do a basic setup of nginx with php-fpm and test, then modify, or install, modify severely and then try to test? I'd imagine everything would work from fresh, then something changed or removed caused your problem to crop up.

    Best thing to do, spool up another vps somewhere, something cheap, and get a basic nginx/php-fpm setup going. Then start to work your way down to where you're at now, making sure to test at points where the changes are separate sets of changes (for example, changing the pool info... Once you do it and change permissions and such, then test. Once you change the domains file locations from standard, test, once you remove chroot info from a certain file to leave you where you're at now, test).

    It's tedious really, and you might be better off to just start over, but it's up to you. I'd want to figure out why it's broken and I'd take a couple hours to figure it out. With that said, I have done it where I'm not able to spare the time to troubleshoot it all and a reinstall will cost me 15 minutes, compared to an hour or two for troubleshooting. Sorry I couldn't be of more help.

    Edit: I suppose if you're feeling really spiffy about it, you could drop the php-fpm workers to one and run an strace against it to see what exactly is happening. I've only ever gone that far into it twice, but it is admittedly a quicker solution and it will usually give out some helpful data towards the problem.

  • do you add rewrite rule in nginx for wp ?
    http://codex.wordpress.org/Nginx

  • Do you have anything hinder the security of the VPS/server? Like SELinux? Disable it.

  • socialssocials Member
    edited December 2014

    SELinux.

    Hint: Look at your syslog, keyword AVC.

  • @khuongcomputer said:
    Do you have anything hinder the security of the VPS/server? Like SELinux? Disable it.

    Tried disabling SELinux, but no luck.

    @socials said:
    SELinux.

    Hint: Look at your syslog, keyword AVC.

    The log gives me A LOT OF denied requests, but disabling it doesn't help.

  • If you still get anything SELinux related in your logs after "disabling", you didn't disable it.

  • @lifehome You have to restart after disabling selinux...

  • @Abdussamad said:
    lifehome You have to restart after disabling selinux...

    I did.

    @socials said:
    If you still get anything SELinux related in your logs after "disabling", you didn't disable it.

    ~# getenforce
    Disabled
    
  • nexusrainnexusrain Member
    edited December 2014

    If you like, you can take a look at a post right about this on my blog. But its written for Debian / Ubuntu and in german. So Google Translate might help you...

    https://www.bitforce.io/internet/howto-nginx-1-6-2-mit-php5-fpm-installieren-und-konfigurieren/

    However, I already had this issue too. Make sure the passing from nginx to php-fpm of php files to execute them works and you specified the correct path in the nginx config:

    fastcgi_param SCRIPT_FILENAME [Full Path without slash on the end]$fastcgi_script_name;

    Just follow my guide from step 4.

    Edit: And, guy from Singapore, what do you say about my guide? :p

  • @lifehome said:
    ````

    Yes, but do you still see lines related to SELinux in your logs? If you do, it ain't disabled.

    I've seen that even if you specify SELINUX=disabled in /etc/sysconfig/selinux, it sometimes still stays enabled for some reason. Specifiying selinux=0 in your boot parameters helps in that case.

  • Does /path/to/index.html working ?
    1-Make sure nginx working well.create a HTML first .
    2-check php-fpm .

Sign In or Register to comment.