I have a PHP web application that needs to call a function in a C ++ library. This library is provided by the vendor (libfoo.a on the Linux machine).
My first instinct is to create a C ++ executable that references libfoo.a and pass command line parameters to the function. Then the PHP web application can make a call to system () for my C ++ executable. That would be easy to implement. My concern is whether it will add a lot of overhead to create a new system process for each call. How much is overhead?
An alternative is that I can use SWIG to port a C ++ function to a PHP extension, but I do not have C ++ source code. Does SWIG support communicate with the ".a" library? Will I require every other engineer in my team to change their PHP configuration to build in libfoo.a?
If the overhead of calling system () is small (<30 ms), I would prefer option # 1, as it seems easier to create a C ++ executable once, rather than embed it in a PHP application. What are your recommendations for the two options?
, , php , ++ lib. . , lib. , , , , .. .
, :
, ++ vs C , , DLL , .
" , Visual Studio ++ 9, ".
IPC (inter process communication). ++ - - ( TCP/IP unix)
. man 3 daemon, man 2 fork Unix
man 3 daemon
man 2 fork
P.S. PHP - ++ , PHP. php - - . /lib , , - ( ), , -
2. PHP/SWIG, perl, java PLSQL (oracle). C/++ ( libraires), .
, . . ( ) , "" , , - .
: