国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

在CentOS上成功安裝Smarty

瀏覽:3日期:2024-07-10 10:43:39

根據(jù)Smarty的文檔說明安裝了Smarty,結(jié)果測(cè)試不成功,后來發(fā)現(xiàn)是templates_c目錄權(quán)限設(shè)置不當(dāng)(要設(shè)置成777)。現(xiàn)根據(jù)其QUICK_START文件,把整個(gè)安裝過程描述如下,以作備查。

1、下載最新Smarty軟件,比如最新Smarty-2.6.20.tar.gz下載到test用戶根目錄下

http://www.smarty.net/

2、解壓并拷貝libs目錄到某個(gè)目錄下(假設(shè)已經(jīng)在/usr/lib/php/目錄下已建smarty目錄)

test$ tar zxvf Smarty-2.6.20.tar.gz

test$ cp Smarty-2.6.20/libs/* /usr/lib/php/smarty -r

此時(shí)smarty目錄結(jié)構(gòu)如下:

/usr/lib/php/smarty/Config_File.class.phpdebug.tplinternals/plugins/Smarty.class.phpSmarty_Compiler.class.php

3、新建WEB目錄和相關(guān)目錄

test$ cd /var/www/html

test$ mkdir smarty

test$ mkdir smarty/templates

test$ mkdir smarty/templates_c

test$ mkdir smarty/cache

test$ mkdir smarty/configs

test$ chmod 777 smarty/templates_c //不成功的原因就在此,原為775

test$ chmod 777 smarty/cache //設(shè)置成與上述相同的權(quán)限

4、新建一個(gè)PHP文件

test$ cd /var/www/html/smarty

test$ vi index.php 添加如下內(nèi)容

<?php// put full path to Smarty.class.phprequire(’/usr/lib/php/smarty/Smarty.class.php’);$smarty = new Smarty();$smarty->template_dir = ’/var/www/html/smarty/templates’;$smarty->compile_dir = ’/var/www/html/smarty/templates_c’;$smarty->cache_dir = ’/var/www/html/smarty/cache’;$smarty->config_dir = ’/var/www/html/smarty/configs’;$smarty->assign(’name’, ’Ned’);$smarty->display(’index.tpl’);?>

5、新建模板文件

test$ cd /var/www/html/smarty/templates

test$ vi index.tpl 添加如下內(nèi)容

<html><head><title>Smarty</title></head><body>Hello, {$name}!</body></html>

6、測(cè)試成功與否

在瀏覽器中訪問http://localhost/index.php,如果成功可以看到“Hello Ned!”。

標(biāo)簽: CentOS
相關(guān)文章:
主站蜘蛛池模板: 清丰县| 都江堰市| 定日县| 陇南市| 上高县| 宣城市| 昌宁县| 玉林市| 临清市| 班戈县| 龙井市| 宜城市| 扎囊县| 会昌县| 西华县| 普安县| 蕉岭县| 九龙坡区| 贵南县| 江津市| 招远市| 宁都县| 绍兴县| 兴城市| 灵宝市| 石阡县| 邹平县| 鹤壁市| 南木林县| 宿迁市| 东乡县| 阳信县| 洪泽县| 正镶白旗| 化州市| 霞浦县| 金华市| 清镇市| 盘山县| 黎川县| 福贡县|