简体   繁体   English

如何将 PHP 版本从 5.4.16 更新到 5.6.20 或 Wordpress 中的更新版本

[英]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.我有一个 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:我尝试从 CLI 更新 PHP 版本,但 Wordpress 没有任何变化:

"You cannot update because WordPress 5.2.4 requires PHP version 5.6.20 or higher. You are running version 5.4.16." “您无法更新,因为 WordPress 5.2.4 需要 PHP 版本 5.6.20 或更高版本。您正在运行版本 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 # httpd -M [Fri Nov 15 13:57:00.257580 2019] [so:warn] [pid 14807] AH01574: 模块 rewrite_module 已经加载,跳过加载的模块: core_module (static) so_module (static) http_module (static) rewrite_module (共享) access_compat_module(共享) actions_module(共享) alias_module(共享) allowmethods_module(共享) auth_basic_module(共享) auth_digest_module(共享) authn_anon_module(共享) authn_core_module(共享) authn_dbd_module(共享) authn_dbm_module(共享) authn_file_module(共享) authn_socache_module(共享) authz_core_module(共享) authz_dbd_module(共享) authz_dbm_module(共享) authz_groupfile_module(共享) authz_host_module(共享) authz_owner_module(共享) authz_user_module(共享) autoindex_module(共享) cache_module(共享) cache_disk_module(共享) data_module(共享) dbd_module(共享)共享) dir_module(共享) dumpio_module(共享) echo_module(共享) env_module(共享) expires_module(共享) 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 r_module(共享) filter_module(共享) headers_module(共享) include_module(共享) info_module(共享) log_config_module(共享) logio_module(共享) mime_magic_module(共享) mime_module(共享)negotiation_module(共享) remoteip_module(共享) reqtimeout_module(共享) setenif_module(共享) slotmem_plain_module(共享) slotmem_shm_module(共享) socache_dbm_module(共享) socache_memcache_module(共享) socache_shmcb_module(共享) status_module(共享)substitute_module(共享) suexec_module(共享) unique_id_module(共享) unixd_module(共享) userdir_module(共享) version_module(共享) (vhost_alias_module(共享) dav_module(共享) dav_fs_module(共享) dav_lock_module(共享) lua_module(共享) mpm_prefork_module(共享) proxy_module(共享) lbmethod_bybusyness_module(共享) lbmethod_byrequests_module(共享) lbmethod_bytraffic_module(共享) lbmethod_ajbeat_module(共享代理)共享)代理_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) _connect_module(共享) proxy_express_module(共享) proxy_fcgi_module(共享) proxy_fdpass_module(共享) proxy_ftp_module(共享) proxy_http_module(共享) proxy_scgi_module(共享) proxy_wstunnel_module(共享) ssl_module(共享) systemd_module(共享) cgi_module(共享) ldap_module(共享) authnz_ldap_module(共享)php5_module(共享)

在此处输入图像描述

I don't have cPanel and I need to find a way to update directly from the server.我没有 cPanel,我需要找到一种直接从服务器更新的方法。 Also I'm using Apache and is not a shared hosting.另外我正在使用 Apache 并且不是共享主机。 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/.我刚刚解决了我的问题,我在 /etc/httpd/conf.d/10-php.conf.off 中重命名了文件 /etc/httpd/conf.d/10-php.conf 并复制了 /opt/rh/httpd24 /root/etc/httpd/conf.modules.d/rh-php71-php.conf /etc/httpd/conf.modules.d/。 and restarted the https service.并重新启动 https 服务。 Thanks anyway不管怎么说,还是要谢谢你

The php version running on the server itself is (and can be) different than the php version running with apache.在服务器本身上运行的 php 版本(并且可以)不同于在 apache 上运行的 php 版本。 You need to enable the php version for your apache server with您需要为您的 apache 服务器启用 php 版本

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.使用php -v命令,您不会得到 apache 服务器的 php 版本。

Btw php 7.3 is the actual version.顺便说一句,php 7.3 是实际版本。 If you already updating stuff, try to enable the HTTP2 protocol and install php-fpm instead of cli.如果您已经更新了东西,请尝试启用 HTTP2 协议并安装 php-fpm 而不是 cli。

Edit: a2enmod does not work with Centos, this is debianism.编辑: a2enmod 不适用于 Centos,这是 debianism。 You need to enable the php version in the *.conf files and restart apache.您需要在*.conf文件中启用php版本并重启apache。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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