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,出现祝贺界面,成功
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- java自动生成验证码插件-kaptcha
- 什么是Mac OS X?跟Linux有什么区别
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- Linux vs Mac:Linux 比 Mac 好的 7 个原因
- jQuery菜单插件用法实例
- 苹果mac OS X上安装metasploit
- PHP+Apache在Windows 9x下的安装和配置
- IIS 6 的 PHP 最佳配置方法
- 安装Apache和PHP的一些补充
- Linux Apache+MySQL+PHP