swoole/phpx

ArchLinux 上安装, libphpx.so 拷贝位置错误

ipengxh opened this issue · 4 comments

在 ArchLinux 上执行:

bruce@Arch ~/s/PHP-X> sudo make install
[100%] Built target phpx
Install the project...
-- Install configuration: "Release"
Are you run command using root user?
-- Up-to-date: /usr/local/lib/libphpx.so
-- Up-to-date: /usr/local/include/phpx.h
-- Up-to-date: /usr/local/include/phpx_embed.h

拷贝的目标地址是 /usr/local/lib/libphpx.so
设置好 php.ini 后,执行 php -m,报警告信息:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/cpp_ext.so' - libphpx.so: cannot open shared object file: No such file or directory in Unknown on line 0

执行:

sudo cp /usr/local/lib/libphpx.so /usr/lib/

即可解决。

这不是一个好方案,建议将/usr/local/lib加入ld.conf配置中。

Starting php-fpm [15-Jun-2017 05:34:02] NOTICE: PHP message: PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'libphpx.so' in Unknown on line 0


Warning: PHP Startup: Invalid library (maybe not a PHP library) 'libphpx.so' in Unknown on line 0

done

52fhy commented

编译示例里的cpp_ext扩展简单流程:

1、编译PHP7
2、将PHP-X clone后放到PHP源码根目录 
3、先编译安装 php-x,会生成libphpx.so
4、再编译cpp_ext扩展,生成cpp_ext.so
5、`sudo cp /usr/local/lib/libphpx.so /usr/lib/`或者将`/usr/local/lib`加入ld.so.conf配置中,然后执行`ldconfig`更新/etc/ld.so.cache 文件。  

把libphpx.so拷贝到/usr/lib/ 下还是会报那个错额
用韩老大说的那种方式可行