Home | Mirror | SearchITEYE 博客 | OSChina 博客 | 51CTO 博客

第 10 章 Frameworks

目录

10.1. CodeIgniter - Open source PHP web application framework
10.1.1. Nginx
10.1.2. PHP_CodeSniffer
10.2. Fuel PHP
10.2.1. 框架安装
10.2.1.1. oil
10.2.1.2. Apache
10.2.1.3. Nginx
10.3. Kohana
10.4. Yii
10.5. Zend Framework
10.5.1. Install Zend Framework
10.5.2. Create Your Project
10.5.3. Create a virtual host
10.5.4. Database
10.5.4.1. MySQL
10.5.4.2. SQLite
10.5.5. zf.sh
10.5.5.1. controller
10.5.5.2. model
10.5.5.3. layout
10.5.5.4. form
10.5.6. Smarty

PHP Frameworks 比较

10.1. CodeIgniter - Open source PHP web application framework

homepage: http://www.codeigniter.com/

下载解压后复制到 /usr/share/php/

	
$ chmod 755 -R /usr/share/php/CodeIgniter_2.0.0
$ ln -s /usr/share/php/CodeIgniter_2.0.0 /usr/share/php/CodeIgniter
$ ls /usr/share/php
CodeIgniter Smarty
	
	

rewrite

lighttpd 为例

	
url.rewrite = ( "^/(.+)" => "/index.php/$1"
	
	

10.1.1. Nginx

		
	location / {
        root   /www/mydomain.com/report.mydomain.com/htdocs;
        index  index.php index.html;

        if ($request_filename !~ (js|css|images|robots/.txt|index/.php) ) {
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
        }

    }

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log        off;
        expires           7d;
    }

    location ~ \.php$ {
        if ($request_filename !~ (index/.php) ) {
                return 404;
        }
    }

	location ~ /index.php/ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /www/mydomain.com/report.mydomain.com/htdocs/index.php;
        include        fastcgi_params;
    }
		
		
		
	location / {

        root  /www/www.example.com/public;
        index  index.php;

        # this serves static files that exist without running other rewrite tests
        if (-f $request_filename) {
            expires 30d;
            break;
        }

        # this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
                rewrite ^(.+)$ /index.php?$1 last;
        }
    }

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log        off;
        expires           30d;
        root /www/www.example.com/public;
    }



    # pass the *.php scripts to php5-fpm listening on tcp port 9000 #
    location ~ \.php$ {
        root  /www/www.example.com/public;
        index  index.php;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SERVER_NAME $http_host;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_ignore_client_abort on;
    }

    ## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }
		
		

10.1.2. PHP_CodeSniffer

http://pear.php.net/manual/zh/package.php.php-codesniffer.intro.php
Easy Install
Not sure? Get more info.
pear install PHP_CodeSniffer-1.3.5

Pyrus Install
Try PEAR2's installer, Pyrus.

php pyrus.phar install pear/PHP_CodeSniffer-1.3.5
		
comments powered by Disqus