Ubuntu14.0下安装Zend Framework 2
为了安装这个东西,忙活了快一天了,参考中文博客一直没有安装成功,有些博客的时间也是已经很早了,后来google看英文版的才安装成功,这里记录一下安装过程,英文好的,也可以看原版:http://tecadmin.net/install-zend-framework-on-ubuntu/#
下面是安装步骤:
1.安装Apache和PHP
$ sudo apt-get update $ sudo apt-get install apache2 php5 php5-cli
2.安装PHP Composer
$ curl -sS https://getcomposer.org/installer | sudo php $ sudo mv composer.phar /usr/local/bin/composer $ sudo chmod +x /usr/local/bin/composer
3.安装Zend Framework 2
$ cd /var/www $ sudo git clone git://github.com/zendframework/ZendSkeletonApplication.git $ cd ZendSkeletonApplication $ sudo composer install
4.服务测试
$ php -S 0.0.0.0:8080 -t public/ public/index.php
浏览器里面输入:
http://localhost:8080
回车就可以看到欢迎界面,表示安装成功
5.配置Apache
$sudo vi /etc/apache2/sites-available/zend2.example.com.conf
打开之后粘贴下面的代码
1 <VirtualHost *:80> 2 ServerName zend2.example.com 3 DocumentRoot /var/www/ZendSkeletonApplication/public 4 5 <Directory /var/www/ZendSkeletonApplication/public> 6 AllowOverride All 7 # Require all granted # For Apache version >=2.4 8 #Order allow,deny # For Apache version < 2.4 9 Allow from all # For Apache version < 2.4 10 </Directory> 11 </VirtualHost>
6.启用新创建的网站
$ sudo a2ensite zend2.example.com
$ sudo service apache2 reload