简体   繁体   中英

How to update PHP version from 5.4.16 to 5.6.20 or a newer version in Wordpress

I have a Centos 7.7. server where I am hosting my website. I tried to update the PHP version from the CLI but nothing has changed on Wordpress:

"You cannot update because WordPress 5.2.4 requires PHP version 5.6.20 or higher. You are running version 5.4.16."

# php -v
PHP 7.1.30 (cli) (built: Aug 21 2019 09:27:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

# rpm -qa|grep php
rh-php71-php-json-7.1.30-1.el7.x86_64
rh-php71-php-cli-7.1.30-1.el7.x86_64
php-gd-5.4.16-46.1.el7_7.x86_64
php-5.4.16-46.1.el7_7.x86_64
php-mysql-5.4.16-46.1.el7_7.x86_64
rh-php71-php-7.1.30-1.el7.x86_64
rh-php71-php-zip-7.1.30-1.el7.x86_64
php-mcrypt-5.4.16-9.el7.x86_64
php-cli-5.4.16-46.1.el7_7.x86_64
php-mbstring-5.4.16-46.1.el7_7.x86_64
rh-php71-runtime-1-1.el7.x86_64
php-common-5.4.16-46.1.el7_7.x86_64
php-xmlrpc-5.4.16-46.1.el7_7.x86_64
rh-php71-php-common-7.1.30-1.el7.x86_64
php-pdo-5.4.16-46.1.el7_7.x86_64
php-xml-5.4.16-46.1.el7_7.x86_64

# httpd -M [Fri Nov 15 13:57:00.257580 2019] [so:warn] [pid 14807] AH01574: module rewrite_module is already loaded, skipping Loaded Modules: core_module (static) so_module (static) http_module (static) rewrite_module (shared) access_compat_module (shared) actions_module (shared) alias_module (shared) allowmethods_module (shared) auth_basic_module (shared) auth_digest_module (shared) authn_anon_module (shared) authn_core_module (shared) authn_dbd_module (shared) authn_dbm_module (shared) authn_file_module (shared) authn_socache_module (shared) authz_core_module (shared) authz_dbd_module (shared) authz_dbm_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_owner_module (shared) authz_user_module (shared) autoindex_module (shared) cache_module (shared) cache_disk_module (shared) data_module (shared) dbd_module (shared) deflate_module (shared) dir_module (shared) dumpio_module (shared) echo_module (shared) env_module (shared) expires_module (shared) ext_filte r_module (shared) filter_module (shared) headers_module (shared) include_module (shared) info_module (shared) log_config_module (shared) logio_module (shared) mime_magic_module (shared) mime_module (shared) negotiation_module (shared) remoteip_module (shared) reqtimeout_module (shared) setenvif_module (shared) slotmem_plain_module (shared) slotmem_shm_module (shared) socache_dbm_module (shared) socache_memcache_module (shared) socache_shmcb_module (shared) status_module (shared) substitute_module (shared) suexec_module (shared) unique_id_module (shared) unixd_module (shared) userdir_module (shared) version_module (shared) vhost_alias_module (shared) dav_module (shared) dav_fs_module (shared) dav_lock_module (shared) lua_module (shared) mpm_prefork_module (shared) proxy_module (shared) lbmethod_bybusyness_module (shared) lbmethod_byrequests_module (shared) lbmethod_bytraffic_module (shared) lbmethod_heartbeat_module (shared) proxy_ajp_module (shared) proxy_balancer_module (shared) proxy _connect_module (shared) proxy_express_module (shared) proxy_fcgi_module (shared) proxy_fdpass_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_scgi_module (shared) proxy_wstunnel_module (shared) ssl_module (shared) systemd_module (shared) cgi_module (shared) ldap_module (shared) authnz_ldap_module (shared) php5_module (shared)

在此处输入图像描述

I don't have cPanel and I need to find a way to update directly from the server. Also I'm using Apache and is not a shared hosting. Thanks.

I just solved my issue, I renamed the file /etc/httpd/conf.d/10-php.conf in /etc/httpd/conf.d/10-php.conf.off and I copied /opt/rh/httpd24/root/etc/httpd/conf.modules.d/rh-php71-php.conf /etc/httpd/conf.modules.d/. and restarted the https service. Thanks anyway

The php version running on the server itself is (and can be) different than the php version running with apache. You need to enable the php version for your apache server with

sudo a2dismod php5.4
sudo a2enmod php7.1

(Google for it)

With the php -v command you get not the php version of the apache server.

Btw php 7.3 is the actual version. If you already updating stuff, try to enable the HTTP2 protocol and install php-fpm instead of cli.

Edit: a2enmod does not work with Centos, this is debianism. You need to enable the php version in the *.conf files and restart apache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM