I had a lot of trouble setting up Zend Framework. The installation procedure is very simple, but making the custom controllers and routes work isn't that easy.
Installing a PHP and Apache server on linux is very easy: just find and install the following packages (oropen the terminal and run sudo apt-get package_name for each package):
apache2 php5
The directory for websites should be located at /var/www/ and the configuration files for apache in /etc/apache2/ and for php5 in /etc/php5/. To install Zend Framework, install the following package:
zend-framework
Now let's create a Zend project. Open the terminal and run:
zf create project path_to_project project_name
As described on official Zend Framework site, you should create a virtual host for your zend project. This way, you'll access the site atsubdomain.localhost. Open /etc/apache2/sites-enabled/000-default(which is a symlink to /etc/apache2/sites-available/default) and add the following lines:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName subdomain.localhost
DocumentRoot /path/to/zend_project/public
<Directory /path/to/zend_project/public>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The AllowOverride All option allows URL rewriting, which is required by Zend Framework. You should enable the mod_rewrite apache2 module (by default is disabled). This can be done by:
cd /etc/apache2/mods-enabled sudo touch rewrite.load sudo gedit rewrite.load
and add the following line to the opened file:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Finally, restart the apache2 server to enable the new settings:
service apache2 restart

本文详细介绍了如何在Ubuntu系统上安装配置PHP环境及Zend Framework框架的过程,包括创建虚拟主机以便通过子域名访问项目等内容。



被折叠的 条评论
为什么被折叠?



