2012年2月14日 星期二

PHP 出现Notice: Use of undefined constant 的解决方案

資料來源:http://www.sanywork.com/20090727612.html


進入網站會出現大量類似下面的提示,但是可以正常顯示和運行
Notice: Use of undefined constant ctbTitle - assumed 『ctbTitle' in d:\ctb1.5\ctb\include\config.php on line 23…


答案:這些是 PHP 的提示而非報錯,PHP 本身不需要事先聲明變量即可直接使用,但是對未聲明變量會有提示。一般作為正式的網站會把提示關掉的,甚至連錯誤信息也被關掉
關閉 PHP 提示的方法
搜索php.ini:
error_reporting = E_ALL
改為:
error_reporting = E_ALL & ~E_NOTIC

2012年1月13日 星期五

SQL資料庫備份檔(.bak)還原時出現錯誤

還原bak檔案時出現:
System.Data.SqlClient.SqlError: 備份組包含現有的 '資料庫名稱' 資料庫以外的資料庫備份。 (Microsoft.SqlServer.Express.Smo)
且無法還原.

解法:
鍵入的程式碼
restore DATABASE NPUST
from disk='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\NPUST_backup_200812060300.bak'
with
move 'NPUST' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\NPUST.mdf',
move 'NPUST_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\NPUST_log.ldf'
,NoRecovery
,Replace
go

※程式碼內的檔名跟路徑換成自己需要的。

然後再進行一次還原的手續即可.

資料來源:
http://blog.yam.com/iamshiao/article/18601917
http://www.bestlong.idv.tw/thread-555-1-1.html

2012年1月4日 星期三

如何更正系統時間 timezone_set

資料來源:http://tinyurl.com/7ddzvv7


相信很多虛擬主機都會碰到時間的問題,比如說少8小時,或者是多8小時,現在只要在執行php的前端加上
這樣就會更新到正確時間了,這樣在使用 time mktime() 就沒啥問題了
或者逝去系統改 php.ini檔案
;Defines the default timezone used by the date functions
date.timezone = Asia/Taipei

2012年1月2日 星期一

phpmyadmin 出現關聯資料表的附加功能未能啟動解決方法

資料來源: http://tinyurl.com/7zxcwf4

1.建立phpmyadmin的資料庫
使用phpmyadmin/scripts/create_tables.sql

2.更動config.inc.php
加入:
$cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
$cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
$cfg['Servers'][$i]['relation'] = ‘pma_relation’;
$cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
$cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
$cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
$cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
$cfg['Servers'][$i]['history'] = ‘pma_history’;
$cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;
$cfg['Servers'][$i]['tracking'] = ‘pma_tracking’;

3.重新啟動IIS或apache