在CentOS上安装PHP5、卸载PHP、安装PHP7的教程
安装PHP5
1、我们需要更新系统软件包,在终端中输入以下命令:
sudo yum update
2、接下来,我们安装EPEL(Extra Packages for Enterprise Linux)仓库,EPEL仓库包含了许多额外的软件包,包括PHP5,在终端中输入以下命令:
sudo yum install epel-release
3、现在,我们可以安装PHP5了,在终端中输入以下命令:
sudo yum install php php-mysql
4、安装完成后,我们可以通过运行以下命令来检查PHP是否已成功安装:
php -v
卸载PHP5
1、要卸载PHP5,我们需要先停止Apache或Nginx服务,在终端中输入以下命令:
sudo systemctl stop httpd
或者
sudo systemctl stop nginx
2、我们可以使用yum remove命令来卸载PHP5,在终端中输入以下命令:
sudo yum remove php php-mysql
3、重新启动Apache或Nginx服务,在终端中输入以下命令:
sudo systemctl start httpd
或者
sudo systemctl start nginx
安装PHP7
1、我们需要添加Remi仓库,在终端中输入以下命令:
sudo wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm -O /etc/yum.repos.d/remi-release-7.repo
2、接下来,我们安装Remi仓库中的PHP7,在终端中输入以下命令:
sudo yum install yum-utils http://rpms.remirepo.net/enterprise/remi-release-7.rpm remi-release-7-rhel7 remi-php70 remi-php70-php remi-php70-php-fpm remi-php70-php-mysqlnd remi-php70-php-opcache remi-php70-php-mbstring remi-php70-php-xml remi-php70-php-pear remi-php70-php-gd remi-php70-php-pecl remi-php70-php-devel remi-php70-php-cli remi-php70-php-common remi-php70-php-bcmath remi-php70-php-json remi-php70-php-intl remi-php70-php-ldap remi-php70-php-zip remi-php70-php-soap curl unzip zip gcc make autoconf libtool patch bison openssl pcre pcre2 pcre2-devel zlib zlib1g zlib1g-devel libxml2 libxml2-devel libcurl libcurl4 libcurl4-openssl libcurl4-gnutls libjpeg libjpeg62 libjpeg62-turbo libpng libpng12 libpng12-devel freetype freetype2 freetype2-devel libmcrypt libmcrypt4 libmcrypt4_devel libtidy libtidy5 libtidy5devel libxslt libxslt1 libxslt1_devel libidn libidn11 libidn11_devel libonig libonig2 libonig2_devel libzip libzip4 libzip4_devel gettext gettext8 gettext8_devel ncurses ncurses6 ncurses6_devel readline readline6 readline6_devel gdb mhash bzip2 bzip2_devel openldap openldap24 openldap24_clients openldap24_servers openldap24_devel mod_ssl mod_perl mod_perl2 mod_perl2_doc perl perl5 perl5_devel perl5_cgi perl5_mod_perl perl5_mod_pods perl5_mod_ssl perl5_mod_tls perl5_tk xz xz_devel db4 db4_utils db4_devel db4_odbc db4_odbc_driver unixODBC unixODBC99 unixODBC99_driver postgresql postgresql93 postgresql93_server postgresql93_contrib postgresql93_devel mariadb mariadb100 mariadb100_server mariadb100_client mariadb100_devel mysql56 mysql56_server mysql56_client mysql56_devel nginx nginx18 nginx18_upstream_module nginx18_http_auth_pam nginx18_http_geoip nginx18_http_imagefilter nginx18_http_realip nginx18_http_secure_link nginx18_http_subdomains nginx18_http_xslt_filter nginx18_mail nginx18_stream nghttp2 nghttp2 nghttp2_devel memcached memcached memcached1 memcached1a memcached1b memcached1b_devel memcached1a memcached1a_devel memcached1b memcached1b_devel memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memcached pecl memsaturated opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opcache opachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopachetopacheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopcheopche
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/329782.html