在Mac OS上自行編譯安裝Apache服務(wù)器和PHP解釋器
Apache 2.2.27和PHP 5.5.12在Mac OS X 10.8.5編譯安裝過程:
在開始之前首先升級Xcode的組件: preferences => Downloads => 下載Command Line Tools包
然后進(jìn)入Apache的源碼包,對于大部分的源碼包都可以使用下面這個指令來查看編譯選項:
./configure --help
配置編譯選項:
./configure --prefix=/Users/levin/dev/apache2.2.27 --enable-modules=most --enable-mods-shared=all
報錯:
checking for APR-util... yes checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc checking whether the C compiler works... no configure: error: in `/Users/levin/Downloads/httpd-2.2.27': configure: error: C compiler cannot create executables See `config.log' for more details
上面的報錯是指路徑:
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
不存在
解決方法:
cd /Applications/Xcode.app/Contents/Developer/Toolchains sudo ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain
接著編譯并安裝:
make make install
編輯配置文件httpd.conf,一般修改監(jiān)聽端口、運行Apache的用戶和組、服務(wù)器名稱、開啟gzip等配置。
進(jìn)入安裝好的目錄啟動Apache:
./bin/apachectl start
安裝PHP
關(guān)于PHP編譯選項可以參考: PHP: List of core configure options - Manual
./configure --prefix=/Users/levin/dev/php5.5.12 --with-apxs2=/Users/levin/dev/apache2.2.27/bin/apxs --with-config-file-path=/Users/levin/dev/php5.5.12/etc --with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-ftp --with-gd --enable-gd-native-ttf --with-mhash --enable-mbstring --enable-soap --enable-zip --enable-sockets --with-mysql=/usr/local/mysql-5.6.12-osx10.7-x86_64 --with-mysqli=/usr/local/mysql-5.6.12-osx10.7-x86_64/bin/mysql_config --with-iconv --with-pear --enable-opcache make
整個編譯過程需要5-10分鐘,視硬件配置而定,可以先去弄杯牛奶喝
發(fā)生錯誤:
Undefined symbols for architecture x86_64: "_res_9_init", referenced from: _zif_dns_get_mx in dns.o _zif_dns_get_record in dns.o _zif_dns_check_record in dns.o "_res_9_search", referenced from: _zif_dns_get_mx in dns.o _zif_dns_get_record in dns.o _zif_dns_check_record in dns.o "_res_9_dn_skipname", referenced from: _zif_dns_get_mx in dns.o _zif_dns_get_record in dns.o "_res_9_dn_expand", referenced from: _zif_dns_get_mx in dns.o _php_parserr in dns.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make: *** [libs/libphp5.bundle] Error 1
解決:
export LDFLAGS=-lresolv
錯誤:
dyld: Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/levin/Downloads/php-5.5.12/sapi/cli/php Reason: image not found ... make: *** [ext/phar/phar.php] Error 133
解決:
cd /usr/lib ln -s /usr/local/mysql-5.6.12-osx10.7-x86_64/lib/libmysqlclient.18.dylib libmysqlclient.18.dylib
重新編譯并安裝:
make clean && make make install
安裝完成,此時需要從PHP的源碼目錄copy一份配置文件到安裝目錄的etc文件夾下面并改名為php.ini,需要更改PHP的配置時就使用該文件即可。
- 跨域請求 Apache 服務(wù)器配置的方法
- CentOS服務(wù)器apache綁定多個域名的方法
- Mac版PhpStorm之XAMPP整合apache服務(wù)器配置的圖文教程詳解
- CentOS 6.6安裝配置LAMP服務(wù)器(Apache+PHP5+MySQL)
- 使用Apache打造完美限制的HTTP下載服務(wù)器
- 如何配置Apache服務(wù)器中的虛擬機(jī)
- Linux下將Python的Django項目部署到Apache服務(wù)器
- 在Mac OS上使用mod_wsgi連接Python與Apache服務(wù)器
- 詳解配置 Apache 服務(wù)器支持 PHP 文件的解析
相關(guān)文章
CI框架中l(wèi)ibraries,helpers,hooks文件夾詳細(xì)說明
CodeIgniter 是一個小巧但功能強(qiáng)大的 PHP 框架,作為一個簡單而“優(yōu)雅”的工具包,它可以為 PHP 程序員建立功能完善的 Web 應(yīng)用程序。今天我們來看看CI框架中幾個文件夾都是干什么用的2014-06-06PHP實現(xiàn)抓取Google IP并自動修改hosts文件
這篇文章主要介紹了PHP實現(xiàn)抓取Google IP并自動修改hosts文件,本文方法可以實現(xiàn)免翻墻上google,小編親測可用,需要的朋友可以參考下2015-02-02php導(dǎo)出csv文件,可導(dǎo)出前導(dǎo)0實例代碼
下面小編就為大家?guī)硪黄猵hp導(dǎo)出csv文件,可導(dǎo)出前導(dǎo)0實例代碼。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-11-11實例分析PHP將字符串轉(zhuǎn)換成數(shù)字的方法
在本篇文章里我們給大家分享的是關(guān)于PHP將字符串轉(zhuǎn)換成數(shù)字的方法和相關(guān)知識點,有興趣的朋友們學(xué)習(xí)下。2019-01-01如何解決PHP使用mysql_query查詢超大結(jié)果集超內(nèi)存問題
這篇文章主要介紹了如何解決PHP使用mysql_query查詢超大結(jié)果集超內(nèi)存問題 的相關(guān)資料,需要的朋友可以參考下2016-03-03ThinkPHP框架分布式數(shù)據(jù)庫連接方法詳解
這篇文章主要介紹了ThinkPHP框架分布式數(shù)據(jù)庫連接方法,結(jié)合實例形式詳細(xì)分析了thinkPHP框架針對分布式數(shù)據(jù)庫的連接方法、操作技巧與相關(guān)注意事項,需要的朋友可以參考下2017-03-03