安装PHP5 PHP7
2024-08-26 07:46:07
安装 PHP5
PHP官网www.php.net
• 当前主流版本为5./7.1
• cd /usr/local/src/
• wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
• tar zxvf php-5.6..tar.gz
• cd php-5.6.
• ./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-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--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 --enable-exif • 问题1
configure: error: xml2-config not found. Please check your libxml2 installation.
[root@centos7 php-5.6.]# yum list |grep xml2
[root@centos7 php-5.6.]# yum install -y libxml2-devel.x86_64 • 问题2
configure: error: Cannot find OpenSSL's <evp.h>
[root@centos7 php-5.6.]# yum install -y openssl-devel • 问题3
configure: error: Please reinstall the BZip2 distribution
[root@centos7 php-5.6.]# yum install -y bzip2-devel • 问题4
configure: error: jpeglib.h not found.[root@centos7 php-5.6.]# yum install -y libjpeg-devel • 问题5
configure: error: png.h not found.
[root@centos7 php-5.6.]# yum install -y libpng-devel • 问题6
configure: error: freetype-config not found.
[root@centos7 php-5.6.]# yum install -y freetype-devel • 问题7
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
安装epel扩展源[root@centos7 php-5.6.]# yum install -y epel-release
[root@centos7 php-5.6.]# yum install -y libmcrypt-devel • make && make install • php二进制文件 /usr/local/php/bin/php • 配置文件[root@centos7 php-5.6.]# cp php.ini-production /usr/local/php/etc/php.ini
• cp php.ini-production /usr/local/php/etc/php.ini
• php配置信息[root@centos7 php-5.6.]# /usr/local/php/bin/php -i |less
安装php7
• cd /usr/local/src/
• wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
• tar jxvf php-7.1..tar.bz2
• cd php-7.1.
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2./bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --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 --enable-exif
• make && make install
• ls /usr/local/apache2./modules/libphp7.so
• 查看php加载的模块[root@centos7 php-7.1.]# /usr/local/php7/bin/php -m
• cp php.ini-production /usr/local/php7/etc/php.ini
• apacha使用哪一个PHP?
编辑配置文件: vim /usr/local/apache2./conf/httpd.conf
搜索php,不想用哪个php版本 注释掉即可。
最新文章
- c#批量插入数据库Demo
- 繁星——jquery的data()方法
- mysql 查询优化
- 移位运算符(JAVA)
- 第一个WP8程序,照相机
- cocos基础教程(11)事件分发机制
- OpenStack 的windows镜像的开启办法
- Python的数据处理学习(二)
- javascript 库
- Linux 脚本整理
- react native ios打包到真机
- MYSQL数据库-约束
- centos命令自动补全增强
- 【译】.NET Core 3.0 中的新变化
- 特征选择 (feature_selection)
- 工作笔记-table问题汇总(vue单文件组件)
- individual project1 12061183
- Nginx负载均衡中后端节点服务器健康检查的一种简单方式
- 简单示例用例(Simple Example Use Cases)--hive GettingStarted用例翻译
- 利用crontab定时备份nginx访问日志(也可以说是定时切分日志)