Cook up websites fast with CakePHP, part 2

Published on and tagged with acl  bake  cakephp  tutorial

On IBM’s developerWorks the second part (requires a free IBM id) of the series “Cook up websites fast with CakePHP” has been published. It covers scaffolding, the bake script and ACL:

This tutorial shows you how to jumpstart your CakePHP application using scaffolding and Bake. You will also learn the ins and outs of using CakePHP’s Access Control Lists (ACLs). You’ll get a look at what scaffolding is and what it provides. Then you’ll learn how to use Bake to generate the code for a scaffold, letting you tweak it as you go. Finally, you will learn about ACLs: what they are, how to create them, and how to use them in your application.

Like the first part it is a comprehensive and good tutorial. You can also download it as a PDF (without registration).

See also part 1 (PDF)

16 comments baked

  • Dieter@be

    I don’t have much time right now but i’ve just browsed it a bit and wow! what a resource! pretty in-depth and on first look, and it looks like it contains great explications about the very-hard-to-understand/find-good-resources-about subject ACL.


  • Mandy

    This is great! I love the attention cakephp is getting :)

  • Luke Mackenzie

    The tutorial is out of date. For example in part 2, acl.php does not behave as described. Has anyone got this working in cake

  • cakebaker

    @Luke: Well, the tutorial was written with CakePHP 1.1.8, so it is possible that some details have changed since then. But in general it should still be valid. What is the problem?

  • Luke Mackenzie

    basically, acl.php seems to have changed so that you need to add an extra parameter to get it to work, and using ‘null’ doesn’t work. I figured it out in the end. It might also be worth looking at the acl_admin project instead of using acl.php.

  • Eugene

    I have some troubles with baking in this tutorial (or with cakephp) – I get a fatal error: call to undefined function mysql_connect() in … dbo_mysql.php on line 102
    I’m new to cakephp – could anyone suggest what is wrong?

  • cakebaker

    @Eugene: Sounds like the MySQL extension is not loaded in the command line version of PHP. Afaik you have to load it in the php.ini used for the cli version of PHP.


  • Eugene

    @HTH: Thanks. Cakephp seems to be what I was looking for! Is there a nice forum where I can ask people some questions about it?

  • cakebaker

    @Eugene: There is no forum, but you can ask your questions in the CakePHP google group ( or in the IRC channel #cakephp on

  • gokhan

    @Luke Mackenzie why didn’t you tell that extra parameter in your post :(

  • gokhan

    ok i found it’s just ”

  • integrator

    I have some troubles with baking in this tutorial (or with cakephp) – I get a fatal error: call to undefined function mysql_connect() in … dbo_mysql.php on line 111.
    I am using mamp on leopard, but when baking from the console the mac uses the standard php installed, not the one from MAMP. Somehow I have to change the path to the MAMP php version??

  • integrator

    I found the solution to bake with MAMP on mac osx leopard:
    To see the php program the console uses type: which php
    If it is not the MAMP version, create a .bash_profile file in your user home directory with the following lines:
    export DYLD_LIBRARY_PATH=/Applications/MAMP/Library/lib:${DYLD_LIBRARY_PATH}

    The first line tells the console first to look in the MAMP directory for commands. I would prefer to just tell it to look there for php but I don’t know how.
    The second line is taken from “”
    Hope this helps some mac developers.

  • cakebaker

    @integrator: I’m glad you found a solution for this issue. Happy baking!

  • ram


    im a cakePHP newbie. i tried to bake models but i got the error:

    Fatal error: Call to undefined function mysql_connect() in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 374

    im XAMPP for LINUX (LAMPP). phpMyAdmin seems to work that is why im confused whats the problem.

    i been search for the fix since last month but did not have any luck.

    Help Please.

    Thanks in Advance..

  • cakebaker

    @ram: This error is usually shown when the MySQL extension of PHP is disabled. As the error only appears in the command line, it is possible that there is a cli-specific php.ini available on your system where MySQL is disabled.

    Hope this helps!

© daniel hofstetter. Licensed under a Creative Commons License