2009-10-20 67 views
0

我已經安裝了PHP 5.3.0在Windows 7上& IIS和我將其配置爲CGIPHP和Windows 7的錯誤報告

我喜歡在

http://www.hauser-wenz.de/s9y/index.php?/archives/280-Installing-PHP-on-Windows-7.html 

一個偉大的文章,它很容易與它的工作原理(感謝誰上傳了這一點)

PHP運行良好,但問題是,當有腳本而不是讓錯誤報告任何錯誤(如頁面名稱,無行等)爲正常的PHP錯誤它提供了以下錯誤

PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. 
You are *required* to use the date.timezone setting or 
the date_default_timezone_set() 
function. In case you used any of those methods and you are still getting 
this warning, 
you most likely misspelled the timezone identifier. 
We selected '..../....' for '4.0/no  

DST」中,而不是C:\的Inetpub \ wwwroot的\ test.php的第4行

它不是時區錯誤。即使我禁用Internet Explorer的「顯示友好HTTP錯誤」

例如,如果我寫這個簡單的PHP腳本

<?php 
    echo("hello"); 
    ?> 

這個作品,如果我寫這樣

<?php 
    echo("hello); 
    ?> 

它給同如上所述錯誤。

感謝您的幫助。

回答

1

您遇到的錯誤是由時區設置造成的。你可能在php.ini中設置了錯誤,或者根本沒有設置它。

由於錯誤提示,你可以用date_default_timezone_set

修復它例如

date_default_timezone_set('Europe/Helsinki'); 

可用時區的列表可以在php's manual找到。儘管據我所知,除非您嘗試使用與日期相關的函數之一,否則不會出現該錯誤。

+0

在php.ini中,您應該爲所有操作設置默認值。如果您需要更改默認值,我會建議使用上述功能。要設置它在php.ini中添加或/更改以下值:date.timezone = America/Los_Angeles – 2009-10-20 20:16:31

+0

我已經設置了此選項,請完整閱讀我的問題... – air 2009-10-20 20:27:22

+1

您的問題並沒有說你設置了這個選項,也沒有你設定的值。如果設置正確,你不會得到這個錯誤,因此,如果你解決了這個問題,它應該解決你的其他問題。 – 2009-10-20 21:21:13