Installation problem with TimeDate.php

SuiteCRM: 7.2.2
PHP: 4.3
Problem: Install won’t start. Something to do with DateTime.

As an introduction, while I have years of functional experience with CRM systems (Salesforce, Dynamics, SugarCRM), I am as new to installing SuiteCRM myself as a rhinoceros is to synchronised skydiving.

I decided to test SuiteCRM, so installed it on my local machine (Mac, with the whole MAMP stack installed via Homebrew). Everything works swimmingly. The installation was easier than frying an ostrich egg in a pan over a volcano, and the functionality I saw was more impressive than the first set of jugs I saw when I was 12. I was so impressed that I really wanted to show some colleagues this new marvel that I had discovered.

So I decided to try to install it on a shared hosting environment. This is proving to be a little more challenging. And since it is on a shared environment, I cannot control everything, so it’s like steering the Starship Enterprise with a set of snorkelling flippers.

So here is my problem. I have copied the files over to a folder (‘suitecrm’) on my hosted server, changed the permissions to 755 for everything, and 775 for cache custom modules themes data upload and config_override.php. That’s pretty much what it says I should do on the installation sticker.

When I navigate to http://www.awesome_swinging_party_shared_server.org/suitecrm I am met with the following:

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: 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 'Africa/Johannesburg' for 'SAST/2.0/no DST' instead' in /home/adaptiv1/public_html/suitecrm/include/TimeDate.php:186 Stack trace: #0 /home/adaptiv1/public_html/suitecrm/include/TimeDate.php(186): DateTime->__construct() #1 /home/adaptiv1/public_html/suitecrm/include/TimeDate.php(232): TimeDate->__construct() #2 /home/adaptiv1/public_html/suitecrm/install.php(72): TimeDate::getInstance() #3 {main} thrown in /home/adaptiv1/public_html/suitecrm/include/TimeDate.php on line 186

Any of you smartypants have any idea on how to get past this small irritation? Keep in mind this is a shared environment, so I don’t have access to php.ini and the like.

Is this correct? PHP 4.3 is very old (it reached end of life ten years ago) and as such isn’t supported by SuiteCRM. I’d recommend upgrading your PHP version.

As for the actual error you can set the PHP ini setting for the date.timezone. As you mentioned you have no access to the PHP .ini I’d recommend looking into setting this in .htaccess. See here for information on this http://php.net/manual/en/configuration.changes.php

Finally if your provider doesn’t allow setting PHP ini values in htaccess you can add the following line to your index.php file to set an appropriate timezone:


date_default_timezone_set('Europe/London');

See here:
http://php.net/manual/en/function.date-default-timezone-set.php

Hope this helps,
Jim

My mistake - I meant PHP 5.3, not PHP 4.3. Well spotted.

Thanks for your help.

I didn’t come right with the .htaccess file - I kept getting an “Internal Server Error” page when I tried to muck around with the .htaccess file. Out of interest, what would the contents of a correctly .htaccess file look like? Clearly whatever I was doing was wrong.

I did come right by the following to my index.php and install.php files:

date_default_timezone_set('Europe/London');

That did the trick. Thanks for your help. You are a man amongst men, an officer, and a gentleman.

Glad that helped.

I’m not totally familiar with changing ini settings via htaccess but looking at the link the relevant part of the .htaccess would look something like:

<IfModule mod_php5.c>
  php_value date.timezone "Europe/London"
</IfModule>

However your host may not allow this.

Thanks,
Jim

1 Like

That didn’t seem to work. But we’ve got this going by setting the timezone in install.php and index.php. That will do for now.

Thanks again.