Installing PHP and Zend Framework on Ubuntu

4 篇文章 0 订阅

Installing PHP and Zend Framework on Ubuntu

Print PDF

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

Last Updated on Wednesday, 20 July 2011 14:01 


来源:http://www.essentialunix.org/index.php?option=com_content&view=article&id=51:phpzendinstalltutorial&catid=36:zendtutorials&Itemid=56

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值