
groupadd httpd
useradd -g httpd httpd
yum install libxml2 -y
yum install libxml2-devel -y
yum install libcurl-devel -y
yum -y install libjpeg-devel libpng-devel
//字体
yum install freetype-devel -y
yum -y install openssl openssl-devel
yum -y install php-mcrypt limcrypt libmcrypt-devel
tar -zxvf php-7.0.1.tar.gz
./configure --prefix=/usr/local/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --with-fpm-user=httpd --with-fpm-group=httpd --with-pdo-mysql --with-mysqli --with-mcrypt=/usr/local/ --enable-opcache=no
make &&make install
配置环境变量
export PATH=$PATH:/usr/local/php/bin
export PATH=$PATH:/usr/local/php/sbin
然后立马生效,执行
source /etc/profile
cp php.ini-production /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
修改php.ini
vi /usr/local/php/lib/php.ini
date.timezone = "Asia/Shanghai"
一 PHP intl 是国际化扩展,是ICU 库的一个包装器。所以在安装PHP intl扩展前要先安装ICU库,安装ICU库的具体步骤::
二 安装intl扩展
1:进入php7.2.5源码:
2:运行:phpize ,找不到命令时,将路径补全:/usr/local/php7/bin/phpize(是php的安装路径),出现如下:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
3:运行配置
./configure --enable-intl --with-icu-dir=/usr/local/icu/ --with-php-config=/usr/local/php7/bin/php-config
注:前面路径为icu的安装路径,后面路径为php的安装路径。
4:编译扩展:make
5:复制扩展到目标文件夹
cp /user/local/php/php7.2.5/ext/intl/modules/intl.so /user/local/php7/lib/php/extensions/no-debug-non-zts-20170718
注意:也可以find / -name intl.so 查找。
6:设置扩展加入配置文件中:
[intl]
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/"
extension=intl.so
大坑:::采用phpinfo()时,无法找到配置的intl扩展,说明配置没有生效。。。。。。
原因:在编译php时没有 --with-config-file-path=PATH 指定php.ini路径,默认的路径为/usr/local/php7/lib,只需要将php.ini放入这个默认的路径即可。你也可以安装配置php时加入,如下:
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath -enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --enable-pcntl --with-curl --with-fpm-user=nginx --enable-ftp --enable-session --enable-xml --with-apxs2=/usr/bin/apxs
访问:index.php中phpinfo()文件。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)