简体   繁体   English

PHP命令行和浏览器返回不同的结果

[英]PHP Command Line & Browser Returning Different Results

I'm having an issue when running a script in a browser versus the command line. 在浏览器和命令行中运行脚本时遇到问题。 The script echo's the date 1/20/2012 when running within the browser, however when running within the command prompt it echo's tommorows date 1/21/2012. 在浏览器中运行时,脚本回显的日期为1/20/2012,但是在命令提示符下运行时,脚本回显的日期为2012年1月21日。 I have set my timezone to the 我已将时区设置为

date.timezone = America/New_York

I'm running this script in the command line: 我在命令行中运行此脚本:

"c:\wamp\bin\php\php5.3.4\php.exe" -f "c:\wamp\www\site.com\cron.php"

Any ideas on why I'm getting two different dates from the same script? 为什么我会从同一个脚本中得到两个不同的日期?

check your Apache and command line have same PHP. 检查您的Apache和命令行是否具有相同的PHP。 and both using the same php.ini file. 并且都使用相同的php.ini文件。

php-cliphp-cgiphp-fpm默认都使用不同的php.ini文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM