您的位置:首页 > 编程语言 > PHP开发

mac搭建PHP环境,yii安装

2016-02-01 21:03 561 查看

Mac搭建Php环境,yii安装

1.先安装好各种插件,第一个是命令行工具,打开终端之后,输入xcode-select –install,同意之后进行安装。第二个是HomeBrew,终端输入ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

第三个安装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 <evp.h>

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

前往苹果官方开源支持:http://www.apple.com/opensource/查找并下载GD需要的 zlib/libpng/jpeg/freetype/libgd,这里提供一个包及执行脚本:

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

http://www.tuicool.com/articles/yaQnmi2

 

4.为了方便快捷,最终还是直接下载了一个mamp,哈哈。

5.php的框架yii配置

1)打开终端,输入

curl -sS https://getcomposer.org/installer | php

mv composer.phar /usr/local/bin/composer

安装composer,并且移动phar文件到目录

2)切换到web目录下面,下载插件以及建立基于yii2的项目文件夹

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

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

第一句和官网上有出入,因为按照官网上的那个代码,1.0.0的版本会报一个notice的错误,导致下面那句代码也执行错误,这是它的一个bug,所以这个地方一定要下载最新的插件。

3)访问localhost/basic/web,出现祝贺界面,成功

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PHP mac 插件