安裝 mac安裝PHP7經歷

2022-07-04 15:57:19 字數 4255 閱讀 1684

問題一

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'

解決:都是因為—with前面多了個空格

問題二

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)

解決辦法

centos下執行 yum install -y httpd-devel查詢到apxs檔案路徑,然後修改編譯引數如下

--with-apxs2=/usr/local/bin/apxs
問題三

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
參考鏈結

問題四

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
參考鏈結

問題五

configure: error: please specify the install prefix of iconv with --with-iconv=
解決辦法,編譯引數中加上

\--with-iconv=/usr/local/cellar/libiconv/1.15
參考鏈結

問題六

checking for libiconv in -liconv... no

checking for iconv in -liconv... no

configure: error: please reinstall the iconv library.

最終卡在了這裡,沒解決。然後編譯安裝就沒有成功

最後解決到問題五的時候的編譯安裝命令如下:

./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
1.搜尋brew中的php

brew search php
出現了:[email protected] [email protected] [email protected]

2.然後安裝了php7.0

brew install php70
3.將php設定系統環境變數

find / -name php # 先找到php執行檔案

cp /usr/local/cellar/[email protected]/7.0.30_1/bin/php /usr/bin # 將php執行檔案放到/usr/bin/資料夾中

通過原始碼編譯安裝沒有成功,還是brew install安裝成功

記在mac上安裝php7

configure時遇到的問題 libxml 不存在 解決加上 libxml cflags i usr local opt libxml2 include libxml libs l usr local opt libxml2 lib 解決掉 sqlite3 不存在 sqlite cflags i ...

國內php7安裝源 原始碼安裝PHP7

2.解壓 tar xzf php 7.2.4.tar.bz2 3.安裝 cd php 7.2.4 configure prefix data server php7 配置安裝路徑 make 編譯 make install 安裝 4.配置全域性環境 如果執行php v命令無效則進行這項配置 開啟配置檔...

php7編譯安裝

因為編譯安裝php前,它所依賴的各種庫和包可能還未被安裝,所以先yum安裝php中常用的必須庫 yum install libxml2 libxml2 devel openssl openssl devel bzip2 bzip2 devel libcurl libcurl devel libjpe...