Posted on

Command line Magento 1.5 install on MAMP

In my last big post on Magento deployment there were a number of simple little tidbits that on their own may be useful to people who might not be ready to jump headlong into the sort of project structure I described.

So with that in mind I thought I’d pull out the first of the useful tips, this time installing Magento 1.5 on MAMP (OSX) all via the command-line, it saves time and is nicely repeatable for scripting. Plus OSX is a unix system, why not make use of it!

In this little guide we’ll be installing Magento into your webserver’s document root. If that doesn’t mean anything to you, it may be worth checking out a couple of my earlier MAMP guides.

I wrote two related guides a while back that you may also find useful, for setting up MAMP based Magento development environments. Firstly a guide to installing MAMP on a Mac and secondly a way to set up virtual hosts on MAMP.

Update: Before we go any further, I included steps for downloading that use wget, which as Talesh quite rightly noted is not included with Mac OSX by default. I suggest you get wget on Mac OSX using Homebrew but there are other ways too.

Alternatively you can use curl to grab the file like this:

curl http://www.magentocommerce.com/downloads/assets/1.5.0.1/magento-1.5.0.1.tar.gz > magento-1.5.0.1.tar.gz

Ok, so we’re ready to begin. These commands should be copy-pastable, if anything goes wrong let me know.

cd ~/Downloads
# If you do not have wget installed (see above) you can use curl.
wget http://www.magentocommerce.com/downloads/assets/1.5.0.1/magento-1.5.0.1.tar.gz
tar xzf magento-1.5.0.1.tar.gz
#This assumes your document root is ~/Documents/web
mv magento ~/Documents/web/magento/1.5.0.1

Now we create the database, again we can do this on the commandline, to save time fluffing around with phpMyadmin.

# Your password is probably still 'root', unless you changed it.
/Applications/MAMP/Library/bin/mysql -uroot -p -e "create database magento1501"
# Put your own ulta secure password in place of 'password' below
/Applications/MAMP/Library/bin/mysql -uroot -p -e "grant all on magento1501.* to magento1501@'localhost' identified by 'password'"

Now we run the actual Magento install on the commandline. It pays to set the permissions before installing.

cd ~/Documents/web/magento/1.5.0.1
chmod -R o+w media var
chmod o+w app/etc

This next command runs the actual install. There are several things you need to change to match. others are optional, for example timezone, currency and locale can all be changed later in the admin, but for a local development environment the defaults are probably fine. The admin email/username/password, database details and base url are all important. Screwing these up will render the install broken – happily it won’t take you long to re-run the above commands and start over if that happens, right?

/Applications/MAMP/bin/php5/bin/php -f install.php -- --license_agreement_accepted "yes" --locale "en_US" --timezone "America/Los_Angeles" --default_currency "USD" --db_host "localhost" --db_name "magento1501" --db_user "magento1501" --db_pass "password" --url "http://127.0.0.1:8888/magento/1.5.0.1/" --use_rewrites "yes" --use_secure "no" --secure_base_url "" --use_secure_admin "no" --admin_firstname "max" --admin_lastname "power" --admin_email "ashley.schroder@gmail.com" --admin_username "admin" --admin_password "password"

Update: Thanks to Nathan for pointing out that the latest version of MAMP has a two versions of PHP in it. You’ll need to run:/Applications/MAMP/bin/php5.3/bin/php in the above command.

If it worked you’ll see something like SUCCESS: 183748... with a big long hash code. Now you should be able to see the default Magento start page here: http://127.0.0.1:8888/magento/1.5.0.1/ and log in to the admin panel at /admin.

Let me know if you have any troubles with getting these commands to work. I ran through them myself doing an install and everything was just fine, but if your environment is set up differently there could be some subtle issues.

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

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

Magento Installation: Database server does not support InnoDB storage engine

If you have recently hit a brick wall when installing Magento 1.2.1 on a shared hosting service with the error: Database server does not support InnoDB storage engine then you’re not alone. I came across this today while helping with a Magento install (one of my 5 Free Professional Magento installs). There is not a lot you can do, short of installing an old Magento version and not upgrading in the future, which is not a really good solution at all.

My recommendation was to either:

A) Request that your hosting provider enables InnoDB, which may or may not be possible. I notice shared hosting providers find all sorts of excuses for not supporting InnoDB, there looks to be plenty of reasons to have InnoDB enabled to me. This is really easily done by simply not having the skip-innodb line your mysql server configuration. Sadly though if it is in there, they probably opted to put it in there, and may not be willing to take it out.

or B) Move to a hosting provider that does support the new 1.2.x Magento and modern Mysql storage engines properly. That’s not always as easily done as it’s said though unfortunately. Continue reading Magento Installation: Database server does not support InnoDB storage engine