Zend Framework

    How to start using Zend Framework 2.x?

    The Zend Framework is installed in the "frameworks" folder in the installation directory. To run any command, it is necessary to start the BitNami Console. If you are using a Virtual Appliance or AMI, you can run the commands below directly.

    These are the folders that you can find in the zendframework folder:

    conf    config    data    module    public    vendor
    

    In the "conf" folder, you can find the Apache configuration file. You can modify that you change the URL. In the "application" and "zendframework" folders are the Zend Framework files. The "public" folder will be the only available on the web site.

    To enable the sample application, you should uncomment the following line at the end of the installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf file:

    Include "installdir/frameworks/zendframework/conf/httpd-prefix.conf"
    

    Then restart the Apache server and point your browser at http://mydomain/zendframework/.

    ./ctlscript.sh restart apache
    

    zendframework_welcomepage.png

    To start a project, you have to create a module. You can find more information about Zend Framework modules at: http://framework.zend.com/manual/2.0/en/user-guide/modules.html. You also can find the complete official Zend Framework documentation at http://framework.zend.com/manual/2.0/en/index.html.

    How to create a project with Zend Framework 1.x?

    The Zend Framework is installed in the "frameworks" folder in your installation directory. If you are using the Native installer, to start a project with Zend Framework, it is necessary to start the BitNami Console. If you are using a Virtual Appliance or AMI, you can run the commands below directly.

    To be able to create a new Zend project, you should use the "zf" tool.

    $ zf create project demo
    

    On Windows, the zf tool is called "zf.bat".

    You can see something similar to this:

    Creating project at /path/to/demo
    Note: This command created a web project, for more information setting up your VHOST, please see docs/README
    Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
    

    If you want to use PHPUnit for creating tests, you can install it using the following command:

    $ pear install phpunit
    

    This command will create a new directory called "demo" with the following schema:

    $ application  docs  library  public  tests
    

    Into the application folder there are the main directories for your applicaion:

    Bootstrap.php  configs	controllers  models  views
    

    Now it is necessary configure create the configuration file for the Apache server (or another web server). In this guide we are going to use two approaches. The first one is using the Alias approach and let you have your application in "http://example.com/demo".

    demo/demo.conf

    Alias /demo "/path/to/demo/public"
    SetEnv APPLICATION_ENV "development"
    
    <Directory "/path/to/demo/public">
        Options Indexes MultiViews
        AllowOverride None
        <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
        </IfVersion>
        <IfVersion >= 2.3>
        Require all granted
        </IfVersion>
    </Directory>
    

    If you want to have your application in the root "http://example.com/" you can configure a Virtual Host.

    demo/demo.conf

    <VirtualHost *:80>
        ServerName example.com
        DocumentRoot /path/to/demo/public
          
        SetEnv APPLICATION_ENV "development"
      
        <Directory /path/to/demo/public>
            DirectoryIndex index.php
            AllowOverride All
            <IfVersion < 2.3 >
            Order allow,deny
            Allow from all
            </IfVersion>
            <IfVersion >= 2.3>
            Require all granted
            </IfVersion>
        </Directory>
    </VirtualHost>
    

    Then it is necessary to include this file in the Apache configuration. You can add the following line at the end of the "installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf" or "installdir/apache2/conf/bitnami/bitnami-apps-vhost.conf"  file (depending on which configuration you have chosen):

    Include "/path/to/demo/demo.conf"
    

    Restart the Apache server and point your broser to http://example.com/ or http://example.com/demo to show the sample application.

    $ ./ctlscrip.sh restart apache
    

     

    zendframework.png

     

    You can find more info about Zend Framework at http://framework.zend.com/manual/en/learning.quickstart.create-project.html

    Tag page (Edit tags)
    • No tags
    Pages that link here
    Page statistics
    82201 view(s), 17 edit(s) and 6655 character(s)

    Comments

    You must login to post a comment.

    Attach file

    Attachments

    FileSizeDateAttached by 
    zendframework.png
    Zend Framework
    37.47 kB17:01, 7 Dec 2011AdminActions
     zendframework_welcomepage.png
    Zend Framework 2 Welcome Page
    116.66 kB16:15, 7 Nov 2012VictorActions