検索
ホームページバックエンド開発PHP7Mac に PHP7 をインストールするときに発生する問題のまとめ

Mac に PHP7 をインストールするときに発生する問題のまとめ

背景

数日前、Mac 上で workman を実行しました。workman は複数のプロセスを開く必要があるためです。プロセス pcntl 拡張機能のサポートが必要です。以前 brew でインストールした php71 にはこの拡張機能がなかったので、php71 を直接アンインストールしました。その後、ソース コードをダウンロードし、php7 の上位バージョンをコンパイルしてインストールし、拡張機能をインストールしたいと思いました。もっと自由に。

ソース コードのコンパイルとインストール (php-7.2.7)

問題 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'

解決策: すべての理由は -前に余分なスペースがあります

問題 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)

解決策

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

apxs ファイル パスを見つけて、コンパイル パラメーターを次のように変更します。次は

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

問題 3

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

解決策

brew install zlib
find / -name lib

パラメータの追加

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

問題 4

configure: error: Cannot locate header file libintl.h

理由は gettext がないためです

#解決策:

$PHP_GETTEXT /usr/local /usr; do

configure ファイルを

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

Question 5## に変更します#

configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
Solution 、コンパイル パラメーターに

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

を追加します。質問 6

checking for libiconv in -liconv... no
checking for iconv in -liconv... no
configure: error: Please reinstall the iconv library.
[結局ここで行き詰まり、解決できませんでした。その後、コンパイルとインストールが失敗しました]

最終的に問題 5 を解決するときのコンパイルとインストールのコマンドは次のとおりです:

./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 install

1。 brew で php

brew search php

を検索すると、php@5.6 php@7.1 php@7.0

2 が表示され、php7.0

brew install php70

3 をインストールし、php をシステム環境に設定します。変数

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

Finally

はソース コードのコンパイルによって正常にインストールできませんでしたが、brew install は正常にインストールされました。

PHP7 関連の知識については、

PHP7 特別コラムをご覧ください。

以上がMac に PHP7 をインストールするときに発生する問題のまとめの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事はsegmentfaultで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強力な PHP 統合開発環境

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。