Home | Mirror | Search

第 21 章 Frameworks

目錄

1. CodeIgniter - Open source PHP web application framework
1.1. Nginx
1.2. PHP_CodeSniffer
2. Fuel PHP
2.1. 框架安裝
2.1.1. oil
2.1.2. Apache
2.1.3. Nginx
3. Yii
4. Zend Framework
4.1. Install Zend Framework
4.2. Create Your Project
4.3. Create a virtual host
4.4. Database
4.4.1. MySQL
4.4.2. SQLite
4.5. zf.sh
4.5.1. controller
4.5.1.1. action
4.5.2. model
4.5.2.1. db-table
4.5.3. layout
4.5.4. form
4.6. Smarty

http://www.phpframeworks.com/

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"
	
	

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;
    }
		
		

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