How to reinstall php on centos

藏色散人
Release: 2023-03-06 13:22:01
Original
3594 people have browsed it

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 [进程]
Copy after login

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
Copy after login

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
Copy after login

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即可
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template