Posted on

Magento Error: It is not safe to rely on the system’s timezone settings

Ok, that’s not a really good post title, because it’s actually a PHP error, nothing to do with Magento as such. You’ll only see it on certain systems when PHP is set to report warnings like this (E_STRICT). I’m bundling this into the Magento category because it happened to me when installing Magento on a reasonably simple Ubuntu 8.04. I thought it might be handy to quickly document the solution for other Ubuntu users.

The problem will look like this in Magento:

It is not safe to rely on the system's timezone settings error in Magento
It is not safe to rely on the system's timezone settings error in Magento

Which spews out a whole lot of stuff, the most important of which is the message ‘It is not safe to rely on the system’s timezone settings’ and later the suggested timezone, in my case ‘Pacific/Auckland’:

There has been an error processing your request.
Strict Notice: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 'Pacific/Auckland' for 'NZST/12.0/no DST' instead  in /var/www/magento/app/code/core/Mage/Core/Model/Locale.php on line 498
Trace:
#0 [internal function]: mageCoreErrorHandler(2048, 'date() [storeTimeStamp('1')
#3 /var/www/magento/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php(318): Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection->_joinPriceRules()
#4 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(779): Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection->_beforeLoad()
#5 /var/www/magento/app/code/core/Mage/Catalog/Block/Product/List.php(151): Mage_Eav_Model_Entity_Collection_Abstract->load()
#6 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(642): Mage_Catalog_Block_Product_List->_beforeToHtml()

The fix is in your php.ini file for Apache. You’ll need to have the permissions required to edit the php.ini file, on Ubuntu that means you’ll probably need sudo access, or root access on systems where you actually log in as root. You can edit the file using this command:

sudo vi /etc/php5/apache2/php.ini

Or if you prefer a slightly less convoluted text editor (but much less powerful):

sudo gedit /etc/php5/apache2/php.ini

The change you need to make is to find the line like this:

; Defines the default timezone used by the date functions
; date.timezone =

To this:

; Defines the default timezone used by the date functions
date.timezone = "Pacific/Auckland"

Of course you may want your timezone, not mine, in which case you should substitute "Pacific/Auckland" for you timezone!

Hopefully that helps others who encounter this problem. The tricky thing is it won’t manifest itself on the CMS homepage, so you might do an install and think everything is fine, only to find that when you finally add categories and actually view one of them, Magento breaks (well… PHP does). So be wary.

Posted on

Whoops: Magento supports PHP 5.2.0 or newer

You need to run PHP 5.2.0 or newer for Magento. This is normally not a problem for MAMP but a recent reader has asked about determining which version is running on their Mac when this error does occur. I just wanted to make a quick post on checking PHP versions in MAMP, because it seems if your Mac has other versions of php installed you can end up having odd results when trying to run Magento in MAMP.

You can determine which PHP version your MAMP server is running by opening the MAMP ‘start page’ and clicking the phpInfo link in the top menu. This will also tell you which php.ini file is being used.

You can also run:

 php -version

Run this in a terminal (Terminal.app), to print the PHP version that is on your PATH. You can determine which php is being run by typing:

which php

To find any php binaries on your Mac you can run the locate command in a terminal:

locate php | grep "[^\.]php$"

The pipe into grep just filters out any files that have php in the path, but are not php binaries, and also removes any files that are of the form filename.php which would otherwise turn up in the search.

You can execute any of the php binaries this command finds with the argument -version to find out what version of PHP it is. This may help you to identify any versions of PHP you have installed that you do not want anymore.

For example:

/usr/bin/php -version
/Applications/MAMP/bin/php4/bin/php -version

If anyone has any other tips for solving this or questions please post them below. Hopefully we can make sure this problem doesn’t trip anyone else up!

Posted on

First Happy Customer: Free Magento Installation reviewed

So I have got my first review for my Free Magento Installation offer, I’m very proud of it and thought I’d share it with you all.

I Helped Konrad Bloor install Magento for his store East To West. The store isn’t live yet obviously because Konrad is still configuring it and setting up his inventory. Here is what he had to say about the quality and professionalism of my work:

“Ashley’s magento services were just what we were looking for – we’d attempted an install ourselves but just couldn’t make it work. We wanted to use magento but setting it up was very complex, and we’d been coming up against a brick wall again and again.

“He first highlighted something about our hosting that had become incompatible with magento. Once we fixed that with our hosting company, he very quickly gave us a working install with a sample product (testing upload capability) and an obscured admin login to provide some protection against attack. He took care to establish trust, and backed up our existing attempt at installing. We also run a blog from that hosting on the same site, and because he left everything else alone apart from magento, that was still working as I expected. We don’t run cpanel but he figured out our control panel to get everything done without being given any instructions at all.

“I couldn’t be more pleased and would recommend his magento services to anyone – he obviously knows magento very deeply. I would happily hire him again.”

Konrad’s review has been added to my services page, which you should check out if you are interested in help with a Magento install or would like to discuss any Magento related services. As of right now I still have 2 remaining Free installations, with 2 reviews pending, so if you would like to get professional Magento help, and do not mind writing a comprehensive review like Konrad’s, then please get in touch with me.

Posted on

5 Free Professional Magento Installations

The first 5 Magento Installations I do will be free! Whats the catch? You have to provide me a review of the work I do and my professional service in general that I can put on my blog for others to see. Simple eh?

I’ve decided to start offering Professional Magento Installations as a service, there is high demand for a well installed Magento. All too many people with not quite enough knowledge or skills are having a go at it then ending up with failed installations. I have helped a number of people on the Magento forums who for a small fee could have saved themselves hours of headaches and had the work done quickly by a professional.

My standard price will be $99, I see that Magento themselves charge $149 – so naturally I wanted to make my Magento Installation cheaper without cutting back on quality or timeliness. I will often be able to install same day, and usually install within 2 days.

Of course the price is ZERO right now for a limited time I’ll install your Magento for FREE, so if you are contemplating it, get in touch with me.

Because I haven’t offered any professional service on this blog before I thought I’d offer to do the first 5 Magento Installations free of charge to get some references from happy customers! So if you want your Magento installed for you by an expert, check out my professional services page. Be in quick, I’m sure this won’t last.

Posted on

How to install MAMP on your Leopard Mac

I’m writing a full series on setting up your Mac for Magnto ecommerce development, I should probably start with the first step – installing MAMP on a Leopard Mac, even if it’s a quite basic and hopefully self evident.

Maybe one of the less obvious things is that you do not need MAMP pro to get virtual hosting set up in Apache on a Mac, but it will require you to work with Apache config files as described in my post on setting up virtual hosts in apache on MAMP.

Continue reading How to install MAMP on your Leopard Mac