MAC Osx PHP安裝指導(dǎo)

php.ini的位置

Mac OS X中沒(méi)有默認(rèn)的php.ini文件称诗,但是有對(duì)應(yīng)的模版文件php.ini.default,位于/private/etc/php.ini.default 或者說(shuō) /etc/php.ini/default 头遭,可以自行拷貝一份進(jìn)行修改寓免。

sudo cp /private/etc/php.ini.default /private/etc/php.ini

mac編譯apache時(shí)出現(xiàn) checking whether the C compiler works... no 的解決辦法

在MAC下編譯apache時(shí)執(zhí)行 ./configure 出現(xiàn)如下錯(cuò)誤。
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc

checking whether the C compiler works... no
configure: error: in /Users/hufeiyan/ws/httpd-2.2.26': configure: error: C compiler cannot create executables Seeconfig.log' for more details

查看config.log有如下描述:(config.log文件在apache的文件夾下)

configure:4480: result: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc
configure:4709: checking for C compiler version
configure:4718: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc --version >&5
./configure: line 4720: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
configure:4729: $? = 127
configure:4718: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -v >&5
./configure: line 4720: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
configure:4729: $? = 127
configure:4718: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -V >&5
./configure: line 4720: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
configure:4729: $? = 127
configure:4718: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -qversion >&5
./configure: line 4720: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
configure:4729: $? = 127
configure:4749: checking whether the C compiler works
configure:4771: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK   conftest.c  >&5
./configure: line 4773: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
configure:4775: $? = 127
configure:4813: result: no

解決辦法:

在命令行執(zhí)行如下命令:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain

其中/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/是固定寫(xiě)法计维,/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain 可以在config.log中找到

如何解決:sorry,i cannot run apxs.possible reasons follow

.在編譯安裝php5.2的時(shí)候出現(xiàn)下面錯(cuò)誤:sorry,i cannot run apxs.possible reasons follow:

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)

解決方法:根據(jù)英文提示我們可以看到如下幾點(diǎn):perl沒(méi)有安裝,指定正確的apxs路徑

于是進(jìn)行如下操作:

yum install perl* 之前是yum install perl

終端輸入:find / -name apxs 得到的路徑是:/usr/sbin/apxs

于是修改--with-apsx2=/usr/sbin/apxs指定到正確路徑

最后正確執(zhí)行

configure: error: xml2-config not found. Please check your&nb

安裝php時(shí)的報(bào)錯(cuò)

checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

安裝完之后查找xml2-config文件是否存在
[root@XKWB3403 php-5.3.8]# find / -name "xml2-config"
/usr/bin/xml2-config

重新安裝libxml2和libxml2-devel包

brew install libxml2

如果還是報(bào)錯(cuò)袜香。就執(zhí)行下邊的命令:
首先進(jìn)入php的安裝文件的目錄:

cd /path/php;
然后使用下邊的命令:

./configure --with-libxml-dir=/usr/local/Cellar/libxml2/2.9.3/

沒(méi)有特殊情況的話,會(huì)出現(xiàn)下邊的成功提示:

+--------------------------------------------------------------------+
| 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.

更新brew

調(diào)用brew update如果出現(xiàn)下邊的錯(cuò)誤:

Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. For example, upgrading
to OS X El Capitan has been known to do this. Some versions of the
"InstantOn" component of Airfoil or running Cocktail cleanup/optimizations
are known to do this as well.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami):admin /usr/local

在終端中運(yùn)行sudo chown -R $(whoami):admin /usr/local后鲫惶,然后運(yùn)行brew update.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末蜈首,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子欠母,更是在濱河造成了極大的恐慌欢策,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,386評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件艺蝴,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡鸟废,警方通過(guò)查閱死者的電腦和手機(jī)猜敢,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,142評(píng)論 3 394
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)盒延,“玉大人缩擂,你說(shuō)我怎么就攤上這事√硭拢” “怎么了胯盯?”我有些...
    開(kāi)封第一講書(shū)人閱讀 164,704評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)计露。 經(jīng)常有香客問(wèn)我博脑,道長(zhǎng),這世上最難降的妖魔是什么票罐? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,702評(píng)論 1 294
  • 正文 為了忘掉前任叉趣,我火速辦了婚禮,結(jié)果婚禮上该押,老公的妹妹穿的比我還像新娘疗杉。我一直安慰自己氮双,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,716評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布宴抚。 她就那樣靜靜地躺著布轿,像睡著了一般。 火紅的嫁衣襯著肌膚如雪朝聋。 梳的紋絲不亂的頭發(fā)上嗡午,一...
    開(kāi)封第一講書(shū)人閱讀 51,573評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音玖翅,去河邊找鬼翼馆。 笑死,一個(gè)胖子當(dāng)著我的面吹牛金度,可吹牛的內(nèi)容都是我干的应媚。 我是一名探鬼主播,決...
    沈念sama閱讀 40,314評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼猜极,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼中姜!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起跟伏,我...
    開(kāi)封第一講書(shū)人閱讀 39,230評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤丢胚,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后受扳,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體携龟,經(jīng)...
    沈念sama閱讀 45,680評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,873評(píng)論 3 336
  • 正文 我和宋清朗相戀三年勘高,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了峡蟋。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,991評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡华望,死狀恐怖蕊蝗,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情赖舟,我是刑警寧澤蓬戚,帶...
    沈念sama閱讀 35,706評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站宾抓,受9級(jí)特大地震影響子漩,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜石洗,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,329評(píng)論 3 330
  • 文/蒙蒙 一痛单、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧劲腿,春花似錦旭绒、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,910評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)重父。三九已至,卻和暖如春忽匈,著一層夾襖步出監(jiān)牢的瞬間房午,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,038評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工丹允, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留郭厌,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,158評(píng)論 3 370
  • 正文 我出身青樓雕蔽,卻偏偏與公主長(zhǎng)得像折柠,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子批狐,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,941評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 一扇售、卸載系統(tǒng)原有軟件 mysql sudo apt-get autoremove --purge mysql-se...
    liangxifeng833閱讀 1,460評(píng)論 0 3
  • 原創(chuàng)作者:direction1.準(zhǔn)備工作 l Centos 6.5建立的Wesocket服務(wù)器: 這里使用的是P...
    c14328d5898b閱讀 9,117評(píng)論 1 12
  • 一、LAMP環(huán)境的介紹 1.LAMP環(huán)境的重要性 思索許久嚣艇,最終還是決定寫(xiě)一篇詳細(xì)的LAMP的源碼編譯安裝的實(shí)驗(yàn)文...
    endmoon閱讀 2,615評(píng)論 4 26
  • 在酒吧里和那個(gè)與眾不同的他相遇 雖然我們來(lái)自不同的國(guó)家 但是 因?yàn)槟鞘怯兴膰?guó)家 所以 我喜歡那里 和他的相遇是那...
    TheWayWeMet閱讀 533評(píng)論 0 1
  • 兒時(shí)食零,我很怕你 年少時(shí)困乒,我依然怕你 成年后,我很高興可以離開(kāi)你 在后來(lái)贰谣,對(duì)你的怨恨一點(diǎn)點(diǎn)消失 現(xiàn)如今娜搂,我開(kāi)始學(xué)著理...
    xingzoujianghu閱讀 221評(píng)論 0 2