源码安装php7.2
2024-09-01 18:36:43
`# 安装依赖包
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel \
openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
`# 下载源码包
wget -c http://mirrors.sohu.com/php/php-7.2.13.tar.gz
`# 解压
tar -xzvf php-7.2.13.tar.gz
cd php-7.2.13
`# 预编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php \
--enable-mbstring --with-openssl --enable-ftp --with-gd --with-jpeg-dir=/usr \
--with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--with-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr \
--with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib \
--with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
`# 编译并安装
make && make install
`# 拷贝配置文件和启动脚本
cp php.ini-development /usr/local/php/etc/php-fpm.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /root/php-7.2.25/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod o+x /etc/init.d/php-fpm
`# 将php服务加入systemctl
`#(1)自定义添加启动服务文件
vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
[Install]
WantedBy=multi-user.target
`#(2)添加环境变量
export PATH="$PATH:/usr/local/php/sbin"
`#(3)在php.ini解析文件中加入
vim /usr/local/php/etc/php.ini
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/opcache.so
最新文章
- Android 监听ScrollView的滑动
- jquery from提交和post提交
- easyui datagrid json 格式
- 转载:iOS 推送的服务端实现
- java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/TextUtils
- AlgorithmsI Programming Assignment 1: PercolationStats.java
- Stack-overflow, how to answer
- Amazon Aurora解读(SIGMOD 2017)
- C语言控制流语句
- [TFRecord格式数据]利用TFRecords存储与读取带标签的图片
- java之静态代理和动态代理
- aix 6.1系统怎么安装?这里有详细图文教程
- Navicat如何导出Excel格式表结构
- WinForm DataGridView 绑定泛型List(List<;T>;)/ArrayList不显示的原因和解决
- Content Security Policy介绍
- Elasticsearch 5.4.3实战--Java API调用:索引mapping创建
- Python游戏编程(Pygame)
- PHP基础架构
- java 数据类型和运算符
- OC,nil,NULL,Nil,kCFNull