We are running PHP 5.5.9 (NTS, x86) on Windows Server 2012 R2 with FCGI, Kerberos Auth and fastcgi.impersonate = 1. Application Pool runs with a AD User Service Account, W3P Service runs with "local system" Account.
Execution is enabled in IIS Script Handler for FCGI-PHP. Handler Feature Permissions is also set to "Execute".
Now I am trying to run a application from command line, but this also simple commands like dir or ping are failing with "unable to fork".
exec('dir');
Warning: exec(): Unable to fork [dir] in D:\mypath\myfile.php on line
2
I have tried in my DEV-Environment:
- added read+execute Permissions to "Everyone" to c:\windows\syswow64\cmd.exe
- copied c:\windows\syswow64\cmd.exe to PHP-dir
- added read+execute Permissions to ISUSR to cmd.exe im PHP-dir
- added read+execute Permissions to IIS_IUSRS to cmd.exe im PHP-dir
- upgraded to PHP 5.5.16
- watched with sysinternals procmon, found no error or something
- searched hours and hours for this on the web
I had this problem. It was caused by conflicting IIS settings in these 2 locations:
Application Pool > Advanced Settings > Process Model > Identity
This was set to a domain user. This was the correct setting for how we needed to run our web site.
Web site > Authentication > Anonymous Authentication
This was set to the same "Specific user" as the application pool. It should have been set to "Application Pool Identity".
After I changed the web site authentication to "Application Pool Identity",
exec() ran successfully.
1 Post
Unable to fork error for exec
Sep 08, 2014 10:18 AM|thepdcemulator|LINK
We are running PHP 5.5.9 (NTS, x86) on Windows Server 2012 R2 with FCGI, Kerberos Auth and fastcgi.impersonate = 1. Application Pool runs with a AD User Service Account, W3P Service runs with "local system" Account.
Execution is enabled in IIS Script Handler for FCGI-PHP. Handler Feature Permissions is also set to "Execute".
Now I am trying to run a application from command line, but this also simple commands like dir or ping are failing with "unable to fork".
Warning: exec(): Unable to fork [dir] in D:\mypath\myfile.php on line 2
I have tried in my DEV-Environment:
- added read+execute Permissions to "Everyone" to c:\windows\syswow64\cmd.exe
- copied c:\windows\syswow64\cmd.exe to PHP-dir
- added read+execute Permissions to ISUSR to cmd.exe im PHP-dir
- added read+execute Permissions to IIS_IUSRS to cmd.exe im PHP-dir
- upgraded to PHP 5.5.16
- watched with sysinternals procmon, found no error or something
- searched hours and hours for this on the web
Any hints? Thank you for your help!
70 Posts
Re: Unable to fork error for exec
Aug 25, 2016 10:39 PM|cstobbe|LINK
I had this problem. It was caused by conflicting IIS settings in these 2 locations:
This was set to a domain user. This was the correct setting for how we needed to run our web site.
This was set to the same "Specific user" as the application pool. It should have been set to "Application Pool Identity".
After I changed the web site authentication to "Application Pool Identity", exec() ran successfully.
1 Post
Re: Unable to fork error for exec
Nov 19, 2017 07:26 AM|iisdev2001|LINK
Finally! That's it! Thank you.
1 Post
Re: Unable to fork error for exec
Aug 28, 2018 08:28 PM|williamyiu|LINK
I tried this and it solved the "Unable to fork" issue. But the site can't create symlink. Any help?