Search code examples
phpcompilationmingw32execvp

Trying to compile application from within PHP


As stated in the title, I'm trying to compile a program from within PHP using the i686-w64-mingw32-g++-posix cross-compiler.

When I execute the command on the command line, it works great. However when I use the exec function in PHP, it returns me the error:

i686-w64-mingw32-g++-posix: error trying to exec 'cc1plus': execvp: No such file or directory

So, I execute in PHP a command like:

exec('i686-w64-mingw32-g++-posix ....');

Solution

  • exec('/full/path/i686-w64-mingw32-g++-posix ....');.

    You can use tools like whereis or locate to actually get the full path.