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 See
config.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
.