簡體   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

我有一個 Centos 7.7。 我托管我的網站的服務器。 我嘗試從 CLI 更新 PHP 版本,但 Wordpress 沒有任何變化:

“您無法更新,因為 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: 模塊 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(共享) 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(共享) 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(共享)

在此處輸入圖像描述

我沒有 cPanel,我需要找到一種直接從服務器更新的方法。 另外我正在使用 Apache 並且不是共享主機。 謝謝。

我剛剛解決了我的問題,我在 /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/。 並重新啟動 https 服務。 不管怎么說,還是要謝謝你

在服務器本身上運行的 php 版本(並且可以)不同於在 apache 上運行的 php 版本。 您需要為您的 apache 服務器啟用 php 版本

sudo a2dismod php5.4
sudo a2enmod php7.1

(谷歌為它)

使用php -v命令,您不會得到 apache 服務器的 php 版本。

順便說一句,php 7.3 是實際版本。 如果您已經更新了東西,請嘗試啟用 HTTP2 協議並安裝 php-fpm 而不是 cli。

編輯: a2enmod 不適用於 Centos,這是 debianism。 您需要在*.conf文件中啟用php版本並重啟apache。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM