Heim >Backend-Entwicklung >PHP7 >Zusammenfassung der Probleme, die bei der Installation von PHP7 auf einem Mac auftreten

Zusammenfassung der Probleme, die bei der Installation von PHP7 auf einem Mac auftreten

藏色散人
藏色散人nach vorne
2019-09-29 14:13:254671Durchsuche

Zusammenfassung der Probleme, die bei der Installation von PHP7 auf einem Mac auftreten

Hintergrund

Vor ein paar Tagen habe ich workrman auf dem Mac ausgeführt, weil Workman mehrere Prozesse öffnen muss, mehrere -Prozess Es benötigt die Unterstützung der Erweiterung pcntl. Das PHP71, das ich zuvor mit brew installiert habe, hatte diese Erweiterung nicht, daher wollte ich den Quellcode herunterladen, eine höhere Version von PHP7 kompilieren und installieren Erweiterung freier.

Kompilierung und Installation des Quellcodes (php-7.2.7)

Problem 1

configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --enable-fpm
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-mysqli
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-pdo-mysql
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-iconv-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-eeeetype-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-zlib
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-jpeg-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-png-dir
configure: error: invalid variable name: ` --with-libxml-dir'

Lösung: alles nur, weil— mit Es gibt ein zusätzliches Leerzeichen davor

Problem 2

Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

Lösung

brew install httpd
find / -name apxs 
Centos下执行 yum install -y httpd-devel

Suchen Sie den Apxs-Dateipfad und ändern Sie dann die Kompilierungsparameter wie folgt folgt

--with-apxs2=/usr/local/bin/apxs

Problem 3

checking if the location of ZLIB install directory is defined... no ;
configure: error: Cannot find libz.

Lösung

brew install zlib
find / -name lib

Parameter hinzufügen

--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11

Problem 4

configure: error: Cannot locate header file libintl.h

Der Grund ist, dass es keinen gettext gibt

Lösung:

$PHP_GETTEXT /usr/local /usr; do

Konfigurationsdatei wurde geändert in

for i in $PHP_GETTEXT /usr/local /usr /usr/local/opt/gettext; do

Problem 5

configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

Lösung, füge

\--with-iconv=/usr/local/Cellar/libiconv/1.15

zu den Kompilierungsparametern hinzu

checking for libiconv in -liconv... no
checking for iconv in -liconv... no
configure: error: Please reinstall the iconv library.

[Am Ende blieb ich hier hängen und konnte es nicht lösen. Dann ist die Kompilierung und Installation fehlgeschlagen]

Der Kompilierungs- und Installationsbefehl zur endgültigen Lösung von Problem 5 lautet wie folgt:

./configure --prefix=/usr/local/php/7.2.7\—with-config-file-path=/usr/local/php/7.2.7/etc \--with-config-file-scan-dir=/usr/local/php/7.2.7/etc/conf.d  \--with-apxs2=/usr/local/bin/apxs \--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--with-mysqli \--with-pdo-mysql  \--with-iconv=/usr/local/Cellar/libiconv/1.15 \--with-eeeetype-dir \--with-zlib \--with-jpeg-dir \--with-png-dir \--with-libxml-dir=/usr/bin/xml2-config \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-mbstring \--with-mcrypt \--enable-ftp \--with-gd \--enable-gd-native-ttf \--with-onsnssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--without-pear \--with-gettext \--disable-fileinfo \--enable-maintnener-zts \--enable-mysqlnd

Brew-Installation

1. Suche php

brew search php

in brew erschien: php@5.6 php@7.1 php@7.0

2. Dann installierte php7.0

brew install php70

3 Variable

find / -name php # 先找到php执行文件
cp /usr/local/Cellar/php@7.0/7.0.30_1/bin/php /usr/bin  # 将php执行文件放到/usr/bin/文件夹中

Schließlich konnte

nicht durch Quellcode-Kompilierung installiert werden, aber brew install wurde erfolgreich installiert.

Weitere Informationen zu PHP7 finden Sie in der Sonderkolumne PHP7!

Das obige ist der detaillierte Inhalt vonZusammenfassung der Probleme, die bei der Installation von PHP7 auf einem Mac auftreten. 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