Heim > Backend-Entwicklung > PHP8 > Hauptteil

Bringen Sie Ihnen bei, wie Sie eine PHP8-Umgebung von Grund auf erstellen

藏色散人
Freigeben: 2023-02-17 11:50:01
nach vorne
7800 Leute haben es durchsucht

Empfohlen: „PHP8-Tutorial

Erstellen Sie eine PHP-Umgebung von Grund auf -php8

1. Herunterladen

1, https://www.php.net/distributions/php-8.0.0.tar.gz下载到本地,文件传输上传到 /usr/local/src/
2、wget -P /usr/local/src/ https://www.php.net/distributions/php-8.0.0.tar.gz

2. Informationen zum Konfigurieren der Kompilierungsparameter finden Sie unter https://www.php.net/manual/zh/configure.about.php, um die benötigten Optionen auszuwählen

> cd /usr/local/src/
> tar xzf php-8.0.0.tar.gz
> cd php-8.0.0
Nach dem Login kopieren
Frage 1:

./configure --prefix=/usr/local/php8 --with-config-file-path=/usr/local/php8/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-openssl --with-mysqli --with-pdo-mysql --with-iconv --with-mhash --with-zlib  --enable-mbstring  --enable-gd   --enable-gd-jis-conv --enable-sockets --enable-fpm --enable- --enable-xml  --enable-pdo  --enable-cli --enable-pcntl --enable-soap --enable-opcache --enable-fileinfo --disable-rpath --enable-mysqlnd --with-zip --enable-simplexml --with-libxml --with-sqlite3 --with-pdo-sqlite --enable-phar --enable-tokenizer --enable-cgi
Nach dem Login kopieren
Lösung für Problem 1:

configure: error: Package requirements (libxml-2.0 >= 2.9.0) were not met:

Package 'libxml-2.0', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Nach dem Login kopieren
Frage 2:

> yum install libxml2-devel
Nach dem Login kopieren
Problem 2 gelöst:

configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
Nach dem Login kopieren
Problem 3:

> yum install sqlite-devel
Nach dem Login kopieren
Problem 3 gelöst:

configure: error: Package requirements (libcurl >= 7.29.0) were not met:
Nach dem Login kopieren
Problem 4:

> yum install libcurl-devel
Nach dem Login kopieren
Problem 5:

configure: error: Package requirements (libpng) were not met:
Nach dem Login kopieren
Problem 5 gelöst:

> yum install libpng libpng-devel
Nach dem Login kopieren
Problem 6:

configure: error: Package requirements (oniguruma) were not met:
Nach dem Login kopieren
Problem 6 gelöst:

> cd /usr/local/src/
> wget http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/liboniguruma5-6.9.6-alt1.x86_64.rpm -O liboniguruma5-6.9.6-alt1.x86_64.rpm
> rpm -ivh liboniguruma5-6.9.6-alt1.x86_64.rpm
> wget http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/liboniguruma-devel-6.9.6-alt1.x86_64.rpm -O liboniguruma-devel-6.9.6-alt1.x86_64.rpm 
> rpm liboniguruma-devel-6.9.6-alt1.x86_64.rpmcli
Nach dem Login kopieren
Kompilierungsparameter erfolgreich konfigurieren

configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
Nach dem Login kopieren
3. Quellcode kompilieren

> yum install libzip libzip-devel
Nach dem Login kopieren
5. Umgebungsvariablen hinzufügen

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.
Nach dem Login kopieren
6. Rufen Sie die Standardkonfiguration ab

> make -j2 # 这里是依赖系统cpu核心数进行编译,对性能有一定提升,通常利用核心数不要超过一半,
Nach dem Login kopieren
7. Selbststart beim Booten

Der Einstellungsbefehl kann ausgeführt werden

make install
Nach dem Login kopieren

Überprüfen Sie das Selbststartskript

[root@54skyer php-8.0.0]# make install
Installing shared extensions:     /usr/local/php8/lib/php/extensions/no-debug-non-zts-20200930/
Installing PHP CLI binary:        /usr/local/php8/bin/
Installing PHP CLI man page:      /usr/local/php8/php/man/man1/
Installing PHP FPM binary:        /usr/local/php8/sbin/
Installing PHP FPM defconfig:     /usr/local/php8/etc/
Installing PHP FPM man page:      /usr/local/php8/php/man/man8/
Installing PHP FPM status page:   /usr/local/php8/php/php/fpm/
Installing phpdbg binary:         /usr/local/php8/bin/
Installing phpdbg man page:       /usr/local/php8/php/man/man1/
Installing PHP CGI binary:        /usr/local/php8/bin/
Installing PHP CGI man page:      /usr/local/php8/php/man/man1/
Installing build environment:     /usr/local/php8/lib/php/build/
Installing header files:          /usr/local/php8/include/php/
Installing helper programs:       /usr/local/php8/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php8/php/man/man1/
  page: phpize.1
  page: php-config.1
/usr/local/src/php-8.0.0/build/shtool install -c ext/phar/phar.phar /usr/local/php8/bin/phar.phar
ln -s -f phar.phar /usr/local/php8/bin/phar
Installing PDO headers:           /usr/local/php8/include/php/ext/pdo/
Nach dem Login kopieren

Weitere Anweisungen zur Konfigurationsdatei finden Sie unter: https ://www.cnblogs.com/xiaozong/p/5724984 .html

php-fpm.conf ist eine einzigartige Konfigurationsdatei für PHP-FPM

php.ini ist eine erforderliche Konfigurationsdatei in allen PHP-Modi

Der Unterschied zwischen den beiden ist, dass php-fpm.conf die Konfiguration der PHP-FPM-Prozessmanagerdatei ist, php.ini die Konfigurationsdatei des PHP-Parsers


Einige PHP-Versionen enthalten auch die Konfigurationsdatei /fpm.d/www.conf Konfigurationsdateipfad

Dies ist die Erweiterungsdatei der von php-fpm.conf konfigurierten Datei. Sie können die Datei php-fpm.conf zum Anzeigen öffnen

; include=fpm.d/*.conf

Wir können verwenden php-fpm.conf zum Konfigurieren des langsamen Protokolls

Wir können die langsame Protokollfunktion aktivieren.

slowlog = /usr/local/var/log/php-fpm.log.slow

request_slowlog_timeout = 5s

Das obige ist der detaillierte Inhalt vonBringen Sie Ihnen bei, wie Sie eine PHP8-Umgebung von Grund auf erstellen. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Verwandte Etiketten:
Quelle:segmentfault.com
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!