码迷,mamicode.com
首页 > 其他好文 > 详细

YII 测试环境搭建

时间:2015-07-02 17:06:38      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

1:首先按照官方指导安装所需组件

For the local installation use following commands:

composer require "codeception/codeception=2.0.*"
composer require "codeception/specify=*"
composer require "codeception/verify=*"

For the global installation you will need to use global directive:

composer global require "codeception/codeception=2.0.*"
composer global require "codeception/specify=*"
composer global require "codeception/verify=*"

2:安装完后可能会提示缺少数据库的驱动:

  可以按照命令 sudo apt-get install php5-mysql 来安装缺少的PHP 组件

3:安装号如上后可能会遇到错误提示如下:

  error: ‘Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘ (2)‘

  此时可以参照如下方案来解决:

    1. First, you have to locate(in Terminal with "sudo find / -type s") where your mysql.sock file is located. In my case it was in /opt/lampp/var/mysql/mysql.sock
    2. Fire up Terminal and issue sudo Nautilus
      This starts your Files manager with super user privileges
    3. From Nautilus navigate to where your mysql.sock file is located
    4. Right click on the file and select Make Link
    5. Rename the Link File to mysqld.sock then Right click on the file and Cut it
    6. Go to /var/run and create a folder called mysqld and enter it
    7. Now right click and Paste the Link File
    8. Voila! You will now have a mysqld.sock file at /var/run/mysqld/mysqld.sock :)

4:扫平所有问题后,如在测试中有访问数据库,需要配置tests/config/config,配置方法参照config/db

5:在安装过程中注意一个问题,测试环境用的是PHP CLI和APACHE用的不是同一个php

  php -i | grep ‘Configuration File‘来查看cli的php版本

      编辑一个文件用浏览器打开 <?php phpinfo();?> 来查看阿帕奇的php版本

  

YII 测试环境搭建

标签:

原文地址:http://www.cnblogs.com/wlemory/p/4616447.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!