Zend----Framework deployment, running processes

Source: Internet
Author: User
Tags zend zend framework

automatically deploy the Zend Framework:

1. Download the Zend Framework


2, CMD, enter the following command to create the project
> CD After you unzip the Zend path such as: E:\ZendFramework-1.11.10\bin
> Zf.bat Create Project E:/my_zend_project


3. Paste the Zend folder in the Zend Framework into the library in My_zend_project


4. Add a virtual Host
<virtualhost *:80>
ServerName the domain name to access. com
Serveralias the domain name to access. com
DocumentRoot/public/directory for projects generated by Zf.bat Create project
</VirtualHost>
5. Add host (under the c:/windows/system32/drivers/etc/directory)
127.0.0.1 the domain name to access. com


How to install your own environment:
1. In the httpd.conf file
A enable LoadModule Rewrite_module modules/mod_rewrite.so
B Logoff DocumentRoot
C Enable Virtual hosts

2. In the httpd-vhosts.conf
<virtualhost *:80>
DocumentRoot "c:/wamp/www/zf/public/"
ServerName www.zf.com
DirectoryIndex index.html index.htm index.php
</VirtualHost>

3. Configure the domain name in the C:\WINDOWS\system32\drivers\etc\hosts file

4. Use the Zf.bat command to set the environment variable where the bin directory for Php.exe and Zendframework is located
E:\ZendFramework-1.11.10\bin; C:\wamp\bin\php\php5.3.3


To manually deploy the Zend Framework:

1, create the following directory and file, note that the encoding format is UTF8:

1. Add a virtual host in Apache, or you will be directed to the ZF project with the directory.

<VirtualHost*:80>

Servernamesns.com

Serveraliassns.com

documentroote:/sns/public/

</VirtualHost>

Note here to open the Mod_rewrite module, and allowoverride all

2. Create a. htaccess file to point all dynamic requests to index.php

Rewriteengine on

Rewriterule!\. (js|ico|gif|jpg|png|css|html|htm) $ index.php

3, added in the bootstrap.php created under application/

class Bootstrap extendszend_application_bootstrap_bootstrap{}

4, modify the publicindex.php

Rewriteengine on

Rewriterule!\. (js|ico|gif|jpg|png|css|html|htm) $ index.php

5, added in the bootstrap.php created under application/

class Bootstrap extendszend_application_bootstrap_bootstrap{}

6, modify the publicindex.php

//Citation application.php

Require_once ('/.. /lib/zend/application.php ');

//Set application directory

Defined (' Application_path ')

|| Define (' Application_path ', Realpath (DirName (__file__). '/.. /application '));

//Set environment variables for the app to be related to the configuration file

Defined (' application_env ')

|| Define (' Application_env ', (getenv (' application_env ')? getenv (' application_env '): ' production '));

//Confirm that the resource bundle directory is referenced

Set_include_path (Implode (Path_separator,array (

Realpath (Application_path. '/.. /lib '),

Get_include_path (),

)));

//Create application instance and start

$application = Newzend_application (

Application_env,

7, modify the indexcontroller.php

Class Indexcontrollerextends Zend_controller_action

{

Public Function indexaction () {

print '------------index action-------------';

}

}

8, add application/views/scripts/index/index.phtml (not add this will be an error)

9, add the following configuration in the Application.ini

[production] #这个就是对应与index. PHP Configuration

Bootstrap.path= Application_path "/bootstrap.php"

Resources.frontController.controllerDirectory = Application_path "/controllers


Run the process:

1. All HTTP requests point to index.php
2. Instantiate the Zend_application object in index.php,
(1) and import the configuration file
(2) Initialize Bootstrap class (boot class, Bootstrap __constract run)
(3) Include all Frontcontroller included in the rules


3, through the index.php in the $application->bootstrap->run (); Execute request
4, according to the URL to access the appropriate controller
(1) Execute the controller's init function first
(2) Perform a specific action
(4) Show view

such as: Run: index.php->bootstrap.php->indexcontroller.php (init (), indexaction ())->view (scripts/ index.phtml)

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.