# NGINX / PHP-FCGI not running.  No PHP!?

**URL:** <https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819>\
**Category:** Virtualmin\
**Created:** [September 15, 2017, 1:08am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819 "2017-09-15T01:08:18Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 15, 2017, 1:08am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/1 "2017-09-15T01:08:18Z")

</div>

I just did a clean installation of Virtualmin, with Nginx. After restoring some servers, I don’t see any php-fcgi-example-com running. So none of my domains have PHP.

Also, where is the option to choose PHP version for NGINX? Right now PHP is broken. Please help!

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 15, 2017, 3:16am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/2 "2017-09-15T03:16:23Z")

</div>

What’s your distribution and version? Did you use any other command line flags (like `--minimal`)?

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 15, 2017, 8:57am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/3 "2017-09-15T08:57:26Z")

</div>

Hi Joe,

I’m using Debian 8 (minimal), without any command line flags.

Also, how do you choose which PHP version to use when using Virtualmin with Nginx? When I click on the Re-Check Configuration, it says:  
`
The following PHP versions are available : 5.6.30 (/usr/bin/php5-cgi), 7.0.23 (/usr/bin/php-cgi7.0), 7.1.9 (/usr/bin/php7.1), 5.6 (mod_php)
`

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 15, 2017, 9:29am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/4 "2017-09-15T09:29:24Z")

</div>

Joe,

Do you want ssh access to the VPS to see for yourself why PHP isn’t working?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 16, 2017, 12:16am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/5 "2017-09-16T00:16:53Z")

</div>

Direct pre-incident and hourly support is available in the shop. We do the best we can to help everyone for free here in the forums, but we can’t provide systems management services for free.

I just did a test install on Debian 9 with nginx and --minimal flag, and PHP is working fine…so, it’s almost certainly something unique to your system or applications. Check the error.log (in /home/domainname/logs) for clues. Also make sure you have correct ownership (owned by the domain owner and group) and permissions (_not_ 777).

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 16, 2017, 12:17am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/6 "2017-09-16T00:17:44Z")

</div>

Also, test with a plain old `phpinfo();` program, so you can be confident it’s not something wrong with your programs rather than the execution environment.

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 16, 2017, 2:06am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/7 "2017-09-16T02:06:52Z")

</div>

I’ve been running Virtualmin with Nginx fine for the past 4 years, I was just offering you access to a recent fresh install of Virtualmin to see yourself. I haven’t touched the ownership or permissions and should have absolutely nothing to do with it. phpinfo file doesn’t work (obviously because PHP isn’t working). Standard txt file or HTML works fine.

Like I said, this is a clean install of Virtualmin on Debian 8 (minimal). I ran /bin/sh /root/virtualmin-install.sh without any flags.

I migrated several sites from a previous version of Virtualmin, because it was on Debian 7, running on an OpenVZ VPS, with PHP 5.4, and could not dist upgrade. I am trying to migrate sites that were working fine, to a fresh install of Virtualmin with Debian 8 and newer version of PHP.

It seems the issue has started occurring with the new Virtualmin install scripts / PHP-FCGI. The recent Virtualmin install scripts have introduced several bugs that I’ve already found installing Virtualmin several times, but I’ll try reinstalling again.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 16, 2017, 6:50am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/8 "2017-09-16T06:50:40Z")

</div>

Don’t reinstall. Look at the logs I suggested for clues about why it isn’t working. I can help you with the right information.

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 16, 2017, 8:03am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/9 "2017-09-16T08:03:53Z")

</div>

Hi Joe, I really appreciate you taking the time to resolve the issue.

I just reinstalled again anyways, and the problem is still there. Here is the error log:

`
2017/09/16 14:41:09 [crit] 8352#0: *1 connect() to unix:/var/php-nginx/15055474867671.sock/socket failed (2: No such file or directory) while connecting to upstream, client: xx.xx.xx.xx, server: example.com, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/15055474867671.sock/socket:", host: "example.com"
`

When I try to restart the /etc/init.d/php-fcgi-example-com, it responds:  
`
Failed to restart php-fcgi-example-com.service: Unit php-fcgi-example-com.service failed to load: No such file or directory.
`

Standard text files will load, PHP will not. I believe the PHP-FCGI service isn’t running. Please advise.

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 17, 2017, 11:24am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/10 "2017-09-17T11:24:39Z")

</div>

Any advise? It seems PHP-FCGI is broken with new Virtualmin installation on Debian 8.

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 17, 2017, 2:54pm UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/11 "2017-09-17T14:54:27Z")

</div>

The new Virtualmin installation has a broken PHP-FCGI implementation, which is an urgent issue. Can you please take a look into it?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 18, 2017, 12:19am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/12 "2017-09-18T00:19:33Z")

</div>

If it’s really urgent, you should probably re-install on Debian 9. I know it works there.

I’m running a test install on Debian 8 right now, but I don’t know how long it’ll be before I’m able to sort it out (it might be something simple, or it might be something that requires a new Virtualmin module release or something else complicated).

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 18, 2017, 1:23am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/13 "2017-09-18T01:23:58Z")

</div>

Hi Joe,

My VPS provider doesn’t have Debian 9 available. I’ll just have to wait until you have time to fix it.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 19, 2017, 9:16am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/14 "2017-09-19T09:16:30Z")

</div>

OK, on my test debian 8 system, PHP-FPM execution mode works, but fcgid does not. So, switch to PHP-FPM in _Server Configuration-\>Website Options_, and you should be able to run PHP apps. You probably want PHP-FPM, anyway, as it’s got some advantages over fcgid.

I’ll look into why fcgid isn’t working on Debian 8 (and also why it seems to be defaulting to that, since everywhere else we’re defaulting to PHP-FPM, as that’s now the recommended execution mode). I also see a couple of cosmetic issues, when using nginx (though I don’t think I saw them on other systems, so it may just be getting confused because there’s so many different PHP versions on Debain 8…I’m beginning to think it was a bad idea to install all of the available versions, as it definitely confuses people and even seems to confuse Virtualmin).

---

<div class="post-metadata">

**Author:** ![wyoungca](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/w/6de8d8/32.png) [@wyoungca](https://forum.virtualmin.com/u/wyoungca)\
**Post date:** [September 20, 2017, 1:56am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/15 "2017-09-20T01:56:01Z")

</div>

I had freshly installed Debian 8 with Virtualmin and had similar problem! It seems like the installation script didn’t install php7.1-cgi and php7.1-fpm. Try installing them: apt-get install php7.1-cgi; apt-get install php7.1-fpm

Then try creating a new virtual server and see if it works. If it works, modify existing php-fcgi scripts in “/etc/init.d/php-fcgi-\*”  
You’ll find: “… /usr/bin/php-loop.pl\ /usr/bin/php7.1\ …”  
Change it to “…/usr/bin/php-loop.pl\ /usr/bin/php-cgi7.1\ …”

Watch out that you might have many “php-loop” processes have started but not working.  
I would “kill” all of them then start each php-fcgi script and see.

I hope it helps!

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 20, 2017, 3:11am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/16 "2017-09-20T03:11:47Z")

</div>

Jamie and I just figured this out while chatting about the problem. Great catch, wyoungca!!

So, the solution is to install php7.1-cgi (php7.1-fpm is optional). We seem to be defaulting to the latest available version (which is not what I thought we were doing…and might be bug-like).

Also, we’ve spotted a bug in version selection with nginx. Jamie will sort that one and a new Virtualmin version will go out soonish with a fix.

So…yeah, install php7.1-cgi to fix fcgid execution under Nginx. Or switch to PHP-FPM, which also works.

After innstalling php7.1-cgi, you’ll need to switch execution mode to PHP-FPM and back again in order to get the new configuration. (Virtualmin tries to use php with the -b option if the necessary php-cgi command isn’t install, which doesn’t exist under php7.1, which fails…but switching execution modes causes it to rewrite the configuration with the right thing.)

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [September 20, 2017, 3:23am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/17 "2017-09-20T03:23:16Z")

</div>

This particular problem only affects Debian 8 (maybe 7, but I don’t think I ever sorted out PHP7 on Debian 7, so probably not). A new virtualmin-lemp-stack/virtualmin-lemp-stack-minimal metapackage will roll out tonight that fixes this (though it’ll always require switching execution modes back and forth for all affected virtual servers, as the config file has to be rewritten to fully resolve it.

PHP versions won’t work until Jamie is able to get that fixed, but it looks like it’s selecting the latest available version (while I think PHP-FPM is selecting the system standard version…so I guess that provides version switching in a hacky way for the time being).

---

<div class="post-metadata">

**Author:** ![kindnation](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/kindnation/32/2127_2.png) [@kindnation](https://forum.virtualmin.com/u/kindnation)\
**Post date:** [September 20, 2017, 10:09pm UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/18 "2017-09-20T22:09:10Z")

</div>

Thanks wyoungca and joe for the info and helping me out. I can confirm that has fixed the problem. Look forward to the PHP version selection from Jamie.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [April 30, 2020, 6:08am UTC](https://forum.virtualmin.com/t/nginx-php-fcgi-not-running-no-php/56819/19 "2020-04-30T06:08:35Z")

</div>

Closed on April 30, 2020, 6:08am UTC


