Linux 安装OpenSSL出错的解决方法
以前编译php没有 –with–openssl 现在要使用到 openssl ,phpinze扩展安装,但是在make时候报错
今天找这个在网上找了大半天,最后总结应该是php版本本身的问题,错误是php编译好后,通过phpize单独添加时候报错的内容
推荐阅读:
生产环境实用之LNMP架构的编译安装+SSL加密实现 http://www.linuxidc.com/Linux/2013-05/85099.htm
LNMP 全功能编译安装 for CentOS 6.3笔记 http://www.linuxidc.com/Linux/2013-05/83788.htm
CentOS 6.3 安装LNMP (PHP 5.4,MyySQL5.6) http://www.linuxidc.com/Linux/2013-04/82069.htm
在部署LNMP的时候遇到Nginx启动失败的2个问题 http://www.linuxidc.com/Linux/2013-03/81120.htm
Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm
《细说PHP》高清扫描PDF+光盘源码+全套教学视频 http://www.linuxidc.com/Linux/2014-03/97536.htm
问题: /usr/local/src/php-5.2.6/ext/openssl/openssl.c:229: error: expected specifier-qualifier-list before ‘LHASH’ /usr/local/src/php-5.2.6/ext/openssl/openssl.c:410: error: expected declaration specifiers or ‘…’ before ‘LHASH’ /usr/local/src/php-5.2.6/ext/openssl/openssl.c: In function ‘php_openssl_config_check_syntax’: /usr/local/src/php-5.2.6/ext/openssl/openssl.c:416: error: ‘config’ undeclared (first use in this function) /usr/local/src/php-5.2.6/ext/openssl/openssl.c:416: error: (Each undeclared identifier is reported only once /usr/local/src/php-5.2.6/ext/openssl/openssl.c:416: error: for each function it appears in.) /usr/local/src/php-5.2.6/ext/openssl/openssl.c: In function ‘add_oid_section’: /usr/local/src/php-5.2.6/ext/openssl/openssl.c:435: error: ’struct php_x509_request’ has no member named ‘req_config’ /usr/local/src/php-5.2.6/ext/openssl/openssl.c:439: error: ’struct php_x509_request’ has no member named ‘req_config’
解决思路
php5.2.5 php5.2.6 php5.2.8 php5.3.0
php安装好后在独立安装openssl扩展会有问题,推荐使用php5.2.17 wget http://museum.php.net/php5/php-5.2.17.tar.gz
这个是经过测试的出来的结果
安装过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 | #下面是php的安装目录 /usr/local/php5/bin/ #切换到php安装目录的 etx/openssl目录 cd /php-5.2.17/ext/openssl #查看openssl目录下有个config0.m4,把config0.m4改名为config.m4。 cp config0.m4 config.m4 #依次执行: /usr/local/php5/bin/phpize ./configure –with-openssl –with-php-config=/usr/local/php5/bin/php-config make && make install #然后找到php.ini所在位置 打开 extension_dir(如果没有则自行添加), 同时添加 extension = “openssl.so” |
#重启服务器 即可
#openssl 查看方法: /usr/local/php5/bin/php -m |grep openssl
OpenSSL 的详细介绍:请点这里 OpenSSL 的下载地址:请点这里
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
原文地址:http://www.linuxidc.com/Linux/2014-04/100486.htm
通过nginx安装OpenSSL:http://inotgaoshou.iteye.com/blog/962946(未亲测)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!