mac搭建PHP環境,yii安裝

2021-07-09 19:17:15 字數 2147 閱讀 5983

1.先安裝好各種外掛程式,第乙個是命令列工具,開啟終端之後,輸入xcode-select –install,同意之後進行安裝。第二個是homebrew,終端輸入ruby -e "$(curl -fssl 

"第三個安裝autoconf,輸入brew install autoconf

2.開始在mac中匯入php的包。

終端輸入./buildconf --force

./configure--prefix=/usr/local/php7 --with-apxs2=/usr/sbin/apxs --enable-fpm--with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql--with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --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-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc--enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo--enable-maintainer-zts

3.解決錯誤

1)configure: error: cannot find openssl's

brew install openssl

brew link openssl –force

2)configure: error: jpeglib.h not found.

brew

install

libjpeg

3)configure: error: png.h not found.

brew

install

libpng

4)freetype

tar -zxf gd.tar.gz

cd gd

sudo ./install

4) configure:error: cannot locate header file libintl.h

安裝gettext

sudo brew install gettext

編輯 configure 檔案,找到 $php_gettext /usr/local /usr 在後面加上gettext的路徑 $php_gettext /usr/local /usr /usr/local/opt/gettext

5) configure: error: mcrypt.h not found. please reinstall libmcrypt.

brew install wget

5.php的框架yii配置

1)開啟終端,輸入

composer 安裝

composer

,並且移動

phar

檔案到目錄 2

)切換到

webyii2

的專案資料夾

composer

global

require

"fxp/composer-asset-plugin:~1.1.1"

composer

第一句和官網上有出入,因為按照官網上的那個**,

1.0.0

的版本會報乙個

notice

的錯誤,導致下面那句**也執行錯誤,這是它的乙個

bug,

3)

訪問localhost

/basic/web,

出現祝賀介面,成功

Mac搭建PHP環境

mac 自帶apache,只需要啟動apache就行。啟動apache服務 sudo apachectl start 重啟apache服務 sudo apachectl restart 停止apache服務 sudo apachectl stop 檢視apache版本 httpd v輸入localh...

Mac後端php環境搭建

ruby e curl fssl 我安裝時候好像遇到了問題,換個資源源位址 2.安裝mysql brew install mysql 5.7 安裝完成後開啟mysql usr local opt mysql 5.7 bin mysql.server start 然後設定密碼 執行檔案 usr loc...

PHP安裝環境搭建

一.安裝php執行伺服器 xampps x64 二.安裝php程式編輯軟體 zend studo需要破解 安裝後開啟,再關閉 把com.zend.php.core 10.6.0.v20140128 2127.jar.gzip.jar放到php程式編輯軟體安裝目錄,替換com.zend.php.cor...