linux yum安装php7.3

linux yum安装php7.3,第1张

安装前面的教程,再安装后面的

参考教程1:

https://blog.csdn.net/weixin_43731793/article/details/91488289

参考教程2:

http://www.bubuko.com/infodetail-2931909.html

安装PHP

1、安装PHP73

1.1、卸载旧版本PHP

yum remove php*

1.2、安装EPEL:

sudo yum install epel-release

1.3、安装remi(选一个):

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

1.4、查看目前有php的什么版本(可忽略

sudo yum list php*

1.5、列出所有的php相关的rpm包(可忽略)

rpm -qa|grep php

1.6、删除php相关的rpm包(一次只能删除一个)(可忽略)

rpm -e php72w-mysqlnd-7.2.17-1.w7.x86_64

1.7、列出remi仓库下所有PHP7.3可用模块。(可忽略)

yum --enablerepo=remi-php73 search php | grep php73

1.8、安装PHP 7.3

yum --enablerepo=remi-php73 install php

1、安装 PHP7.3:

(解决yum安装apache关联不了PHP的问题,用以下命令安装)

yum --enablerepo=remi-php73 install php

安装模块

yum --enablerepo=remi-php73 install php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml

2、设置开机启动、运行服务:

systemctl enable php73-php-fpm

systemctl start php73-php-fpm

3、查找php.ini位置:

find /etc/opt/remi/php73 -name php.ini

/etc/opt/remi/php73/php.ini

找到apache的配置文件:httpd.conf

sudo find / -name httpd.conf

位置如下:

/etc/httpd/conf/httpd.conf

5、PHP日常 *** 作

systemctl restart php73-php-fpm #重启

systemctl start php73-php-fpm #启动

systemctl stop php73-php-fpm #关闭

systemctl status php73-php-fpm #检查状态

php -m #查看PHP已安装拓展模块

php -v #查看PHP版本

# yum remove httpd* php*

增加额外资源库

默认情况下,CentOS的官方资源是没有php-fpm的, 但我们可以从Remi的RPM资源中获得,它依赖于EPEL资源。我们可以这样增加两个资源库:

[plain] view plain copy

# yum install yum-priorities -y

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

yum -y install gcc-c++

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"


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/6114344.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-15
下一篇2023-03-15

发表评论

登录后才能评论

评论列表(0条)

    保存