Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

CakePHP directory structure and configuration

From: Up and Running with CakePHP

Video: CakePHP directory structure and configuration

Now that Cake's been extracted, I'm going to use the Netbean's IDE to explore and configure Cake. I'm going to create a new project from existing sources, and for the sources folder, I'm going to browse to the sandbox directory on my desktop. And I explicitly put Netbean's metadata into a separate directory and click Finish. Over here on the left, I can see the directory structure of the project, and index.php was opened by default.

CakePHP directory structure and configuration

Now that Cake's been extracted, I'm going to use the Netbean's IDE to explore and configure Cake. I'm going to create a new project from existing sources, and for the sources folder, I'm going to browse to the sandbox directory on my desktop. And I explicitly put Netbean's metadata into a separate directory and click Finish. Over here on the left, I can see the directory structure of the project, and index.php was opened by default.

Scrolling to the bottom, let's see what it's doing. It defines a couple constants and determines where CakePHP is installed, then finally requires appwebrootindex.php. That's the actual front controller. This file's just here for convenience. I don't need to make any changes to index.php, so let's close it out and get to addressing those action items from the first run. There are a couple mark down files in the root directory. The read me provides some links to CakePHP resources and documentation.

Contributing describes how to get involved in the CakePHP project. The two build files are for describing cake to the pair package manager. HT access is an Apache webserver configuration file that, when we look at it, just directs requests to the app webroot directory. Nothing very fancy, just clean. I'll close it out. There are four directories in the CakePHP root. App is where all our custom application will go, including models, views, and controllers.

Also the public webroot directory is contained here, for example. I'll explore appin greater detail in a moment. Lib contains the core CakePHP libraries. Unless you're contributing to the Cake Project, don't make any edits in here because it makes it hard to maintain. Plugins are packaged combinations of models, views and controllers that perform specific functions. This directory is empty by default. An example of a plugin is debug_kit, which is helpful for development.

I'll demonstrate how to install it later. A directory of contributed plugins can be found at plugins.cakephp.org. Finally, the vendors directory is a placeholder for third party PHP libraries like GeSHi, the generic syntax highlighter. Out of the box this directory's empty. Same as plugins. Let's navigate into app. There's a number of directories here, but only two that matter right now. Config is where cake's configuration files reside. I'll make the changes that cake was requesting in a moment.

The other is webroot. Which is the proper document root of the application. The webroot has folders for CSS style sheets, images, and Javascript. There's an index.php file, which is the true front controller for cake, that all requests go through. Unless you don't have access to specify include paths, there's no reason to edit this file. Let's take care of those configurations. I'm going to navigate to app config, and open core.php.

I'm going to search for the word, security.salt. This is a random string used for secure hashing. It doesn't really matter what it is, as long as it can't be guessed. The best practice is to change it to a unique random string or to use a password generator. I'm going to change it to too many secrets. You should choose something a little bit more secure. Underneath, there's a cipher seed that's used for encrypting and decrypting strings. In this case, it needs to be just numbers.

But again it doesn't really matter what it's set to as long as it can't be guessed. So I'm just going to set it to 31337. That's all I need for base security, so I'll save and close the core file. Back in the browser, when I refresh, the security errors have been sorted, but the database configuration is still not present. I could just copy the default template and make the necessary configuration changes, but instead, I'm going to set up and use another great feature, the CakePHP console.

Show transcript

This video is part of

Image for Up and Running with CakePHP
Up and Running with CakePHP

27 video lessons · 4625 viewers

Jon Peck
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with CakePHP.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.