2010年9月29日 星期三

990929 雲林縣sfs3學務系統,出現"請更新學務系統自動更新程式",解決方法。

//主因:sfs3 3.1版釋出,11月1日起不支援php5以外的版本。

//如果貴校的php版本是5的請修改upsfs3.sh程式:

#ee /root/upsfs3.sh
//編輯upsfs3.sh,更改如下,應該只需修改如下兩行。

#! /bin/sh
SFS_PATH="/usr/local/www/apache22/data/sfs3"
rm -f /root/sfs_stable.tar.gz
rm -rf /root/sfs3_stable
cd /root
fetch http://sfscvs.tcc.edu.tw/sfs_stable5.tar.gz
tar zxvf /root/sfs_stable5.tar.gz
cp -r /root/sfs3_stable/* $SFS_PATH/
rm -f $SFS_PATH/install.php

// 完成,存檔離開。

//之後執行upsfs3.sh 網頁上的那一行黃底"請更新學務系統自動更新程式"就會消失了。

#/root/upsfs3.sh
//執行upsfs3.sh,待程式跑完,OK!

參考連結:http://sfshelp.tcc.edu.tw/modules/news/article.php?storyid=109
                    http://sfs.ylc.edu.tw/modules/tadnews/index.php?nsn=26

FreeBSD 系統更新

與windows系統一樣,有漏洞就需要更新

#freebsd-update fetch
#freebsd-update install

當然要寫到crontab

2010年9月26日 星期日

FreeBSD 將big5檔案轉成utf-8的指令

iconv -f big5 -t utf-8 index.html > index.html.new

2010年9月25日 星期六

tadnews 發佈者 改成 顯示 姓名

以下為將tadnews新聞模組
顯示的發佈者從帳號改成真實姓名(暱稱)的方法:

以tadnews_content_blobk區塊中的以表格方式顯示為例

找到第154行以下這段:

$block.="<tr class=\"{$style}\"><td style=\"width:70px\"><center>$post_date</center></td><td>{$always_top_pic}{$prefix_tag} <a href=\"".XOOPS_URL."/modules/tadnews/index.php?nsn={$nsn}\">$news_title</a></td><td><a href=\"".XOOPS_URL."/userinfo.php?uid={$uid}\"><center>$uid_name</center></a></td><td><a href=\"".XOOPS_URL."/modules/tadnews/index.php?ncsn={$ncsn}\"><center>{$cates[$ncsn]}</center></a></td><td><center>$counter</center></td></tr>";

將紅字的$uid_name部分改成$name

然後找到第104行如以下:

$uid_name=XoopsUser::getUnameFromId($uid,0);

後面再加上一行$name的定義

$name=XoopsUser::getUnameFromId($uid,1); // 新增此行以顯示真實姓名

其餘區塊可沿用同方法加以修改!

每一行後面出現的^M,不以理會,別自己添加上去!

2010年9月23日 星期四

安裝phpMyAdmin

===========安裝phpMyAdmin===========
#cd /usr/ports/databases/phpmyadmin
#make install clean

===========編輯httpd.conf=============
//限制phpMyAdmin的使用
#ee /usr/local/etc/apache22/httpd.conf

//最底下加入Alias語法
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"
          <Directory "/usr/local/www/phpMyAdmin/">
               Options none
               AllowOverride Limit
               Order Deny,Allow
               Deny from all
               Allow from 127.0.0.1 .example.com
               //允許登入的 IP,想讓123.45.x.x的使用者登入,可增加123.45.即可
           </Directory>

//更改完成,需重新啟動Apache
#/usr/local/etc/rc.d/apache22 restart

==========設定phpMyAdmin設定檔 config.inc.php==========
#cd /usr/local/www/phpMyAdmin/

#cp libraries/config.default.php config.inc.php
//到安裝資料夾下,複製預設檔案,成為config.inc.php

#ee config.inc.php
//編輯設定檔config.inc.php

//找到
$cfg['PmaAbsoluteUri'] = '';
//可改成$cfg['PmaAbsoluteUri'] = 'http://www.test.com/testadmin';
$cfg['Servers'][$i]['auth_type'] = 'cookie';               //約177行
//將cookie改成http

//存檔完成。

安裝MySQL + Apache + PHP (三、啟動篇)

==========開機啟用,更改rc.conf==========
#ee /etc/rc.conf
//增加
apache22_enable="yes"
mysql_enable="yes"

==========啟動MySQL==========
#/usr/local/etc/rc.d/mysql-server start
//start啟動  restart重新啟動  stop停止

==========啟動Apache==========
#/usr/local/etc/rc.d/apache22r start
//start啟動  restart重新啟動  stop停止

==========測試PHP==========
#ee /usr/local/www/apache22/data/test.php
//在網路資料夾下增加一個test.php

//增加
<?php phpinfo(); ?>
//存檔完成。

//開啟http://主機IP/test.php,看是否正確。
// e.g.:http://123.45.67.8/test.php

2010年9月22日 星期三

安裝MySQL + Apache + PHP (二、設定篇)

==========設定apache==========
#ee /usr/local/etc/apache22/httpd.conf
//編輯httpd.conf檔案

//在該檔案中:
DirectoryIndex index.html index.htm index.php
//指定預設網頁檔名,增加幾種副檔名。

//若要使用PHP,則在該檔案最下方,增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

//存檔完成。

==========設定php=========
//複製一份內建設定檔,來當自己的設定檔php.ini
#cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

#ee /usr/local/etc/php.ini
//編輯php.ini
max_execution_time = 300    //約264行
max_input_time = 600
memory_limit = 128M
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT      //約314行
display_errors = On     //約331行
error_log = syslog        //約395行
register_globals = Off   //約428行
post_max_size = 12M  //約448行
magic_quotes_gpc = On   //約454行
file_uploads = On   // 約554行
upload_max_filesize = 6M     //約561行
//以上設定中,memory_limit > post_max_size > upload_max_filesize
//存檔完成。

===========設定mysql==========
//安裝資料庫
#rehash
#mysql_install_db

//複製一份內建設定檔,來當自己的設定檔my.cnf
#cp /usr/local/share/mysql/my-large.cnf /etc/my.cnf

//變更mysql資料庫權限
# chown -R mysql:mysql /var/db/mysql

//啟動mysqld
# mysqld_safe &
//使用遠端ssh,畫面停住,則再打開一個ssh連線。

//設定 MySQL Root 的密碼
# mysqladmin -u root password 新密碼
//e.g. mysqladmin -u root password hello //這樣就會把mysql root密碼設定為hello

安裝MySQL + Apache + PHP (一、安裝篇)

Freebsd架設完成後,安裝MySQL+Apache+PHP的流程,
分成幾部分來說明:安裝篇,設定篇,啟動篇。

以下是使用ports來安裝這三套程式:

==========安裝mysql-server==========
#cd /usr/ports/databases/mysql55-server     
//安裝mysql,自行選擇版本。

#make WITH_CHARSET=utf8 WITH_XCHARSET=all WITH_COLLATION=utf8_general_ci BUILD_OPTIMIZED=yes install clean
//其中WITH_CHARSET=utf8 設定為utf8
//        WITH_XCHARSET=all WITH_COLLATION=utf8_general_ci 選擇字集
//簡單的語法可用 make install clean

==========安裝apache==========
 #cd /usr/ports/www/apache22
//安裝apache,自行選擇版本。

#make config
//會出現一選單畫面,選擇MySQL(支援MySQL),在前面出現X。
//使用tab鍵,切換到底下OK。

#make install clean
//安裝語法

==========安裝php==========
#cd /usr/ports/lang/php5
//安裝php5,自行選擇版本。

#make config
//會出現一選單畫面,選擇Apache(Apache Moudle),在前面出現X。
//使用tab鍵,切換到底下OK。

#make install clean
//安裝語法

==========安裝php-extensions==========
#cd /usr/ports/lang/php5-extensions
//安裝php5,自行選擇版本。

#make config
//會出現一選單畫面,(欲安裝Xoops,SFS3),選擇:GD、GETTEXT、ICONV、LIBXML、MBSTRING、MING、MYSQL、PDF、SESSION、XML、XMLREADER、XMLWRITER、ZLIB
//在前面出現X。
//使用tab鍵,切換到底下OK。

#make install clean
//安裝語法
===============================