I'm using php 5 apache on windows server 2008, I have disabled IIS.
I m using exec command in my PHP script and it was working fine but today I got an error:
Warning: exec(): Unable to fork
I gave permissions to cmd.exe
in C:\Windows\System32
folder
but this did not fix the problem.
fork() usually fails because necessary system resources are exhausted, it is likely that memory limits or the maximum number of open processes per system is reached.
php phpinfo(); ?> You can search for disable_functions and if exec is listed it means it is disabled. To enable it just remove the exec from the line and then you need to restart Apache and you will be good to go. If exec is not listed in the disable_functions line it means that it is enabled.
Specifically which permissions did you give to who? Probably not to the right user..
Run this php script:
echo 'Script is executed by: ' . get_current_user() . getmygid();
It will tell you which user is running the PHP scripts and therefore which user to grant permissions to cmd.exe
.
In 64-bit windows (e.g server 2008), theres a folder named c:\windows\syswow64, that contains all executables/dll, that are required by a 32 bit app. installed on your 64-bit machine. Make sure your required 32-bit .exe/dll etc is placed in that folder. if you cant find it there you will have to put a 32-bit version of the required .exe/dll there.So this can used by yopur app/process.
Now when your 32-bit application/process executes, windows will automatically redirect your process to execute required app in syswow64 folder.
Hopefully that should resolve your compatibility issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With