/******************************************************************** * buildroot httpd php * 说明: * 在buildroot中选择了php,但是在测试的时候发现总是出现下面这行 * 错误,库是存在的,但是却没有放对正确的位置,通过创建软链接解决。 * * 2016-9-22 深圳 南山平山村 曾剑锋 *******************************************************************/ 一、参考文档: error while loading shared libraries: libmysqlclient.so.16/18: cannot open shared object file http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=25135004&id=3012725 二、报错: php: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory 三、原因: 找不到libmysqlclient.so.16,通过find命令使能找到的。 四、解决办法: 在能找到的库目录下创建软链接就行了。 五、操作流程: # find . -iname php ./usr/bin/php ./usr/lib/php # LD_TRACE_LOADED_OBJECTS=1 /usr/bin/php libcrypt.so.1 => /lib/libcrypt.so.1 (0x76f9c000) libdl.so.2 => /lib/libdl.so.2 (0x76f8f000) libreadline.so.6 => /usr/lib/libreadline.so.6 (0x76f53000) libncurses.so.5 => /usr/lib/libncurses.so.5 (0x76f1e000) libmysqlclient.so.16 => not found libnsl.so.1 => /lib/libnsl.so.1 (0x76f00000) libm.so.6 => /lib/libm.so.6 (0x76e59000) libz.so.1 => /usr/lib/libz.so.1 (0x76e3f000) libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x76ce8000) libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x76c8f000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x76b80000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76b57000) libc.so.6 => /lib/libc.so.6 (0x76a17000) /lib/ld-linux.so.3 (0x76fd5000) # find . -iname libmysqlclient.so.16 ./usr/lib/mysql/libmysqlclient.so.16 # ln -s /usr/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16 # LD_TRACE_LOADED_OBJECTS=1 /usr/bin/php libcrypt.so.1 => /lib/libcrypt.so.1 (0x76f17000) libdl.so.2 => /lib/libdl.so.2 (0x76f0a000) libreadline.so.6 => /usr/lib/libreadline.so.6 (0x76ece000) libncurses.so.5 => /usr/lib/libncurses.so.5 (0x76e99000) libmysqlclient.so.16 => /usr/lib/libmysqlclient.so.16 (0x76e2d000) libnsl.so.1 => /lib/libnsl.so.1 (0x76e0f000) libm.so.6 => /lib/libm.so.6 (0x76d68000) libz.so.1 => /usr/lib/libz.so.1 (0x76d4e000) libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x76bf7000) libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x76b9e000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x76a8f000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76a66000) libc.so.6 => /lib/libc.so.6 (0x76926000) /lib/ld-linux.so.3 (0x76f50000) 六、测试代码: 1. busybox httpd /etc/httpd.conf配置: I:index.php *.php:/usr/bin/php-cgi 2. index.php代码: <html> <head> </head> <body> <h1>zengjf</h1> <?php // 最好加上php,有可能不解析 echo "zengjf"; ?> <? // 这里能不能解析要看/etc/php.ini中的short_open_tag是否是on状态 echo system("ls /"); ?> <? phpinfo(); ?> </body> </html>
时间: 2024-10-09 01:56:06