mac搭建PHP环境,yii安装

1 篇文章 0 订阅

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)访问localhostbasic/web,出现祝贺界面,成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值