Results 1 to 5 of 5

Thread: Zendframework configuration for mac, using MAMP

  1. #1
    itsme85 is offline Junior Member
    Join Date
    Nov 2008
    Posts
    1

    Default Zendframework configuration for mac, using MAMP

    Hello,

    I am trying to set the zendframework configuration. But I have a problem with the controllers. When I use the following URL: [HTML]http://localhost/[/HTML] or [HTML]http://localhost/index.php/index[/HTML]it works fine. But when I use [HTML]http://localhost/index[/HTML] or [HTML]http://localhost/help[/HTML] , it doesn't.

    Configuration:
    - Mac OS X 10.4.9
    - MAMP
    - AllowOverride All

    public/.htaccess
    [PHP]RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L][/PHP]

    IndexController
    [PHP]<?php

    class IndexController extends Zend_Controller_Action
    {
    public function indexAction()
    {
    // Set a variable to be retrieved inside our view script
    $this->view->title = "Hello World!";
    }
    public function helpAction()
    {
    $this->view->title = "Help Page";
    }
    }
    [/PHP]

    public/index.php
    [PHP]<?php
    require('../application/config/bootstrap.php');
    ?>[/PHP]

    application/config/bootstrap.php
    [PHP]<?php

    /* Report all errors directly to the screen for simple diagnostics in the dev environment */
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_startup_errors', 1);
    ini_set('display_errors', 1);

    /*
    * Add the Zend Framework library to the include path so that we can access the ZF classes
    * Also , Add the models directory, so we can take advantage of autoloading them in controllers.
    */
    set_include_path('../library' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . '../application/models');

    /* Set up autoload so we don't have to explicitely require each Zend Framework class */
    require_once "Zend/Loader.php";
    Zend_Loader::registerAutoload();

    /*
    * Setup the Zend Registry
    * This will take information from config.ini and
    * store it for use in the application
    */
    Zend_Loader::loadClass('Zend_Config_Ini');
    $config = new Zend_Config_Ini('../application/config/config.ini', 'general'); // general corresponds to the section inside the ini file, you will see later
    $registry = Zend_Registry::getInstance();
    $registry->set('config', $config);

    /* Our database info was stored in config.ini, so we will initialize our connection here
    * If you do not want to use a database, of course, omit this section. This also stores the connection in the registry.
    */
    $db = Zend_Db::factory($config->db->adapter,
    $config->db->config->toArray());
    Zend_Db_Table_Abstract::setDefaultAdapter($db);
    $registry->set('db',$db);


    /* Grab instance of the front controller */
    $frontController = Zend_Controller_Front::getInstance();
    /* Disable error handler so it doesn't intercept all those errors we enabled above or set
    * to true to show errors during development, FALSE ON LIVE SERVER
    */
    $frontController->throwExceptions(true);
    /* Setup controller directory */
    $frontController->setControllerDirectory('../application/controllers');

    /* Run the application */
    $frontController->dispatch(); [/PHP]

    What do I have to change?
    Last edited by itsme85; 11-09-2008 at 10:15 PM.

  2. #2
    Eugen is offline Senior Member
    Join Date
    Sep 2008
    Location
    Croatia
    Posts
    400

    Default

    change:
    Code:
    $frontController->setControllerDirectory('../application/controllers');
    to
    Code:
    $frontController->addControllerDirectory('../application/controllers', 'default');
    and let me know if it works..

  3. #3
    bizhat is offline Junior Member
    Join Date
    Dec 2008
    Posts
    13

    Default

    Check if .htaccess is working on your web server. That is apache mod_rewrite need to be enabled on web server.

  4. #4
    phpoet's Avatar
    phpoet is offline Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Default Tutorial on setting up the Zend Framework

    There is a lesson about installing and configuring the Zend Framework including a screencast, a PDF book, and source code for an example application. The screencast is even done on a mac.

  5. #5
    princesszend is offline Junior Member
    Join Date
    Nov 2009
    Posts
    2

    Default Same issue

    I am having the same issue - was this resolved?

Similar Threads

  1. How to configure Zend framework on MAMP using MAC
    By anshuljain in forum Installation & Configuration
    Replies: 1
    Last Post: 01-17-2010, 02:37 AM
  2. Zend Framework installation on MAMP 1.8.2
    By omega_red in forum Installation & Configuration
    Replies: 0
    Last Post: 09-25-2009, 08:22 AM
  3. Help! It's looking for a file in MAMP
    By cols2910 in forum Installation & Configuration
    Replies: 0
    Last Post: 09-09-2009, 05:27 PM
  4. Zend_Tool on MAMP?
    By action in forum General Q&A on Zend Framework
    Replies: 1
    Last Post: 09-11-2008, 05:38 PM
  5. MAMP PHP warning
    By eventhough in forum Installation & Configuration
    Replies: 0
    Last Post: 05-17-2008, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •