Mac homebrew install php7自定義參數(shù)生成libphp7.so

Mac中如何安裝PHP7尿孔,為什么brew?安裝php7為什么找不到.so文件呢,安裝php7后丟失libphp7.so了嗎 君丁。那安裝brew install php72時怎么配置參數(shù)呢

常見問題 找不到libphp7.so

首先系統(tǒng)中brew 1.4.0版本

?? apache2 git:(stable) ?brew -v

Homebrew 1.4.0

Homebrew/homebrew-core (git revision 7990; last commit 2017-12-14)

?? apache2 git:(stable) ?

查看php72有哪些options選項可以安裝枫夺,那其中--with-httpd看到?jīng)],這個就是libphp7.so文件的關(guān)鍵參數(shù)绘闷,其他參數(shù)根據(jù)需要自行選擇筷屡。

?? apache2 git:(stable) ?brew options php72

--with-cgi

Enable building of the CGI executable (implies --without-fpm)

--with-debug

Compile with debugging symbols

--with-enchant

Build with enchant support

--with-gmp

Build with gmp support

--with-homebrew-curl

Include Curl support via Homebrew

--with-homebrew-libressl

Include LibreSSL instead of OpenSSL via Homebrew

--with-homebrew-libxml2

Include Libxml2 support via Homebrew

--with-homebrew-libxslt

Include LibXSLT support via Homebrew

--with-httpd

Enable building of shared Apache Handler module

--with-imap

Include IMAP extension

--with-libmysql

Include (old-style) libmysql support instead of mysqlnd

--with-mssql

Include MSSQL-DB support

--with-pdo-oci

Include Oracle databases (requries ORACLE_HOME be set)

--with-pear

Build with PEAR

--with-phpdbg

Enable building of the phpdbg SAPI executable

--with-postgresql

Build with postgresql support

--with-thread-safety

Build with thread safety

--with-webp

Build with webp support

--without-bz2

Build without bz2 support

--without-fpm

Disable building of the fpm SAPI executable

--without-ldap

Build without LDAP support

--without-legacy-mysql

Do not include the deprecated mysql_ functions

--without-mysql

Remove MySQL/MariaDB support

--without-pcntl

Build without Process Control support

--without-unixodbc

Build without unixODBC support

--HEAD

Install HEAD version

那這里根據(jù)開發(fā)需要我選擇了自己需要的參數(shù),命令如下簸喂,要先解綁之前的PHP版本毙死,如下執(zhí)行過程:

?? apache2 git:(stable) ??brew install php72? --with-httpd --with-debug? --with-imap --with-mssql --with-pear --with-postgresql? --with-webp

==> Installing php72 from homebrew/php

Error: Cannot install homebrew/php/php72 because conflicting formulae are installed.

php71: because different php versions install the same binaries.

Please `brew unlink php71` before continuing.

Unlinking removes a formula's symlinks from /usr/local. You can

link the formula again after the install finishes. You can --force this

install, but the build may fail or cause obscure side-effects in the

resulting software.

?? apache2 git:(stable) ??brew unlink php71

Unlinking /usr/local/Cellar/php71/7.1.12_23... 39 symlinks removed

?? apache2 git:(stable) ? brew install php72? --with-httpd --with-debug? --with-imap --with-mssql --with-pear --with-postgresql? --with-webp

Updating Homebrew...

==> Installing php72 from homebrew/php

==> Installing dependencies for homebrew/php/php72: libsodium

==> Installing homebrew/php/php72 dependency: libsodium

==> Downloading https://homebrew.bintray.com/bottles/libsodium-1.0.16.sierra.bottle.tar.gz

############################################################ 100.0%

==> Pouring libsodium-1.0.16.sierra.bottle.tar.gz

??? /usr/local/Cellar/libsodium/1.0.16: 71 files, 945.3KB

==> Installing homebrew/php/php72 --with-webp --with-postgresql --with-httpd --with-debug --with-imap --with-mssql --with-pear

==> Downloading https://php.net/get/php-7.2.0.tar.bz2/from/this/mirror

==> Downloading from https://secure.php.net/get/php-7.2.0.tar.bz2/from/this/mirror

########################################################### 100.0%

==> ./configure --prefix=/usr/local/Cellar/php72/7.2.0_11 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/7.2 --with-config-file-path=

==> make

==> make install

==> /usr/local/Cellar/php72/7.2.0_11/bin/pear config-set php_ini /usr/local/etc/php/7.2/php.ini system

==> Caveats

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php7_module /usr/local/opt/php72/libexec/apache2/libphp7.so

SetHandler application/x-httpd-php

Finally, check DirectoryIndex includes index.php

DirectoryIndex index.php index.html

The php.ini file can be found in:

/usr/local/etc/php/7.2/php.ini

???? PEAR ????

If PEAR complains about permissions, 'fix' the default PEAR permissions and config:

chmod -R ug+w /usr/local/opt/php72/lib/php

pear config-set php_ini /usr/local/etc/php/7.2/php.ini system

???? Extensions ????

If you are having issues with custom extension compiling, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

PATH="/usr/local/bin:$PATH"

PHP72 Extensions will always be compiled against this PHP. Please install them using --without-homebrew-php to enable compiling against system PHP.

???? PHP CLI ????

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file:

export PATH="$(brew --prefix homebrew/php/php72)/bin:$PATH"

???? FPM ????

To launch php-fpm on startup:

mkdir -p ~/Library/LaunchAgents

cp /usr/local/opt/php72/homebrew.mxcl.php72.plist ~/Library/LaunchAgents/

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php72.plist

The control script is located at /usr/local/opt/php72/sbin/php72-fpm

OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:

PATH="/usr/local/sbin:$PATH"

You may also need to edit the plist to use the correct "UserName".

Please note that the plist was called 'homebrew-php.josegonzalez.php72.plist' in old versions of this formula.

With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system you have to install php with the --with-httpd option. See? brew options php72 for more details.

To have launchd start homebrew/php/php72 now and restart at login:

brew services start homebrew/php/php72

==> Summary

??? /usr/local/Cellar/php72/7.2.0_11: 508 files, 69.4MB, built in 10 minutes 20 seconds

到此安裝步驟完成,libphp7.so在目錄/usr/local/Cellar/php72/7.2.0_11/libexec/apache2/libphp7.so下喻鳄,具體使用請在apache配置文件httpd.conf中引入切換扼倘。

另外之前有版本的參數(shù)是--with--apache,舊版本在這里不予贅述除呵。 希望本文可以幫助到你再菊,歡迎指正和提問。

作者博客:開發(fā)者說PHPersay

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末颜曾,一起剝皮案震驚了整個濱河市纠拔,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌泛豪,老刑警劉巖稠诲,帶你破解...
    沈念sama閱讀 206,839評論 6 482
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異诡曙,居然都是意外死亡臀叙,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,543評論 2 382
  • 文/潘曉璐 我一進店門价卤,熙熙樓的掌柜王于貴愁眉苦臉地迎上來劝萤,“玉大人,你說我怎么就攤上這事慎璧〈蚕樱” “怎么了跨释?”我有些...
    開封第一講書人閱讀 153,116評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長厌处。 經(jīng)常有香客問我煤傍,道長,這世上最難降的妖魔是什么嘱蛋? 我笑而不...
    開封第一講書人閱讀 55,371評論 1 279
  • 正文 為了忘掉前任蚯姆,我火速辦了婚禮,結(jié)果婚禮上洒敏,老公的妹妹穿的比我還像新娘龄恋。我一直安慰自己,他們只是感情好凶伙,可當(dāng)我...
    茶點故事閱讀 64,384評論 5 374
  • 文/花漫 我一把揭開白布郭毕。 她就那樣靜靜地躺著,像睡著了一般函荣。 火紅的嫁衣襯著肌膚如雪显押。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,111評論 1 285
  • 那天傻挂,我揣著相機與錄音乘碑,去河邊找鬼。 笑死金拒,一個胖子當(dāng)著我的面吹牛兽肤,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播绪抛,決...
    沈念sama閱讀 38,416評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼资铡,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了幢码?” 一聲冷哼從身側(cè)響起笤休,我...
    開封第一講書人閱讀 37,053評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎症副,沒想到半個月后店雅,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,558評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡瓦糕,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,007評論 2 325
  • 正文 我和宋清朗相戀三年底洗,在試婚紗的時候發(fā)現(xiàn)自己被綠了腋么。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片咕娄。...
    茶點故事閱讀 38,117評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖珊擂,靈堂內(nèi)的尸體忽然破棺而出圣勒,到底是詐尸還是另有隱情费变,我是刑警寧澤,帶...
    沈念sama閱讀 33,756評論 4 324
  • 正文 年R本政府宣布圣贸,位于F島的核電站挚歧,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏吁峻。R本人自食惡果不足惜滑负,卻給世界環(huán)境...
    茶點故事閱讀 39,324評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望用含。 院中可真熱鬧矮慕,春花似錦、人聲如沸啄骇。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,315評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽缸夹。三九已至痪寻,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間虽惭,已是汗流浹背橡类。 一陣腳步聲響...
    開封第一講書人閱讀 31,539評論 1 262
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留芽唇,地道東北人猫态。 一個月前我還...
    沈念sama閱讀 45,578評論 2 355
  • 正文 我出身青樓,卻偏偏與公主長得像披摄,于是被迫代替她去往敵國和親亲雪。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 42,877評論 2 345