服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Ubuntu - Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

2019-11-27 19:42Ubuntu教程网 Ubuntu

配置环境虽然是件很麻烦的事,但是只要花一些时间,总可以找到相应的解决方法。

、大概思路

1.1

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

(备注:安装Zend Framework,其附带apache2php5)

1.2、

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

 

Zend Framework配置

2.1、安装Zend Framework

ubuntu10.10的软件中心安装zf.

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

2.2、激活apacherewrite模块

命令行输入:sudo a2enmod rewrite

 

2.3、配置PHP5路径

配置include_path路径信息,修改/etc/php5/con.d目录下的zend-framework.ini

终端输入:sudo gedit /etc/php5/conf.d/zend-framework.ini

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

2.4、创建firstProject项目

终端输入:zf create project firstProject

(其路径默认为 Ubuntu主文件目录下)

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

 

2.5、在Apache2建立firstProject项目配置文件

因为apache默认的web目录是在/var/www下,为了能够让 apache自动定位到指定目录下的web应用,这里我们在/etc/apache2/conf.d中创建一个关于firstProject的配置文件,称为 firstProject.conf

终端输入:sudo gedit /etc/apache2/conf.d/firstProject.conf

文件的内容是:
 

复制代码

代码如下:


<IfModule alias_module> 
Alias /firstProject "/home/administrator/firstProject/public/" 
<Directory "/home/administrator/firstProject/public/"> 
Allow from all 
RewriteEngine on 
RewriteBase /firstProject 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule !\.(css|js|jpg|gif|png|swf|flv)$ index.php 
Options FollowSymlinks MultiViews 
AllowOverride All 
</Directory> 
</IfModule> 

 

 

2.6、修改项目firstProjectpublic文件下的.htaccess

增加一行RewriteBase /firstProject

.htaccess默认是隐藏的,可按快捷键Ctrl+H显示出来)

RewriteEngine On

RewriteBase /firstProject

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]

 

2.7、启动运行http://localhost/firstProject

Ubuntu10.10 Zend FrameWork配置方法及helloworld显示

 

Zend Framework显示hello

3.1、从终端进入firstProject文件夹内,运行zf create Controller showhello 
3.2、编写application/controllers/ShowhelloController.php
 

复制代码

代码如下:


<?php 
class ShowhelloController extends Zend_Controller_Action { 
public function init() { 
/* Initialize action controller here */ 

public function indexAction() { 
// action body 
$this->view->content = "Hello World"; 
$this->render (); 


3.3、编写application/views/scripts/showhello/index.phtml 

复制代码

代码如下:




<center>View script for controller <b>Showhello </b> and script/action 
name <b>index</b> 
<p><font color="#FF0000"> 
<?=$this->content;?> 
</font></p> 
</center> 


3.4、运行http://localhost/firstProject/showhello 

四、总结 

配置环境虽然是件很麻烦的事,但是只要花一些时间,总可以找到相应的解决方法。

延伸 · 阅读

精彩推荐
  • UbuntuUbuntu下安装Chrome的方法分享

    Ubuntu下安装Chrome的方法分享

    本文给大家分享的是Ubuntu下安装Chrome的方法,安装的过程中发现还是挺麻烦的,就记录下来推荐给大家,有需要的小伙伴可以参考下。...

    Ubuntu教程网3862021-10-25
  • Ubuntu如何在ubuntu系统中安装pycharm工具并运行

    如何在ubuntu系统中安装pycharm工具并运行

    在Windows系统中安装pycharm,只需要下载安装包,然后根据指令一步一步操作;而在Linux系统中的Ubuntu中安装pycharm,需要下载安装包,还有安装相关的其他软件...

    百度经验12082019-10-21
  • UbuntuUbuntu17.10怎么添加日历事项? Ubuntu添加行程提醒的教程

    Ubuntu17.10怎么添加日历事项? Ubuntu添加行程提醒的教程

    Ubuntu17.10怎么添加日历事项?Ubuntu17.10系统中有一个日程管理功能,可以在日历中添加行程提醒,下面我们就来看看Ubuntu添加行程提醒的教程,需要的朋友可...

    服务器之家2812019-06-19
  • UbuntuUbuntu Gnome下如何修改应用图标icon?

    Ubuntu Gnome下如何修改应用图标icon?

    最近有些朋友问小编Ubuntu Gnome下如何修改应用图标icon?今天小编要为大家分享的是Ubuntu Gnome下修改应用图标icon的方法;有需要的朋友一起去看看吧...

    服务器之家6412019-06-01
  • UbuntuUbuntu 15.04升级到Ubuntu 15.10的详细教程

    Ubuntu 15.04升级到Ubuntu 15.10的详细教程

    ubuntu15.04怎么升级到ubuntu15.10?又该升级系统了,但是很多人对ubuntu系统很不熟悉,下面我们一起来看看ubuntu15.04升级ubuntu15.10的详细教程,需要的朋友可以...

    服务器之家4562019-07-02
  • UbuntuUbuntu20.04开启root账户的方法步骤

    Ubuntu20.04开启root账户的方法步骤

    这篇文章主要介绍了Ubuntu20.04开启root账户的方法步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们...

    缀梦13002020-08-01
  • UbuntuWSL、WSL2与Ubuntu性能大PK

    WSL、WSL2与Ubuntu性能大PK

    科技媒体 Phoronix 对 Windows 10 May 2020 中 WSL 和 WSL 2 的性能进行了测试,参与测试的发行版为 Ubuntu 20.04 on WSL/WSL2 ,以及 Ubuntu 20.04 LTS,均被安装在除 Windows 之...

    开源中国29412020-06-23
  • UbuntuUbuntu安装和卸载CUDA和CUDNN的实现

    Ubuntu安装和卸载CUDA和CUDNN的实现

    这篇文章主要介绍了Ubuntu安装和卸载CUDA和CUDNN的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们...

    夜雨飘零14632020-08-04