您好,欢迎访问一九零五行业门户网

centos yum怎么安装php5.4

centos yum安装php5.4的方法:1、检查当前系统是否已经安装php;2、查看yum是否有可安装的php软件;3、通过“yum install php”安装php即可。
本文操作环境:centos 7.4.1708系统、php5.4版、dell g3电脑
centos yum怎么安装php5.4?
centos 7.4 使用yum源安装php 5.4.16
一、检查当前系统是否已经安装php
[root@localhost ~]# rpm -qa php
二、查看yum是否有可安装的php软件
[root@localhost ~]# yum list | grep phpgraphviz-php.x86_64 2.30.1-19.el7 basephp.x86_64 5.4.16-43.el7_4 updatesphp-bcmath.x86_64 5.4.16-43.el7_4 updatesphp-cli.x86_64 5.4.16-43.el7_4 updatesphp-common.x86_64 5.4.16-43.el7_4 updatesphp-dba.x86_64 5.4.16-43.el7_4 updatesphp-devel.x86_64 5.4.16-43.el7_4 updatesphp-embedded.x86_64 5.4.16-43.el7_4 updatesphp-enchant.x86_64 5.4.16-43.el7_4 updatesphp-fpm.x86_64 5.4.16-43.el7_4 updatesphp-gd.x86_64 5.4.16-43.el7_4 updatesphp-intl.x86_64 5.4.16-43.el7_4 updatesphp-ldap.x86_64 5.4.16-43.el7_4 updatesphp-mbstring.x86_64 5.4.16-43.el7_4 updatesphp-mysql.x86_64 5.4.16-43.el7_4 updatesphp-mysqlnd.x86_64 5.4.16-43.el7_4 updatesphp-odbc.x86_64 5.4.16-43.el7_4 updatesphp-pdo.x86_64 5.4.16-43.el7_4 updatesphp-pear.noarch 1:1.9.4-21.el7 basephp-pecl-memcache.x86_64 3.0.8-4.el7 basephp-pgsql.x86_64 5.4.16-43.el7_4 updatesphp-process.x86_64 5.4.16-43.el7_4 updatesphp-pspell.x86_64 5.4.16-43.el7_4 updatesphp-recode.x86_64 5.4.16-43.el7_4 updatesphp-snmp.x86_64 5.4.16-43.el7_4 updatesphp-soap.x86_64 5.4.16-43.el7_4 updatesphp-xml.x86_64 5.4.16-43.el7_4 updatesphp-xmlrpc.x86_64 5.4.16-43.el7_4 updatesrrdtool-php.x86_64 1.4.8-9.el7 baseuuid-php.x86_64 1.6.2-26.el7 base
三、安装php
[root@localhost ~]# yum install php
四、查看版本及支持的扩展
[root@localhost ~]# php -vphp 5.4.16 (cli) (built: nov 15 2017 16:33:54)copyright (c) 1997-2013 the php groupzend engine v2.4.0, copyright (c) 1998-2013 zend technologies
[root@localhost ~]# php -m[php modules]bz2calendarcorectypecurldateeregexiffileinfofilterftpgettextgmphashiconvjsonlibxmlmhashopensslpcntlpcrepharreadlinereflectionsessionshmopsimplexmlsocketssplstandardtokenizerxmlzipzlib[zend modules][root@localhost ~]#
[root@localhost ~]# ll /etc/php.d/总用量 20-rw-r--r--. 1 root root 49 11月 16 00:36 curl.ini-rw-r--r--. 1 root root 57 11月 16 00:36 fileinfo.ini-rw-r--r--. 1 root root 49 11月 16 00:36 json.ini-rw-r--r--. 1 root root 49 11月 16 00:36 phar.ini-rw-r--r--. 1 root root 47 11月 16 00:36 zip.ini[root@localhost ~]# ll /usr/lib64/php/modules/总用量 3100-rwxr-xr-x. 1 root root 74688 11月 16 00:36 curl.so-rwxr-xr-x. 1 root root 2713376 11月 16 00:36 fileinfo.so-rwxr-xr-x. 1 root root 44688 11月 16 00:36 json.so-rwxr-xr-x. 1 root root 271992 11月 16 00:36 phar.so-rwxr-xr-x. 1 root root 58392 11月 16 00:36 zip.so
五、安装php-mysqlnd
当前系统已安装的mysql版本是:
[root@localhost ~]# rpm -qi mysql-community-servername : mysql-community-serverversion : 5.7.21release : 1.el7architecture: x86_64install date: 2018年02月13日 星期二 09时37分23秒group : applications/databasessize : 775546923license : copyright (c) 2000, 2017, oracle and/or its affiliates. all rights reserved. under gplv2 license as shown in the description field.signature : dsa/sha1, 2017年12月28日 星期四 20时54分13秒, key id 8c718d3b5072e1f5source rpm : mysql-community-5.7.21-1.el7.src.rpmbuild date : 2017年12月28日 星期四 12时11分13秒build host : siv27.no.oracle.comrelocations : (not relocatable)packager : mysql release engineering <mysql-build@oss.oracle.com>vendor : oracle and/or its affiliatesurl : http://www.mysql.com/summary : a very fast and reliable sql database serverdescription :the mysql(tm) software delivers a very fast, multi-threaded, multi-user,and robust sql (structured query language) database server. mysql serveris intended for mission-critical, heavy-load production systems as wellas for embedding into mass-deployed software. mysql is a trademark oforacle and/or its affiliatesthe mysql software has dual licensing, which means you can use the mysqlsoftware free of charge under the gnu general public license(http://www.gnu.org/licenses/). you can also purchase commercial mysqllicenses from oracle and/or its affiliates if you do not wish to be bound by the terms ofthe gpl. see the chapter "licensing and support" in the manual forfurther info.the mysql web site (http://www.mysql.com/) provides the latest news andinformation about the mysql software. also please see the documentationand the manual for more information.this package includes the mysql server binary as well as related utilitiesto run and administer a mysql server.
[root@localhost ~]# yum install php-mysqlnd
[root@localhost test]# ll /etc/php.d/总用量 48-rw-r--r--. 1 root root 49 11月 16 00:36 curl.ini-rw-r--r--. 1 root root 57 11月 16 00:36 fileinfo.ini-rw-r--r--. 1 root root 49 11月 16 00:36 json.ini-rw-r--r--. 1 root root 55 11月 16 00:36 mysqlnd.ini-rw-r--r--. 1 root root 69 11月 16 00:36 mysqlnd_mysqli.ini-rw-r--r--. 1 root root 67 11月 16 00:36 mysqlnd_mysql.ini-rw-r--r--. 1 root root 47 11月 16 00:36 pdo.ini-rw-r--r--. 1 root root 63 11月 16 00:36 pdo_mysqlnd.ini-rw-r--r--. 1 root root 61 11月 16 00:36 pdo_sqlite.ini-rw-r--r--. 1 root root 49 11月 16 00:36 phar.ini-rw-r--r--. 1 root root 55 11月 16 00:36 sqlite3.ini-rw-r--r--. 1 root root 47 11月 16 00:36 zip.ini[root@localhost test]# ll /usr/lib64/php/modules/总用量 3772-rwxr-xr-x. 1 root root 74688 11月 16 00:36 curl.so-rwxr-xr-x. 1 root root 2713376 11月 16 00:36 fileinfo.so-rwxr-xr-x. 1 root root 44688 11月 16 00:36 json.so-rwxr-xr-x. 1 root root 133136 11月 16 00:36 mysqlnd_mysqli.so-rwxr-xr-x. 1 root root 53584 11月 16 00:36 mysqlnd_mysql.so-rwxr-xr-x. 1 root root 256584 11月 16 00:36 mysqlnd.so-rwxr-xr-x. 1 root root 28784 11月 16 00:36 pdo_mysqlnd.so-rwxr-xr-x. 1 root root 116344 11月 16 00:36 pdo.so-rwxr-xr-x. 1 root root 29176 11月 16 00:36 pdo_sqlite.so-rwxr-xr-x. 1 root root 271992 11月 16 00:36 phar.so-rwxr-xr-x. 1 root root 51360 11月 16 00:36 sqlite3.so-rwxr-xr-x. 1 root root 58392 11月 16 00:36 zip.so
如果安装的是php-mysql,而不是php-mysqlnd,在使用函数mysqli_connect()时会有警告:
php warning:  mysqli_connect(): headers and client library minor version mismatch. headers:50556 library:50637
推荐学习:《php视频教程》
以上就是centos yum怎么安装php5.4的详细内容。
其它类似信息

推荐信息