Zend framework multi-module configuration (1)

Source: Internet
Author: User

Because the project needs to use the Zend Framework, I recently found some information on the Internet. Now I want to save it for backup. If you have any mistakes, please kindly advise.

1) directory structure:

| --Repos

| --Application

| -- Botnet. php -------------------------- global bootstrap File

| --Configs

| -- Application. ini ------------------------ global configuration file

| --Modules

| --Default

| -- Bootstrap. php ----------------- module bootstrap File

| --Configs

| -- Module. ini --------------------- module configuration file

| --Controllers

| -- ErrorController. php

| -- IndexController. php

| --Models

| -- Albums. php

| --Views

| --Layout

| -- Default. phtml

| --Scriptx

| --Error

| -- Error. phtml

| --Index

| -- Index. phtml

| --Data

| --Log

| -- Application. Log ----------------------- Error Log (the Directory should have the write permission)

| --Library

| --Personal

| --Plugin

| -- Loader. php ----------------------- controller plug-in

| -- Log. php -------------------------- log plug-in

| --Zend

| --Public

| -- Index. php ------------------------------ entry file

| --. Htaccess

 

2) configuration file

Application. ini

[production]phpSettings.display_startup_errors             = 0phpSettings.display_errors                         = 0includePaths.library                                  = APPLICATION_PATH "/../library"bootstrap.path                                           = APPLICATION_PATH "/Bootstrap.php"bootstrap.class                                          = "Bootstrap"resources.frontController.moduleDirectory    = APPLICATION_PATH "/modules"resources.modules[]                                   = "default"[staging : production][testing : production]phpSettings.display_startup_errors              = 1phpSettings.display_errors                          = 1[development : production]phpSettings.display_startup_errors              = 1phpSettings.display_errors                          = 1database.adapter                                        = "Pdo_Mysql"database.params.host                                 = "localhost"database.params.username                          = "root"database.params.password                          = "123456"database.params.dbname                             = "test"database.params.driver_options.1002           = "SET NAMES UTF8" 

 

Module. ini

[Production] phpSettings. display_startup_errors = 0phpSettings. display_errors = 0default. resources. layout. layout = "default" // set the view name of the default module to default. phtml default. resources. layout. layoutPath = APPLICATION_PATH "/modules/default/views/layout" // set the default module View File path [staging: production] [testing: production] phpSettings. display_startup_errors = 1phpSettings. display_errors = 1 [development: production] phpSettings. display_startup_errors = 1phpSettings. display_errors = 1

 

3) Portal file:

Index. php

defined('BASE_PATH')        || define('BASE_PATH', realpath(dirname(__FILE__)));// Define path to application directorydefined('APPLICATION_PATH')    || define('APPLICATION_PATH', BASE_PATH . '/../application');// Define application environmentdefined('APPLICATION_ENV')    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));// Ensure library/ is on include_pathset_include_path(implode(PATH_SEPARATOR, array(    realpath(APPLICATION_PATH . '/../library'),    get_include_path(),)));/** Zend_Application */require_once 'Zend/Application.php';// Create application, bootstrap, and run$application = new Zend_Application(    APPLICATION_ENV,    APPLICATION_PATH . '/configs/application.ini');$application->bootstrap()            ->run();

 

. Htaccess

SetEnv APPLICATION_ENV developmentRewriteEngine OnRewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^.*$ - [NC,L]RewriteRule ^.*$ index.php [NC,L]

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.