I have to call a C++ function in php. I tried it using swig. I wrote the interface file example.i to call the functions from example.cxx in php. To build a PHP extension, I run swig using the -php option as follows:
~$ swig -php example.i
This produced 3 files example_wrap.c, php_example.h and example.php.
Now to build the extension as a dynamically loaded module I used
cc -I.. $(PHPINC) -fpic -c example_wrap.c
It is showing errors like
example_wrap.c: 689:18: zend.h: No such file or directory
example_wrap.c: 690:22: zend_API.h: No such file or directory
example_wrap.c: 691:17: php.h: No such file or directory
For compiling I have used........
cc -I /usr/local/include/php/ -fpic -c example_wrap.c
Please suggest me what to do to make it work???
~$ swig -php example.i
This produced 3 files example_wrap.c, php_example.h and example.php.
Now to build the extension as a dynamically loaded module I used
cc -I.. $(PHPINC) -fpic -c example_wrap.c
It is showing errors like
example_wrap.c: 689:18: zend.h: No such file or directory
example_wrap.c: 690:22: zend_API.h: No such file or directory
example_wrap.c: 691:17: php.h: No such file or directory
For compiling I have used........
cc -I /usr/local/include/php/ -fpic -c example_wrap.c
Please suggest me what to do to make it work???
Comment