PHP Embed (php_embed.h)
| From: | Marcelo Verteramo Pérsico | Date: | Sun, 19 Jan 2025 10:33:49 +0000 |
| Subject: | PHP Embed (php_embed.h) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-328617@lists.php.net to get a copy of this message | ||
Hello.
I'am using embedded Zend Engine for executing PHP scripts and getting its output, I start
making this basic example: https://github.com/KapitanOczywisty/PHP_embed_docs/blob/main/embed.md,
and it's all ok, it works. The challenge come when I try to use it on an Apache custom module,
I can compile it but when I restart Apache it says:
> apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of
> /etc/apache2/mods-enabled/rst.load: Cannot load /usr/lib/apache2/modules/mod_rst.so into server:
> /usr/lib/apache2/modules/mod_rst.so: undefined symbol: php_embed_shutdown
libphp is well linked:
ldd /usr/lib/apache2/modules/mod_rst.so
linux-vdso.so.1 (0x00007ffeef78a000)
libphp.so => /home/user/php-embed/libs/libphp.so (0x00007fd10fb2b000)
...
And it has embedded functions exported:
nm -D /home/user/php-embed/libs/libphp.so | grep php_embed
00000000007ea477 T php_embed_init
000000000157eac0 D php_embed_module
00000000007ea5aa T php_embed_shutdown
...
I am working on Debian 12 Bookworm and tested packages 'php-embed',
'libphp-embed' and compiling PHP by myself with flag --enabled-embed, with the three
methods I get the same results.
After tons of tests, I stopped testing and begin to try it in Nginx, in this server I can load it
correctly and the server reloads well, but when I execute my php script with zend_eval_string (like
in the functional example) it returns FAILURE.
Sorry, but what am I doing bad? Maybe Zend PHP Embed can not be executed in a custom HTTP server
module?
Sorry for my English grammar, I'am giving my best effort. Thanks.