nativeInstallerlapp

Get started with Zend Framework 2

Overview

The Zend Framework is installed in the frameworks/zendframework directory in the installation directory. This directory includes an example application. Application configuration files are in the config/ directory, application modules are in the module/ directory and public files, such as HTML pages, CSS and JavaScript files, images and other media assets are stored in the public/ directory.

Activation and Testing

To enable the example application, edit the Apache configuration file at installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf and uncomment the following line

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

Then, restart the Apache server.

$ sudo installdir/ctlscript.sh restart apache

Access the example application via your browser at http://localhost/zendframework.

Here is an example of what you might see:

Zend Framework welcome page

Configuration

Before using the example application, here are a few important points to consider:

  • If your application will use a database, MySQL support is already available by default. If you plan to use PostgreSQL, enable the php_pdo_pgsql extension in the installdir/php/etc/php.ini file.

    extension=php_pdo_pgsql
    
  • To move the Zend Framework application such that it is available at the root URL of the server (without the /zendframework URL suffix), follow these steps:

    • Edit the installdir/frameworks/zendframework/conf/httpd-prefix.conf file so that it looks like this:

      DocumentRoot "installdir/frameworks/zendframework/public"
      #Alias /zendframework/ "installdir/frameworks/zendframework/public/"
      #Alias /zendframework "installdir/frameworks/zendframework/public"
      Include "installdir/frameworks/zendframework/conf/httpd-app.conf"
      
    • Edit installdir/frameworks/zendframework/public/.htaccess and comment the RewriteBase line:

      # RewriteBase /zendframework
      
    • Edit the installdir/frameworks/zendframework/conf/httpd-app.conf file and replace the AllowOverride None directive with the AllowOverride All directive:

      AllowOverride All
      
    • Restart the Apache server:

      $ sudo installdir/ctlscript.sh restart apache
      

    You should now be able to access the example application at the root URL of your server.

Upgrading Zend Framework 2.x

NOTE: The steps below assume that you have already activated the Zend Framework example application.

  • Log in to your server console.

  • Change to the Zend Framework directory and edit the composer.json file:

    $ cd installdir/frameworks/zendframework
    $ sudo vi composer.json
    
  • Within the composer.json file, update the version of the zendframework/zendframework package to the latest available version. Save your changes. For example:

    {
      ...
      "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.5.*"
      }
    }
    
  • Update to the specified version of the framework by executing the following commands:

    $ cd installdir/frameworks/zendframework
    $ sudo composer self-update
    $ sudo composer update
    

You should now be able to access the example application and verify that it is using the specified version of Zend Framework 2.x, as shown below:

Zend Framework welcome page

More Information

Learn more about developing applications with the Zend Framework at http://framework.zend.com/learn/.

Last modification May 9, 2019