发布网友 发布时间:2022-04-06 02:56
共2个回答
懂视网 时间:2022-04-06 07:18
centos7删除php的方法:首先查看当前php已安装的包;然后通过命令“yum remove php71w-common”卸载几个名为common的包即可。
推荐:《PHP视频教程》
查看当前php已安装的包
rpm -qa|grep php
会出现很多php相关包。
基本只需要卸载几个名为common的包即可,其他同版本依赖会被全部删除,删除php71w-common,71w版本的依赖包全部会被删除。
例如
yum remove php71w-common yum remove php74w-common
最后还会剩几个runtime包,同样yum remove 即可
当然可以最开始试试 yum remove php*,我尝试了一下,没成功完全卸载。
热心网友 时间:2022-04-06 04:26
CentOS 5/get/php-5.3.6.tar.bz2/from/this/mirror# tar -xjf php-5.3.6.tar.bz2配置安装参数./configure --build=i686-RedHat-linux-gnu --host=i686-redhat-linux-gnu --target=i686-RedHat-linux-gnu --with-apxs2=/usr/sbin/apxs --prefix=/usr/local --exec-prefix=/usr/local --with-exec-dir=/usr/local/bin --sysconfdir=/etc --libdir=/usr/local/lib/php --with-libdir=lib --sbindir=/usr/local/sbin --sharedstatedir=/usr/com --datadir=/usr/local/share --includedir=/usr/local/include --libexecdir=/usr/local/libexec --localstatedir=/var --cache-file=../config.cache --mandir=/usr/local/share/man --infodir=/usr/local/share/info --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-pic --with-curl=shared --with-freetype-dir --with-png-dir --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-png-dir --with-openssl --with-layout=GNU --with-libxml-dir --with-pcre-regex=/usr --with-mcrypt=shared --with-mhash --with-zlib --with-bz2=shared --with-pdo-mysql --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pgsql --with-pdo-pgsql --with-sqlite=shared --with-pdo-sqlite=shared --enable-sqlite-utf8 --with-kerberos --with-imap --with-imap-ssl --with-pear --with-gd --enable-gd-native-ttf --enable-calendar=shared --enable-exif --enable-ftp --enable-sockets --enable-bcmath --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-intl --enable-mbstring --enable-zend-multibyte --enable-zip --without-unixODBC --disable-tokenizer 非RHEL/CentOS系统可以省略 --build,--host,--target 参数,程序会自动判断(linux一般为i686-pc-linux-gnu)。如果没安装pgsql或者不需要pgsql的支持可以删除相关参数(共2个)。 bz2, calendar, curl, mcrypt, pdo_sqlite, sqlite 这些模块采用动态编译,可采用下面将会提到的方法加载。编译并安装# make && make install安装结果摘要,里面有几个主要的安装路径变量libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.3.6/libs[activating mole `php5 in /etc/httpd/conf/httpd.conf]Installing PHP CLI binary: /usr/local/bin/Installing PHP CLI man page: /usr/local/share/man/man1/Installing shared extensions: /usr/local/lib/php/20090626/Installing build environment: /usr/local/lib/php/build/Installing header files: /usr/local/include/php/Installing helper programs: /usr/local/bin/program: phpizeprogram: php-configInstalling man pages: /usr/local/share/man/man1/Installing PEAR environment: /usr/local/share/pear/貌似要运行一次libtool --finish ....,不过我运行后也没什么奇特效果~更新httpd配置文件以便apache能解析php文件# vim /etc/httpd/conf/httpd.conf添加以下内容AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps如果在卸载原有PHP之前没备份php.ini文件,那么可以从PHP编译目录中把 php.ini-proction 拷贝到 /etc目录下并改名为 php.ini# mv /usr/local/src/php-5.3.6/php.ini-proction /etc/php.ini添加或者更新相关设置,比如:extension_dir = "/usr/local/lib/php/20090626"# 以下六个模块可根据需要添加extension = bz2.soextension = calendar.soextension = curl.soextension = mcrypt.soextension = pdo_sqlite.soextension = sqlite.somax_execution_time = 30max_input_time = 60 memory_limit = 128M variables_order = "EGPCS"register_globals = Offregister_long_arrays = Offpost_max_size = 30Mupload_max_filesize = 30Mmbstring.internal_encoding = UTF-8date.timezone = Asia/Chongqing测试结果。在 /var/www/html 下面新建一个文件 phpinfo.php ,里面包含内容Php代码<?php phpinfo(); ?> 重启apache服务# service httpd restart