开发者社区> 问答> 正文

php5.6编译生成libphp5.so的问题求助?报错

之前php的编译参数如下,版本是5.6.17

./configure 
--prefix=/usr/local/php 
--with-config-file-path=/usr/local/php/etc 
--enable-fpm 
--with-fpm-user=php-fpm 
--with-fpm-group=php-fpm 
--with-mysql=mysqlnd 
--with-mysql-sock=/tmp/mysql.sock 
--with-libxml-dir 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-freetype-dir 
--with-iconv-dir 
--with-zlib-dir 
--with-mcrypt=/usr/local/libmcrypt
--enable-soap 
--enable-gd-native-ttf 
--enable-ftp     
--enable-mbstring 
--enable-exif 
--disable-ipv6 
--with-pear 
--with-curl 
--with-openssl
编译通过并成功安装了,

现在我想生成libphp5.so,httpd已经安装了,apxs在/usr/sbin/apxs

我到php源码目录下

执行./configure  --with-apxs2=/usr/sbin/apxs

没报错,然后make

出现如下错误

l2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o sapi/cli/php
ext/phar/.libs/util.o: In function `phar_create_signature':
/usr/local/src/php-5.6.17/ext/phar/util.c:1860: undefined reference to `BIO_new_mem_buf'
/usr/local/src/php-5.6.17/ext/phar/util.c:1869: undefined reference to `PEM_read_bio_PrivateKey'
/usr/local/src/php-5.6.17/ext/phar/util.c:1870: undefined reference to `BIO_free'
/usr/local/src/php-5.6.17/ext/phar/util.c:1879: undefined reference to `EVP_MD_CTX_create'
/usr/local/src/php-5.6.17/ext/phar/util.c:1881: undefined reference to `EVP_PKEY_size'
/usr/local/src/php-5.6.17/ext/phar/util.c:1884: undefined reference to `EVP_sha1'
/usr/local/src/php-5.6.17/ext/phar/util.c:1884: undefined reference to `EVP_DigestInit'
/usr/local/src/php-5.6.17/ext/phar/util.c:1893: undefined reference to `EVP_DigestUpdate'
/usr/local/src/php-5.6.17/ext/phar/util.c:1902: undefined reference to `EVP_SignFinal'
/usr/local/src/php-5.6.17/ext/phar/util.c:1911: undefined reference to `EVP_MD_CTX_destroy'
ext/phar/.libs/util.o: In function `phar_verify_signature':
/usr/local/src/php-5.6.17/ext/phar/util.c:1533: undefined reference to `EVP_sha1'
/usr/local/src/php-5.6.17/ext/phar/util.c:1590: undefined reference to `BIO_new_mem_buf'
/usr/local/src/php-5.6.17/ext/phar/util.c:1600: undefined reference to `PEM_read_bio_PUBKEY'
/usr/local/src/php-5.6.17/ext/phar/util.c:1601: undefined reference to `BIO_free'
/usr/local/src/php-5.6.17/ext/phar/util.c:1611: undefined reference to `EVP_DigestInit'
/usr/local/src/php-5.6.17/ext/phar/util.c:1623: undefined reference to `EVP_DigestUpdate'
/usr/local/src/php-5.6.17/ext/phar/util.c:1631: undefined reference to `EVP_VerifyFinal'
/usr/local/src/php-5.6.17/ext/phar/util.c:1642: undefined reference to `EVP_MD_CTX_cleanup'
/usr/local/src/php-5.6.17/ext/phar/util.c:1633: undefined reference to `EVP_MD_CTX_cleanup'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1

该怎么解决啊?



展开
收起
爱吃鱼的程序员 2020-06-10 14:58:36 921 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    顶!上去<atarget="_blank"rel="nofollow">http://my.oschina.net/eechen/blog/411534
    configure_php.sh
    #!/bin/bash
    ./configure<br>--prefix=/png/php/7.0.0<br>--enable-opcache<br>--enable-fpm<br>--enable-pdo<br>--enable-sockets<br>--enable-exif<br>--enable-soap<br>--enable-ftp<br>--enable-wddx<br>--enable-pcntl<br>--enable-soap<br>--enable-bcmath<br>--enable-mbstring<br>--enable-dba<br>--enable-gd-native-ttf<br>--enable-gd-jis-conv<br>--enable-zip<br>--enable-calendar<br>--enable-shmop<br>--enable-sysvmsg<br>--enable-sysvsem<br>--enable-sysvshm<br>--with-mysqli<br>--with-pdo-mysql<br>--with-pdo-sqlite<br>--with-iconv<br>--with-gmp<br>--with-pspell<br>--with-xmlrpc<br>--with-openssl<br>--with-mhash<br>--with-mcrypt<br>--with-xsl<br>--with-curl<br>--with-pcre-regex<br>--with-gd<br>--with-jpeg-dir=/usr<br>--with-png-dir=/usr<br>--with-zlib-dir=/usr<br>--with-xpm-dir=/usr<br>--with-freetype-dir=/usr<br>--with-gettext=/usr<br>--with-zlib=/usr<br>--with-bz2=/usr<br>--with-recode=/usr<br>--with-ldap<br>--with-pear<br>--with-readline<br>--with-fpm-user=png<br>--with-fpm-group=png<br>--with-apxs2=/png/httpd/2.4.12P/bin/apxs
    其中--with-apxs2是用来生成Apache的PHP模块libphp7.so的,不需要可以去掉.
    很多参数,phper用知道每一项的意思吗makeclean后,再configure,make...靠,还真行回复<atarget="_blank"rel="nofollow">@hphper:./configure--help就能看到这些配置项的说明.其实大部分对应的就是PHP源代码ext下的各个扩展.--enable开头的表示这个扩展不依赖第三方的库,典型的如--enable-opcache.--with开头的表示这个扩展依赖第三方的库,像--with-curl就依赖第三方的libcurl库,系统需要安装这个库的开发包(头文件,共享库so文件,静态库a文件)才能通过configure配置.有些扩展你不一定会用得上,比如:
    sudoapt-getinstallapache2php5php5-mysqlndphp5-gdmysql-server
    就可以正常跑Discuz!/WordPress等应用了,可见PHP默认configure就编译了大部分我们常用的库.以后有些扩展库需要使用,还可以phpize/configure/make进行编译安装,这时生成的扩展库是so共享库,需要在php.ini显式载入.

    2020-06-10 14:58:52
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
阿里云栖开发者沙龙PHP技术专场-直面PHP微服务架构挑战-高驰涛 立即下载
PHP安全开发:从白帽角度做安全 立即下载
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载