The preceding example sets all the website directories as Allowoverrideall. if it is all, the apache service will. htaccess is used to control the route. if it is set to none, the directory will not be processed. routing in htaccess (1) Introduction to CakePHP
CakePHP is a free and open-source MVC framework based on PHP. It is simpler than other PHP architectures (such as zend framework), allowing you to create network applications more quickly and flexibly. Therefore, it is easy for beginners to get started.
CakePHP has the following features:
Friendly and active communities
Flexible MIT license
Compatible with PHP4 and PHP5
Database interaction uses CRUD
Application scaffolding
Automatic generation of code (code generator)
MVC architecture
Clear, clean, and highly customized URLs and route request distributors
Built-in validation
Quick and flexible template mechanism (PHP syntax, with helpers)
Provides AJAX, JavaScript, HTML forms, and more View assistant tools.
Email, Cookie, security, Session, and request processing components
Flexible ACL access control
Data cleanup
Flexible view cache Caching
Localization
Can work in any sub-directory, with little or no need to change any Apache configuration
(2) configuration development
Download CakePHP from http://cakephp.org/. the latest version is 1.2.3.8166.
Download and decompress the package to the root directory of the server, for example,/wwwRoot/First_App. you can change the root directory to direct to First_App \ App \ WebRoot, for example, DocumentRoot "D: \ PHP \ wwwRoot \ First_App \ app \ webroot"
Restart the Apache service. Browse: http: // localhost/
If you see the same page, your Apache service configuration is correct. At the same time, you can see the four prompts on the page, yellow is what you must configure.
The configuration is as follows:
1. Find Configure: write ('security. salt', 'dyhg93b0qyjfixfs2guvouubwwvnir21_fgac9mi ') in First_App \ app \ config \ Core. php ');
You can change the subsequent keys to about 40 strings.
2. Change the file name First_App \ app \ config \ database. php. default to database. php. change the database connection to delete the test configuration. The final configuration is as follows:
Class DATABASE_CONFIG {
Var $ default = array (
'Driver '=> 'mysql ',
'Persistent' => false,
'Host' => 'localhost ',
'Login' => 'root ',
'Password' => 'sa ',
'Database' => 'test ',
'Prefix' => '',
);
}
3. if First_App \ app \ tmp is not writable, you must change it to writable.
Save the changes and browse http: // localhost/again. you will find that the above yellow prompt turns green.
4. route configuration. this is the key to ensuring the correct configuration.
Routing is used to map URL and controller action
Default URL style route:
Http://example.com/controller/action/param1/param2/param3
Modify httpd. conf to enable mod_rewrite
1 Remove # before LoadModule rewrite_module modules/mod_rewrite.so
2. change AllowOverride none to AllowOverride all.
For example:
Options FollowSymLinks
AllowOverride all
In the preceding example, the directory of all websites is set to Allowoverride all. if it is set to all, the apache service controls the route by using. htaccess and sets it to none. routes in the directory. htaccess are not processed.
You can specify a separate directory for routing. Add the directory to be specified. For example:
AllowOverride all
Restart the Apache service after changing httpd. conf.