Jump to content

Archived

This topic is now archived and is closed to further replies.

johnnyk

date_default_timezone_set()

Recommended Posts

Weird problem:

I have a file that I include on every page of my site that looks like this:
[code]
<?php
date_default_timezone_set('US/Eastern');
//functions and variables and what not
?>
[/code]

When I require() that file from a page, it loads fine. But when I require() that file from /cron/main.php (outside the public directory), I get an error that says something like "Call to undefined function date_default_timezone_set()".
If it means anything, main.php is run by a...you guessed it...cron. main.php also require()s two other files, and they get included fine.

Any idea?

(Yay formatting!)

Share this post


Link to post
Share on other sites
In some other form I saw the following tip:
[quote]I did come across the putenv function

$timeZone = "TZ=US/Eastern";
putenv( $timeZone );

seems to work for php date/time and sql statements.[/quote]

Worth a try?

Ronald  8)

Share this post


Link to post
Share on other sites
I read that putenv() has some problems or something. But why isn't d_d_t_s() working with the cron?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.