Warning: exec (): cannot use fork in PHP

I am using php 5 apache on a Windows 2008 server, I have disabled IIS.

I use the exec command in my PHP script and it works fine, but today I received an error message:

Warning: exec(): Unable to fork 

I gave permissions for cmd.exe in the folder C:\Windows\System32 but this did not fix the problem.

+4
source share
3 answers

In 64-bit windows (for example, server 2008), there is a folder c: \ windows \ syswow64, which contains all the / dll executables that are required by the 32-bit application. installed on your 64-bit machine. Make sure your required 32-bit .exe / dll file, etc. It is placed in this folder. if you do not find it there, you will have to put the 32-bit version of the required .exe / dll file there. This can be used by yopur application / process.

Now that your 32-bit application / process is running, windows will automatically redirect your process to run the desired application in the syswow64 folder.

Hope this should fix the compatibility issue.

+3
source

In particular, what permissions did you give to whom? Probably not for the right user.

Run this php script:

 echo 'Script is executed by: ' . get_current_user() . getmygid(); 

It will tell you which user runs the PHP scripts and therefore which user provides permissions for cmd.exe .

+4
source

I had this problem myself, but in the end she managed to solve it. The problem was due to the way I accidentally set cmd.exe to "Run as administrator" by default. I say "by accident" because I thought that I set only the compatibility options for the shortcut on the taskbar, but it turned out that it sets the compatibility of the .exe itself. In any case, I disabled this by deleting the registry key:

 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers 

After that, everything worked again.

+2
source

Source: https://habr.com/ru/post/1385893/


All Articles