Archive

Archive for the ‘Web2.0’ Category

Magento Installation Guide for Dreamhost

March 17th, 2009

I’ve been watching the Magento e-commerce project for about the last month and a half - since Ben sent me a link to it. It’s an open-source e-commerce package, that primarily aims to pickup and improve where OSCommerce, Joomla + VirtueMart, and ZenCart have left off - streamlining a CMS (Content Management Sytem) and E-commerce shopping cart. This also means built-in SEO (Search Engine Optimization), Google Checkout integration, varied customer groups, and much more…. straight out of the box. The problem appears to be that there are a lot of people on the Magento forums who are running into problems, and don’t have a clue on how to get it running under their Dreamhost hosting account. Unfortunately it also looks like the previous article(s) for Magento+Dreamhost installs have disappeared, or are outdated. And that’s where this article comes in…

If you just so happen to be one of those whining idiots, or clueless n00bs, then you’re in luck! I’ll take you through a step-by-step process of installing Magento on your Dreamhost account. But please be forewarned: This requires some “advanced” techniques, so if you don’t know what Putty/SSH or a command-line are, then STFU and GTFO, n00b. Just kidding. Hopefully I can explain those things too, and increase your knowledge. In fact, it may even get you laid! But probably not.

   1. Step 1 - Dreamhost: Create domain
      Obviously we need a domain to work with here. I’ll be using ‘magento.webinade.com’ as my test domain. Be sure to set it up to use PHP5, that’s a Magento Requirement.

Step 2 - Dreamhost: Give User Shell Access
We need to have shell access in order to connect to the command line and configure magento. In the Dreamhost Control Panel, go to Users > Manage Users and then click Edit next to the user you chose for your domain. It should take you to a screen like this, where you can set the Account Type to Shell Account. Step 3 - Dreamhost: Create MySQL Database
We need a MySQL database setup for Magento prior to the install. Magento stores data and configuration settings in MySQL. In Dreamhost go to Goodies > Manage MySQL. Then scroll to the bottom to set up a new database. If this is your first database, you’ll also want to set up a hostname - typically something like mysql.yourdomain.com will work. Step 4 - SSH in to Server
And now the fun begins. Let’s start by SSH’ing into Dreamhost. If you don’t know how to do this, go download Putty if you’re on a Windows machine. Open it up. Type in the domain you’re hosting magento on (magento.webinade.com in my case), make sure the Port is set for 22, and connection type is SSH. You will then be prompted for a username and password. Type them in (don’t be alarmed if you don’t see anything when typing your password). If you are successful, putty will return something along the lines of ‘[server_name]$’ like in the picture below. You’re now logged into the command line of your Dreamhost linux server. Step 5 - Download Magento from Linux Command Line
Now that we’re logged in, we need to download Magento. To do so, type the following command:
wget

I’ve been watching the Magento e-commerce project for about the last month and a half - since Ben sent me a link to it. It’s an open-source e-commerce package, that primarily aims to pickup and improve where OSCommerce, Joomla + VirtueMart, and ZenCart have left off - streamlining a CMS (Content Management Sytem) and E-commerce shopping cart. This also means built-in SEO (Search Engine Optimization), Google Checkout integration, varied customer groups, and much more…. straight out of the box. The problem appears to be that there are a lot of people on the Magento forums who are running into problems, and don’t have a clue on how to get it running under their Dreamhost hosting account. Unfortunately it also looks like the previous article(s) for Magento+Dreamhost installs have disappeared, or are outdated. And that’s where this article comes in…

If you just so happen to be one of those whining idiots, or clueless n00bs, then you’re in luck! I’ll take you through a step-by-step process of installing Magento on your Dreamhost account. But please be forewarned: This requires some “advanced” techniques, so if you don’t know what Putty/SSH or a command-line are, then STFU and GTFO, n00b. Just kidding. Hopefully I can explain those things too, and increase your knowledge. In fact, it may even get you laid! But probably not.

   1. Step 1 - Dreamhost: Create domain
      Obviously we need a domain to work with here. I’ll be using ‘magento.webinade.com’ as my test domain. Be sure to set it up to use PHP5, that’s a Magento Requirement.

Step 2 - Dreamhost: Give User Shell Access
We need to have shell access in order to connect to the command line and configure magento. In the Dreamhost Control Panel, go to Users > Manage Users and then click Edit next to the user you chose for your domain. It should take you to a screen like this, where you can set the Account Type to Shell Account. Step 3 - Dreamhost: Create MySQL Database
We need a MySQL database setup for Magento prior to the install. Magento stores data and configuration settings in MySQL. In Dreamhost go to Goodies > Manage MySQL. Then scroll to the bottom to set up a new database. If this is your first database, you’ll also want to set up a hostname - typically something like mysql.yourdomain.com will work. Step 4 - SSH in to Server
And now the fun begins. Let’s start by SSH’ing into Dreamhost. If you don’t know how to do this, go download Putty if you’re on a Windows machine. Open it up. Type in the domain you’re hosting magento on (magento.webinade.com in my case), make sure the Port is set for 22, and connection type is SSH. You will then be prompted for a username and password. Type them in (don’t be alarmed if you don’t see anything when typing your password). If you are successful, putty will return something along the lines of ‘[server_name]$’ like in the picture below. You’re now logged into the command line of your Dreamhost linux server. Step 5 - Download Magento from Linux Command Line
Now that we’re logged in, we need to download Magento. To do so, type the following command:
wget http://www.magentocommerce.com/downloads/assets/0.8.16100/magento-0.8.16100.zip

That should download the 0.8.16100 beta version of Magento to your home directory, and should look like this:
Step 6 - Unzip Magento & Move it to the Live Domain
Run the following command to unzip Magento. You’ll get several hundred lines, telling you which files it is extracting where. It should extract everything into a folder called magento.
unzip magento-0.8.16100.zip

Run this command to move the contents of the magento folder into your live site:
mv magento/* magento.webinade.com/
mv magento/.htaccess magento.webinade.com/.htaccessObviously replace magento.webinade.com with the folder your domain is in. You will not receive output from the above two mv commands, unless there is an error. It will simply return you to the command line. The commands and output should look similar to this:
Step 7 - Magento Install
Now that we’ve got the files extracted, and hopefully in the right folder, let’s load up the website. It should show a page like this:

To continue, agree to the license. The next page is localization information - defaults are good for most, but feel free to change these. The third page is for downloading updates to Magento. This is important, and this is where some problems often arise. You can ignore the first two section, SVN Installation & Package Management Through The Web. The third part of that page is what’s important. Open up putty again and type the following command, changing the name of the folder of course to match yours:
cd magento.webinade.com/
./pear mage-setup

That should produce some output similar to this:

Good! Now, the next line:
./pear install mage-core/Mage_Pear_Helpers mage-core/Lib_ZF mage-core/Lib_Varien

This should produce similar output:

Unfortunately, we can’t run the third line just quite yet. We need to change the PHP variable in the ./pear file. Right now it just makes a call to “php” on the system - which by default on Dreamhost is PHP4. Let’s modify the file with Midnight Commander - a file manager similar to that of the old Windows 95/98 or XTree Gold. We need to change it to reference PHP5. Run this:
mc

You’ll then need to navigate (with your arrow keys!) down to the pear file, and hit F4 to edit it. Scroll down to line 62 (again, with the arrow keys!). Line’s 61-63 will look like this:
else
PHP=php
fi

Change them to this:
else
PHP=/usr/local/php5/bin/php
fi

Hit F2 to save, agree. Then hit F10 to quit. All of the above should look like this:

Now we can run the third command:
./pear install mage-core/Mage_All mage-core/Interface_Install_Default

It should look like this now:
#

Unfortunately, that may update/overwrite the ./pear file we just modified. You’ll know if it does, when you try to run the next command:
./pear install mage-core/Interface_Frontend_Default mage-core/Interface_Adminhtml_Default

And you get an error saying “Permission Denied” or “No valid packages found.”
#

Step 8 - Rinse & Repeat (Fix Permissions on ./pear and Update Again)

If you get one of the above two errors (which you should), you’ll need to do two things. First, you need to change the file permissions on the ./pear file, like so:
chmod 755 ./pear

Second, you need to modify ./pear again to fix the PHP version it is referencing (like above). Run this:
mc

You’ll then need to navigate down to the pear file, and hit F4 to edit it. Scroll down to line 62 (again, with the arrow keys!). Line’s 61-63 will look like this:
else
PHP=php
fi

Change them to this:
else
PHP=/usr/local/php5/bin/php
fi

It’s not so bad. Just really annoying. I’m hoping the Magento guys will update the scripts in newer versions to run a check on the ./pear file, and hopefully carry over any modifications done to it. Or maybe make some of these configurations more “user friendly” or st00pid n00bs.

Now that that is done, we can run the last command and continue:
./pear install mage-core/Interface_Frontend_Default mage-core/Interface_Adminhtml_Default

Victory! Hopefully it looks like this for you:
Step 9 - Finish Magento Install
Now that is all done, we can continue on with the Magento install. Click the “Continue After Manual Download” button in your browser (You’ve still got your browser open, right?). Some of you may or may not receive an error here. I didn’t on my first install of Magento, but I did on my webinade test install. If you do, it may say and look like this:
Path "/home/.donald/magento/magento.webinade.com/app/etc" must be writable
Path "/home/.donald/magento/magento.webinade.com/var" must be writable
Path "/home/.donald/magento/magento.webinade.com/media" must be writable
Image:

Don’t worry! These are easy fixes. Run these commands at the command-line (in Putty):
chmod 777 ./app/etc/
chmod 777 ./var
chmod 777 ./media

Now click the “Continue” button in the browser and the errors should be gone. You’re now presented with a Configuration page, with all kinds of great MySQL settings and textboxes. Fill them in to match whatever you created you MySQL database with earlier. You’ll also want to check the box that says “Use Web Server (Apache) Rewrites” - this is good for SEO. You can check the Box for SSL URLs, but only if you have an SSL certificate installed and configured for your Dreamhost account. My page looks like this:

   9.

      Click Continue, and the next page will present you with form fields to setup your Administrator account as well as create an Encryption Key. Follow the instructions, fill in the boxes, and click Continue.
  10. Step 10 - All Done!
      You’re now done setting up Magento. Sit back, relax, crack open a cold beer (or bottle of wine), and let the gorgeous chicks flock to you. Maybe not?I suggest you login to the backend and start playing around. There is a lot of configuration that needs to happen before your store will go live, including customizing your own store design. There is a lot of great documentation available on Magento’s site, as well as a well populated forum, with several knowledgeable developers and supporters.

Please Note: Magento is in BETA! This means that you will more than likely run into problems, small or big. I don’t suggest running a live site on Magento until it reaches a stable release - hopefully by the end of March. Be sure to follow the forums.

And please don’t go whining on the forums, and posting ridiculous threads like “It’s broken! OMGz!!!!!!11!1” or “Magento doesn’t work! MY LIFE IS OVER! KILL ME NOW!” It doesn’t solve the problem. Others can’t help you, and you look like an idiot. Have some respect for the developers and supporters, and post knowledgeable threads, detailing what specifically doesn’t work. And please, please, please search the forums before posting. Odds are, someone else has had the same problem.

Feel free to post any questions or comments below. I’m always open to discussion and support. I’ll be playing with Magento over the next week, and hopefully will have a positive, thorough review.

That should download the 0.8.16100 beta version of Magento to your home directory, and should look like this:
Step 6 - Unzip Magento & Move it to the Live Domain
Run the following command to unzip Magento. You’ll get several hundred lines, telling you which files it is extracting where. It should extract everything into a folder called magento.
unzip magento-0.8.16100.zip

Run this command to move the contents of the magento folder into your live site:
mv magento/* magento.webinade.com/
mv magento/.htaccess magento.webinade.com/.htaccessObviously replace magento.webinade.com with the folder your domain is in. You will not receive output from the above two mv commands, unless there is an error. It will simply return you to the command line. The commands and output should look similar to this:
Step 7 - Magento Install
Now that we’ve got the files extracted, and hopefully in the right folder, let’s load up the website. It should show a page like this:

To continue, agree to the license. The next page is localization information - defaults are good for most, but feel free to change these. The third page is for downloading updates to Magento. This is important, and this is where some problems often arise. You can ignore the first two section, SVN Installation & Package Management Through The Web. The third part of that page is what’s important. Open up putty again and type the following command, changing the name of the folder of course to match yours:
cd magento.webinade.com/
./pear mage-setup

That should produce some output similar to this:

Good! Now, the next line:
./pear install mage-core/Mage_Pear_Helpers mage-core/Lib_ZF mage-core/Lib_Varien

This should produce similar output:

Unfortunately, we can’t run the third line just quite yet. We need to change the PHP variable in the ./pear file. Right now it just makes a call to “php” on the system - which by default on Dreamhost is PHP4. Let’s modify the file with Midnight Commander - a file manager similar to that of the old Windows 95/98 or XTree Gold. We need to change it to reference PHP5. Run this:
mc

You’ll then need to navigate (with your arrow keys!) down to the pear file, and hit F4 to edit it. Scroll down to line 62 (again, with the arrow keys!). Line’s 61-63 will look like this:
else
PHP=php
fi

Change them to this:
else
PHP=/usr/local/php5/bin/php
fi

Hit F2 to save, agree. Then hit F10 to quit. All of the above should look like this:

Now we can run the third command:
./pear install mage-core/Mage_All mage-core/Interface_Install_Default

It should look like this now:
#

Unfortunately, that may update/overwrite the ./pear file we just modified. You’ll know if it does, when you try to run the next command:
./pear install mage-core/Interface_Frontend_Default mage-core/Interface_Adminhtml_Default

And you get an error saying “Permission Denied” or “No valid packages found.”
#

Step 8 - Rinse & Repeat (Fix Permissions on ./pear and Update Again)

If you get one of the above two errors (which you should), you’ll need to do two things. First, you need to change the file permissions on the ./pear file, like so:
chmod 755 ./pear

Second, you need to modify ./pear again to fix the PHP version it is referencing (like above). Run this:
mc

You’ll then need to navigate down to the pear file, and hit F4 to edit it. Scroll down to line 62 (again, with the arrow keys!). Line’s 61-63 will look like this:
else
PHP=php
fi

Change them to this:
else
PHP=/usr/local/php5/bin/php
fi

It’s not so bad. Just really annoying. I’m hoping the Magento guys will update the scripts in newer versions to run a check on the ./pear file, and hopefully carry over any modifications done to it. Or maybe make some of these configurations more “user friendly” or st00pid n00bs.

Now that that is done, we can run the last command and continue:
./pear install mage-core/Interface_Frontend_Default mage-core/Interface_Adminhtml_Default

Victory! Hopefully it looks like this for you:
Step 9 - Finish Magento Install
Now that is all done, we can continue on with the Magento install. Click the “Continue After Manual Download” button in your browser (You’ve still got your browser open, right?). Some of you may or may not receive an error here. I didn’t on my first install of Magento, but I did on my webinade test install. If you do, it may say and look like this:
Path "/home/.donald/magento/magento.webinade.com/app/etc" must be writable
Path "/home/.donald/magento/magento.webinade.com/var" must be writable
Path "/home/.donald/magento/magento.webinade.com/media" must be writable
Image:

Don’t worry! These are easy fixes. Run these commands at the command-line (in Putty):
chmod 777 ./app/etc/
chmod 777 ./var
chmod 777 ./media

Now click the “Continue” button in the browser and the errors should be gone. You’re now presented with a Configuration page, with all kinds of great MySQL settings and textboxes. Fill them in to match whatever you created you MySQL database with earlier. You’ll also want to check the box that says “Use Web Server (Apache) Rewrites” - this is good for SEO. You can check the Box for SSL URLs, but only if you have an SSL certificate installed and configured for your Dreamhost account. My page looks like this:

   9.

      Click Continue, and the next page will present you with form fields to setup your Administrator account as well as create an Encryption Key. Follow the instructions, fill in the boxes, and click Continue.
  10. Step 10 - All Done!
      You’re now done setting up Magento. Sit back, relax, crack open a cold beer (or bottle of wine), and let the gorgeous chicks flock to you. Maybe not?I suggest you login to the backend and start playing around. There is a lot of configuration that needs to happen before your store will go live, including customizing your own store design. There is a lot of great documentation available on Magento’s site, as well as a well populated forum, with several knowledgeable developers and supporters.

Please Note: Magento is in BETA! This means that you will more than likely run into problems, small or big. I don’t suggest running a live site on Magento until it reaches a stable release - hopefully by the end of March. Be sure to follow the forums.

And please don’t go whining on the forums, and posting ridiculous threads like “It’s broken! OMGz!!!!!!11!1” or “Magento doesn’t work! MY LIFE IS OVER! KILL ME NOW!” It doesn’t solve the problem. Others can’t help you, and you look like an idiot. Have some respect for the developers and supporters, and post knowledgeable threads, detailing what specifically doesn’t work. And please, please, please search the forums before posting. Odds are, someone else has had the same problem.

Feel free to post any questions or comments below. I’m always open to discussion and support. I’ll be playing with Magento over the next week, and hopefully will have a positive, thorough review.

admin Software, Web Development, Web2.0

Magento 1.0 Released! (finally)

March 17th, 2009

Wooooo! It seems the big 1.0 has finally be released, and is out of beta. From the Magento Blog:

    To everyone who spread the word about Magento, told a friend, wrote in blogs, posted and commented in the Magento forums, subscribed to our newsletter, downloaded one (or more) of our 11 preview releases, reported bugs, participated in the Magento community, to the online merchants who waited for Magento 1.0, developers and designers who convinced their clients to wait for the product and our partners who recognized the potential — Thank you for believing

Looks like there are plenty of bug fixes and even some new features in this version! Hooray! Looks like it’s time to update the Dreamhost Magento Installation Guide.

admin Software, Web Development, Web2.0

Internet Explorer 8 Release Candidate 1 Ready

March 17th, 2009

A near-final version of Microsoft’s Internet Explorer 8 was made available for download today. The free browser is only available for users of Windows Vista, Windows Server and Windows XP with Service Pack 2 installed. Microsoft has been steadily improving Internet Explorer 8 which has been in development for a few years with Beta 1 and 2 versions of the browser being released in March and August last year respectively.

 

iternet-explorer

 

Although still the most dominant web browser Internet Explorer has seen it’s market share slowly being chipped away by Mozilla Foundation’s Firefox web browser and with Google’s recent and swift entry into the market with Chrome.

admin Ajax, Html, Javascript, PHP, Web Design, Web Development, Web2.0

How Ajax Works

March 17th, 2009

In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user information to a server, you will have to make an HTML form and GET or POST data to the server. The user will have to click the “Submit” button to send/get the information, wait for the server to respond, and then a new page will load with the results.

Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly. With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object.

With an HTTP request, a web page can make a request to, and get a response from a web server, without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.

This picture is a simplified introduction about how Ajax works:

The user sends a request that executes an action and the action’s response is showed into a layer, identify by an ID, without reload the full page. For example a layer with this id:

<div id=”ajaxResponse”></div>

In the next steps we will see how to create an XMLHttpRequest and receive response from the server.

1. Create XMLhttpRequest

Different browsers use different methods to create the XMLHttpRequest object. Internet Explorer uses an ActiveXObject, while other browsers use the built-in JavaScript object called XMLHttpRequest.

To create this object, and deal with different browsers, we are going to use a “try and catch” statement.

function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}

2. Sending request to the server

To send off a request to the server, we use the open() method and the send() method.

The open() method takes three arguments. The first argument defines which method to use when sending the request (GET or POST). The second argument specifies the URL of the server-side script. The third argument specifies that the request should be handled asynchronously. The send() method sends the request off to the server.

xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);

3. Writing server side script

The responseText will store the data returned from the server. Here we want to send back the current time. The code in “time.asp” looks like this:

<%
response.expires=-1
response.write(time)
%>

4. Consuming the response

Now we need to consume the response received and display it to the user.

xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
}

5. Complete the code

Now we must decide when the AJAX function should be executed. We will let the function run “behind the scenes” when the user types something in the username text field. The complete code looks like this:

<html>
<body>

<script type=”text/javascript”>
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
}
</script>
<form name=”myForm”>
Name: <input type=”text”
onkeyup=”ajaxFunction();” name=”username” />
Time: <input type=”text” name=”time” />
</form>
</body>
</html>

admin Ajax, Web2.0 ,

eXTReMe Tracker