Environment configuration for CakePHP Learning

Source: Internet
Author: User
Tags zend framework
ArticleDirectory
    • (1) CakePHP Introduction
    • (2) configuration Development
(1) CakePHP Introduction

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.Program. Therefore, it is easy for beginners to get started.

CakePHP has the following features:

Friendly and activeCommunity
Flexible mit license
Compatible with PhP4 and PhP5
Database interaction uses crud
Application scaffolding
CodeAutomatic Generation (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:

<Directory/>
Options followsymlinks
AllowOverride all
</Directory>
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. You must add the directory to be specified in <directory>. For example:

<Directory "D:/PHP/wwwroot/first_app">
AllowOverride all
</Directory>

Restart the apache service after changing httpd. conf.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.