Came across this thread, how to install posix in php, but it's not 2011 anymore. Latest versions of Windows are said to have 100% POSIX support. What about a PHP wrapper?
I need the equivalent of yum install php-process
, a .dll
or something.
Came across this thread, how to install posix in php, but it's not 2011 anymore. Latest versions of Windows are said to have 100% POSIX support. What about a PHP wrapper?
I need the equivalent of yum install php-process
, a .dll
or something.
Python supports all POSIX operations the operating systems do, so the easiest workaround is to shell_exec
python scripts. The plus side is that you don't break platform independency with this.
To take it further, this is how I created the missing funcionality:
function fdopen($fd, $mode, $buffersize){
return shell_exec("
python -c 'import os; print os.fdopen(".$fd.",".$mode.",".$buffersize.")'
");
}
Exception handling is the catch, however. You have to catch all exceptions on the Python side, and output something by which you can identify the exception in PHP.
Every function can be implemented following the analogy of this. Even though it's a pain in the ass, in general I was fine with like 4-5 different syscalls for this project, so it's not a big deal either. But you need Python :)