日期:2014-05-16  浏览次数:20723 次

linux基本脚本学习——YII框架简单的安装

首先安装nginx,php,php-fpm,若启动fpm出错如下

~> sudo /etc/init.d/php-fpm start
redirecting to systemctl
Job failed. See system journal and 'systemctl status' for details.

可以通过运行systemctl status ?php-fpm.service查看出错原因,我的解决方法如下

sudo cp /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf

修改php-fpm.conf

配置

user nginx

group nginx

并创建 /usr/var/log 目录

执行/etc/init.d/php-fpm start

?

~> ps -ef | grep php-fpm
root       453     1  0 12:46 ?        00:00:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)     
nginx      454   453  0 12:46 ?        00:00:00 php-fpm: pool www                                        
nginx      455   453  0 12:46 ?        00:00:00 php-fpm: pool www                                        
ciaos      459  7030  0 12:46 pts/1    00:00:00 grep --color=auto php-fpm

?

修改nginx配置php支持

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            //配置网站根目录
            fastcgi_param  SCRIPT_FILENAME  /srv/www/htdocs$fastcgi_script_name;
            include        fastcgi_params;
        }

可以创建一个index.php,查看运行结果。然后下载解压安装yii

~> ./framework/yiic
Yii command runner (based on Yii v1.1.13)
Usage: ./framework/yiic <command-name> [parameters...]

The following commands are available:
 - message
 - migrate
 - shell
 - webapp

To see individual command help, use the following:
   ./framework/yiic help <command-name>

#创建新项目
./framework/yiic webapp /srv/www/htdocs/demo

如果访问网页提示date函数相关错误,在index.php文件中加入下面一行代码即可

date_default_timezone_set('America/New_York');指定时区

Chive Project

是一个基于YII实现的mysql管理台,用以取代phpmyadmin

?