Home  >  Article  >  Backend Development  >  How to reinstall php on centos

How to reinstall php on centos

藏色散人
藏色散人Original
2020-10-07 00:52:223437browse

How to reinstall php in centos: first delete all php related directories through the command "rm -rf /usr/local/php..."; then use the source code package to recompile and install php.

How to reinstall php on centos

Recommended: "PHP Video Tutorial"

Description: The system originally installed php7.1.0 through source code. I have found many ways to completely delete the original PHP on the Internet. When I execute the command php -v, the PHP version information is always there, but the explanation methods are useless. I boldly made the following attempt and successfully recompiled php

find php

find / -name php

# #There is also the /usr/local/etc/php directory

So I simply deleted all php related directories

rm -rf /usr/local/php
rm -rf /usr/local/etc/php
ps aux | grep php-fpm
kill [进程]

At this time, I can no longer see it when I execute php -v

Connect Come down and use the source code package to recompile and install PHP normally. Success!

wget http://cn2.php.net/distributions/php-5.6.5.tar.gz 
tar -xvzf  php-5.6.5.tar.gz

The following is the configuration when I compile php

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --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-libxml --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

Special instructions:When compiling ./configure...., there are some The error message basically indicates that some services are not installed. Just post the error message to Baidu and use yum to install some services. Until there is no error prompt

When the reinstalled php executes php -v, it may report: command not found. At this point you only need to execute

// /usr/local/php/bin为php安装目录
export PATH=$PATH:/usr/local/php/bin即可

The above is the detailed content of How to reinstall php on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn