centos下安装php
admin
2023-02-11 16:00:07
0

cd /usr/local/src/

wget  http://cn2.php.net/get/php-5.4.36.tar.bz2/from/this/mirror

mv mirror php-5.4.36.tar.bz2

tar jxf php-5.4.36.tar.bz2
cd php-5.4.36
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets 


yum -y install libxml2-devel openssl openssl-devel  bzip2 bzip2-devel  libpng libpng-devel libjpeg libjpeg-devel freetype freetype-devel  install autoconf libmcrypt-devel  install perl gcc curl-devel

以下为遇到的报错信息及解决办法:

报错:

./configure: /usr/local/apache2/bin/apxs: /replace/with/path/to/perl/interpr 

解决方法:

yum -y install perl

vi /usr/local/apache/bin/apxs 

#!/replace/with/path/to/perl/interpreter -w 更改成 #!/usr/bin/perl即可。

报错:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决办法是:
yum install -y libxml2-devel
还有错误:
configure: error: Cannot find OpenSSL's
解决办法是:
yum install -y openssl openssl-devel
错误:
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
解决办法:
yum install -y bzip2 bzip2-devel
错误:
configure: error: png.h not found.
解决办法:
yum install -y libpng libpng-devel
错误:
configure: error: jpeglib.h not found.
解决办法:
yum install -y libjpeg libjpeg-devel
错误:
configure: error: freetype.h not found.
解决办法:
yum install -y freetype freetype-devel
错误:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:
rpm -ivh "http://www.aminglinux.com/bbs/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm"
yum install -y  libmcrypt-devel


安装 yum -y install autoconf

make
echo $?
make install
cp php.ini-production /usr/local/php/etc/php.ini
ls /usr/local/php/
ls /usr/local/apache2/modules/

/usr/local/php/bin/php -m(静态模块)

/usr/local/php/bin/php -i (配置文件)

注:动态模块需要自己编译


相关内容

热门资讯

上海AI产业交答卷:以生态之力... 上海人工智能产业交答卷:真实产线上淬炼硬核能力 聚合产业推进中国算力体系化 以生态之力,加速AI拐点...
“郑州造”光伏清洁机器人即将交... 7月22日,郑州航空港经济综合实验区坤达产业园内,两台C1光伏清洁机器人正在进行交付前的最后测试。作...
腾讯整合Workbuddy与Q... 快科技7月21日消息 ,据媒体报道,腾讯近日发布内部组织调整通知,将 QClaw产品中心全部相关业务...
TVB正式更名,宣布由传统电视... 7月24日,@TVB官方微博发文官宣TVB更名“无线集团”,TVB表示,由传统电视台升级为跨媒体娱乐...
2026WAIC观察丨白辰甲:... 图片来源/新华社 ■中国经济时报记者 张一鸣 王彩娜 在人工智能浪潮下,具身智能的演变之路也在加速。...
澳大利亚工党大会上,中方官员愤... 据澳大利亚广播公司(ABC)7月23日报道,中国外交官因不满台湾地区代表出席澳大利亚工党(ALP)在...
裸体在家犯法还是拍别人裸照犯法... 近日,#男子在家裸体被邻居拍照发群#一事引发热议。据报道,某小区一名男业主在家中未穿衣物,对面女业主...
“每天跟遛狗一样”,万亿资金,... 进入7月,市场波动加大,A股关于量化交易的争议再次达到顶峰。由于散户与量化机构之间的“体感温差”显著...
特朗普:对伊朗战争进展顺利 当地时间7月23日,美国总统特朗普再次称,“美国在对抗伊朗方面进展很顺利,表现得极其出色,好得超乎任...
国务院成立广西六蓝水库溃坝灾害... 7月6日,广西南宁横州市六蓝水库发生溃坝,造成重大人员伤亡。根据国家有关法律法规规定,国务院成立调查...