Heim >Backend-Entwicklung >PHP8 >Bringen Sie Ihnen bei, wie Sie eine PHP8-Umgebung von Grund auf erstellen

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

藏色散人
藏色散人nach vorne
2021-03-15 17:30:178061Durchsuche

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
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
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.
Frage 2:

> yum install libxml2-devel
Problem 2 gelöst:

configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
Problem 3:

> yum install sqlite-devel
Problem 3 gelöst:

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

> yum install libcurl-devel
Problem 5:

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

> yum install libpng libpng-devel
Problem 6:

configure: error: Package requirements (oniguruma) were not met:
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
Kompilierungsparameter erfolgreich konfigurieren

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

> yum install libzip libzip-devel
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.
6. Rufen Sie die Standardkonfiguration ab

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

Der Einstellungsbefehl kann ausgeführt werden

make install

Ü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/

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!

Stellungnahme:
Dieser Artikel ist reproduziert unter:segmentfault.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen