Vor Tagen musste ich auf dem nixcp.com-Server auf PHP 7.1 aktualisieren, es war ein großes Upgrade, da ich PHP 5.6.x ausführte.
Dies stand ganz oben auf meiner Todo-Liste, nachdem ich gelesen hatte, dass PHP 7.1 20 % schneller als PHP 7.0 war (und wir alle wissen, dass PHP 7.0 etwa doppelt so schnell ist wie PHP 5.6.x), da ich von Webgeschwindigkeit und Web besessen bin Leistung war dies die Gelegenheit, PHP 7.1 und seine Vorteile zu testen.
Installieren Sie PHP 7.1 auf CentOS 7 Schritt für Schritt
Nachdem ich recherchiert hatte, ob alle meine PHP-Apps kompatibel waren, startete ich den Upgrade-Prozess von PHP 5.6.x auf PHP 7.1 auf CentOS 7.x 64 Bit. Dies ist das Verfahren, das ich auf meinem Server verwendet habe.
Erhalten Sie für alle Fälle eine Liste aller Ihrer aktuellen PHP-Pakete:
rpm -qa | grep php
Es sollte ungefähr so aussehen:
[[email protected]:~]rpm -qa | grep php php-common-5.6.30-1.el7.remi.x86_64 php-pear-1.10.3-1.el7.remi.noarch php-pecl-memcache-3.0.8-4.el7.remi.5.6.x86_64 php-devel-5.6.30-1.el7.remi.x86_64 php-mysqlnd-5.6.30-1.el7.remi.x86_64 php-mcrypt-5.6.30-1.el7.remi.x86_64 php56-php-common-5.6.30-1.el7.remi.x86_64 php-cli-5.6.30-1.el7.remi.x86_64 php-pecl-jsonc-devel-1.3.10-2.el7.remi.5.6.x86_64 php-pecl-igbinary-2.0.1-1.el7.remi.5.6.x86_64 php-gd-5.6.30-1.el7.remi.x86_64 php-mbstring-5.6.30-1.el7.remi.x86_64 php56-runtime-2.1-5.el7.remi.x86_64 php56-php-pecl-msgpack-0.5.7-1.el7.remi.x86_64 php-5.6.30-1.el7.remi.x86_64 php-pecl-jsonc-1.3.10-2.el7.remi.5.6.x86_64 php-xml-5.6.30-1.el7.remi.x86_64 php-process-5.6.30-1.el7.remi.x86_64 php-xcache-3.2.0-1.el7.remi.5.6.x86_64 php-pecl-memcached-2.2.0-3.el7.remi.5.6.x86_64 php-soap-5.6.30-1.el7.remi.x86_64 php-opcache-5.6.30-1.el7.remi.x86_64 php56-php-pecl-jsonc-1.3.10-1.el7.remi.x86_64 php56-php-pecl-igbinary-2.0.1-1.el7.remi.x86_64 php-pdo-5.6.30-1.el7.remi.x86_64 php-fpm-5.6.30-1.el7.remi.x86_64 php56-php-pecl-zip-1.13.5-1.el7.remi.x86_64 php-pecl-zip-1.13.5-1.el7.remi.5.6.x86_64 php-pecl-msgpack-0.5.7-1.el7.remi.5.6.x86_64 php-xmlrpc-5.6.30-1.el7.remi.x86_64 [[email protected]:~]
Installieren Sie Remi Repo für CentOS 7.x
Ich hatte Remis Repo bereits installiert, aber wenn nicht, können Sie es mit diesen Befehlen tun:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm
Aktivieren Sie danach PHP-71-Pakete aus Ihrem Remi-Repo, führen Sie diesen Befehl aus:
yum-config-manager --enable remi-php71
Erwartete Ausgabe:
[[email protected]:~]yum-config-manager --enable remi-php71 Loaded plugins: fastestmirror, langpacks ==== repo: remi-php71 ======= [remi-php71] async = True bandwidth = 0 base_persistdir = /var/lib/yum/repos/x86_64/7 baseurl = cache = 0 cachedir = /var/cache/yum/x86_64/7/remi-php71 check_config_file_age = True compare_providers_priority = 80 cost = 1000 deltarpm_metadata_percentage = 100 deltarpm_percentage = enabled = True enablegroups = True ... ... ...
Führen Sie dann yum update:
ausyum update -y
Wenn Sie kein Upgrade durchführen und nur PHP 7.1 auf CentOS 7 installieren möchten, führen Sie einfach Folgendes aus:
yum install php php-devel php-gd php-mbstring php-mcrypt php-soap php-mysqlnd
Es sollte alle Ihre aktuellen PHP-Pakete auf PHP 7.1 aktualisieren, wie Sie unten sehen:
Wenn dieses Problem auftritt:
You could try using --skip-broken to work around the problem ** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows: php-5.6.30-1.el7.remi.x86_64 has missing requires of httpd-mmn = ('0', '20120211x8664', None)
Es kann behoben werden, indem das httpd-Paket installiert wird, das ich nicht verwende, aber es ist erforderlich:
yum install httpd -y
Danach habe ich httpd vom Bootvorgang deaktiviert, um sicherzustellen, dass es nicht versucht, zusammen mit Nginx zu booten und einen Port 80-Konflikt verursacht:
systemctl disable httpd
Entfernen Sie Xcache, da es meines Erachtens nicht für PHP 7.1.x verfügbar ist
yum remove php-xcache* -y
Wenn Sie Xcache beibehalten, kann dies zu einem Yum-Fehler führen, wie Sie unten sehen:
--> Finished Dependency Resolution Error: Package: 1:php-xcache-3.2.0-1.el7.remi.5.6.x86_64 (@remi-php56) Requires: php(zend-abi) = 20131226-64 Removing: php-common-5.6.30-1.el7.remi.x86_64 (@remi-php56) php(zend-abi) = 20131226-64 Updated By: php-common-7.1.3-1.el7.remi.x86_64 (remi-php71) php(zend-abi) = 20160303-64 Available: php-common-5.4.16-42.el7.x86_64 (base) php(zend-abi) = 20100525-64 Available: php-common-5.6.29-1.el7.remi.x86_64 (remi-php56) php(zend-abi) = 20131226-64 Available: php-common-7.1.2-1.el7.remi.x86_64 (remi-php71) php(zend-abi) = 20160303-64 Error: Package: 1:php-xcache-3.2.0-1.el7.remi.5.6.x86_64 (@remi-php56) Requires: php(api) = 20131106-64 Removing: php-common-5.6.30-1.el7.remi.x86_64 (@remi-php56) php(api) = 20131106-64 Updated By: php-common-7.1.3-1.el7.remi.x86_64 (remi-php71) php(api) = 20160303-64 Available: php-common-5.4.16-42.el7.x86_64 (base) php(api) = 20100412-64 Available: php-common-5.6.29-1.el7.remi.x86_64 (remi-php56) php(api) = 20131106-64 Available: php-common-7.1.2-1.el7.remi.x86_64 (remi-php71) php(api) = 20160303-64 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
Eine Sache ist mir aufgefallen:ein paar Pakete sind noch von PHP 5.6 Version:
[[email protected]:~]rpm -qa | grep php56 php56-php-common-5.6.30-1.el7.remi.x86_64 php56-runtime-2.1-5.el7.remi.x86_64 php56-php-pecl-msgpack-0.5.7-1.el7.remi.x86_64 php56-php-pecl-jsonc-1.3.10-1.el7.remi.x86_64 php56-php-pecl-igbinary-2.0.1-1.el7.remi.x86_64 php56-php-pecl-zip-1.13.5-1.el7.remi.x86_64
Entfernen Sie diese und installieren Sie die 7.1-Versionen von Remi:
yum remove php56*
yum install yum install php71-php-common php71-runtime php71-php-pecl-msgpack php71-php-pecl-jsonc php71-php-pecl-igbinary php71-php-pecl-zip
Und das Upgrade von PHP 5.6 auf PHP 7.1 war abgeschlossen.
Stellen Sie abschließend sicher, dass Sie http und php-fpm neu starten, um die Änderungen zu übernehmen:
systemctl restart nginx systemctl restart php-fpm
Das ist alles, jetzt wissen Sie, wie Sie PHP 7.1 auf CentOS 7 aktualisieren oder installieren. Bitte lassen Sie es mich wissen, wenn Sie nach dieser Anleitung Fragen oder Probleme haben.
Installation/Upgrade auf PHP 7.1 auf CentOS 7/RHEL 7 mit Remi RPM Repo wurde zuletzt geändert:5. April 2017 von Esteban Borges