Magento upgrade from 1.4, 1.5, 1.6, 1.7, or 1.8 to 1.9

NOTE: this upgrade process works the same way for Magento version 1.4, 1.5, 1.6, 1.7, 1.8, and 1.9

As many magento users will know, Magento is no fun to work with-- mainly due to poor community support (the developers help paying customers; i.e. Magento Enterprise ... Only payed support there... Great for business but bad for the average or beginning user...)

Anyhow...

So here's how we do it.

MAKE A BACKUP!

You can skip this step all together, however, please make a backup of everything prior to beginning the upgrade.

Create a test environment somewhere on your server (preferably away from your production installation)

Tags: how-to magento magento upgrade

DirectAdmin blacklisted and whitelisted IP

Recently my IP address was blacklisted by directadmin on my own server.  Here's a how-to that may save you time, in case you're unable to login to DirectAdmin.

Start DirectAdmin in debug mode

cd /usr/local/directadmin
killall -9 directadmin
./directadmin b2000

Now try to log into directadmin. You should see the reason why you are unable to. For me it was "Blocking blacklisted IP xxx.xx.xxx.xxx"

Tags: DirectAdmin Linux Administration

DirectAdmin how to set an external email server for Domain Pointers

If you ever created domain pointers in DirectAdmin, you may have wondered how to set the domain pointer NOT to process email locally.

For instance say you have PRIMARYDOMAIN.com as the main domain under your DirectAdmin account--and it is set NOT to process emails locally, but rather have an external email server handle that; Under MX Records you un-checked "Use this server to handle my emails. If not, change the MX record and uncheck this option". So now you decided to create a "domain pointer" under that same account for another domain SECONDARYDOMAIN.com ... You set the proper MX records for this domain pointer under DNS settings, pointing to the external mail server, and think you're all good to go...

Tags: exim DirectAdmin Linux Administration

How to create an additional domain and use it as a domain pointers in DirectAdmin

Domain Pointers are designed to be exact duplicates of the domain they're created under. As such, you cannot edit many aspects of them.

However, if you wish to have the website data remain the same as the main domain, but be able to control email accounts, you can do it by creating the pointer as another full domain name, and then use symbolic links to link the website data to that of the main domain.

1) If the Domain Pointer exists, delete it.

2) Create the Domain Pointer as a full domain:
- User Level -> Domain Setup -> Add Another Domain -> domain=domainpointer.com

3) Link the data directory that of the main domain, requires ssh:

How to install spamassassin with directadmin custombuild

Let's assume CustomBuild is installed

We have to configure our options.conf and enable the spamassassin installation.

cd /usr/local/directadmin/custombuild
vi options.conf

Now we enable it under #mail options and save:

#Mail options
exim=yes
eximconf=no
clamav=no
spamassassin=yes
dovecot=yes
pigeonhole=no

Next we run update custombuild

./build update

BUT before we run ./build spamassassin we must first download all the requirements (as custombuild will not do this for us):

yum install spamassassin -y; yum -y erase spamassassin

So now that yum downloaded all the requirements we can now do the install. Though let's also update exim before we do this:

Update CentOS / DirectAdmin Server with custombuild 2.0

Here is how to use latest version of custombuild 2.0 . The commands for custombuild 2.0 are basically identical to custombuild 1.1 and 1.2, so all this stuff should look familiar. Here are instructions to custombuild 1.x.

Update server via custombuild

Download latest version of custombuild 2.0

cd /usr/local/directadmin
mv custombuild custombuild-01
wget http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
./build

Setup options.conf: Change PHP version to 5.5 (5.5 is stable, if your setup works with 5.3, it will likely work with 5.5), Apache to 2.4, and mysql to 5.6 (plus set it to install)

vi options.conf

now change to the following:

Tags: linux server custombuild

wget download all files from a directory with resume

Here is how you download all files from a directory using wget with automatic resume of partially downloaded files (in case your connection gets cut off)

wget -r -c --no-parent http://www.whateveraddress.com/downloads

Keep in mind this will only download files that it can read from that location.  If you need to wget a bunch of files from a directory you have SSH or FTP access to you first have to do the following inside that directory:

vi .htaccess

and paste in the following and save.

Options +Indexes

Now that directory should show all the files in it via a browser.

Tags: Linux admin

New Server Checklist for DirectAdmin (2013 edition)

Setup DirectAdmin with an SSL certificate

source: http://help.directadmin.com/item.php?id=15

If you don't own a certificate, you can create your own:

/usr/bin/openssl req -x509 -newkey rsa:2048 -keyout /usr/local/directadmin/conf/cakey.pem -out /usr/local/directadmin/conf/cacert.pem -days 9000 -nodes
chown diradmin:diradmin /usr/local/directadmin/conf/cakey.pem
chmod 400 /usr/local/directadmin/conf/cakey.pem

Or... If you already have your own certificate and key, then copy/paste them in the following

Certificate:

vi /usr/local/directadmin/conf/cacert.pem

Key:

vi /usr/local/directadmin/conf/cakey.pem

Once done one of the above, edit your directadmin.conf

How to create a larger /tmp location using ext2 filesystem

Increasing the size of /tmp is not a practical thing to do on a busy server, mainly because you probably won't be able to dismount /tmp because it's constantly used by various services--trying to find and kill them all is too tedius. (Plus you won't be able to do single user mode through SSH)

So what we will do here is create a whole new /tmp storage location, make a backup of the old /tmp, add the new location to fstab, reboot the server, copy everything from the backup /tmpBKP location to new location, and lastly reboot the server again.

Tags: Linux linux server admin

How to permanently raise ulimit 'open files' and MySQL 'open_files_limit'

The default ulimit (maximum) open files limit is: 1024--Which is very low, especially for a web server environment hosting multiple heavy database driven sites.

This ulimit 'open files' setting is also used by MySQL. MySQL automatically sets its open_files_limit to whatever the system's ulimit is set to--at default will be 1024.

NOTE: MySQL can NOT set it's open_files_limit to anything higher than what is specified under ulimit 'open files'--you can set it lower, but not above the 'open files' limit.

Anyhow...

This is how we raise the ulimit

To check the limits:


ulimit -a

You will see something like:

Tags: Linux admin mysql

How to move MySQL database -- the simple way

There are plenty of articles about how to move mysql to another directory or partition by telling you to mess with the my.cnf by changing all the references of datadir and socket to the new location.

Example:


[mysqld]
datadir=/new/location
socket=/new/location/mysql.sock

Don't do this... Not only will it waste your time, but likely won't work for half the server setups. Reason being there are other factors at play when you're changing things, it's not only the my.cnf that you have to worry about. For example, if you're using Ubuntu, you may be using AppArmor and you'll also have to specify the new directory in /etc/apparmor.d/usr.sbin.mysqld

Tags: mysql Server Linux database

MySQL dump all databases via mysqldump -- the proper way

Here's a command that properly dumps all databases, in case you wanted to restore a full backup.

For whatever reason, many sites are using improper characters ( ' –– ' , ' – ' ) to display this mysqldump command line--copy pasting will throw up an error stating something like:


mysqldump: Got error: 1049: Unknown database '??extended-insert' when selecting the database

Here is a sample of wrong characters, which appear just fine, but won't work:


mysqldump ––extended-insert ––all-databases ––add-drop-database ––disable-keys ––flush-privileges ––quick ––routines ––triggers > all-databases.sql

or


mysqldump –extended-insert –all-databases –add-drop-database –disable-keys –flush-privileges –quick –routines –triggers > /root/all-databases.sql

Tags: mysql linux server admin

Add "You Save" amount and percentage to Special Price in Magento

In order to display a "You Save" for "Special Price" products in magento--to make it look similar to amazon's price display--you can do the following:

Copy

app/design/frontend/base/default/template/catalog/product/price.phtml

to

app/design/frontend/default/YOURTEMPLATE/template/catalog/product/price.phtml

Then in price.phtml that you just copied, right above:


Insert:



$_savePercent = 100 - round(($_finalPrice / $_price) * 100);
$_saveAmount = number_format(($_price - $_finalPrice), 2);
?>
Tags: magento price display

Disable IE "compatibility mode" through .htaccess

Internet Explorer "compatibility mode" is that dreadful page icon, inconveniently placed right next to the refresh button/icon.

What it does is turn IE 8 or higher into an outdated browser, so it can properly display really old school websites that were, likely, built using invalid and/or outdated HTML code. It's a horrible feature, that I see no practical use for whatsoever. Plus it's easy to accidentally click it, because it's located a few pixels away from the refresh button--talk about non-intuitive...

Anyhow... 

This is how you disable IE compatability mode on your website.

  In your .htaccess insert the following:

Header set X-UA-Compatible "IE=9; IE=8; IE=7;IE=edge"

Woooo! We're done. That dumb IE compatibility mode icon won't show ever again.

 

Tags: Server apache IE Web Development

How to install XCache 3.0 from source

Alright... So APC has been pretty unstable for me on 2 separate servers running PHP 5.3.x and PHP 5.4.x. So I figured I'd give XCache a try after reading about similar problems with APC.

Anyhow...

Here's how to install XCache 3.X from source on CentOS

Get the latest version of XCache from here: http://xcache.lighttpd.net/#Downloads

Latest version at the time of this writing is XCache 3.0.1


cd /usr/local/src
wget http://xcache.lighttpd.net/pub/Releases/3.0.3/xcache-3.0.3.tar.gz
tar xvfz xcache-3.0.3.tar.gz
cd xcache-3.0.3
phpize
./configure --enable-xcache
make
make install

Note the installation path. Example here are my paths:

Tags: XCache APC Linux Server how-to

Drupal .htaccess rewrite with 'www' but not for sub-domains

Say you have your Drupal's .htaccess set "To redirect all users to access the site WITH the 'www.' prefix", and you added a sub-domain, and it came out looking something like http://www.sub.domain.com. So, most people will NOT want the "www" added to the url in this case. So what do you do? Easy.

Use this instead:


# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^(subdomain1|subdomain2|subdomain3)\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So what changed? We simply added this line:

Tags: Drupal Linux admin

How to install GEOS on CentOS and directadmin

cd /usr/local/src
wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2  # go here to find the latest version: http://download.osgeo.org/geos/
tar -xvjf geos-3.4.2.tar.bz2
cd geos-3.4.2
./configure --enable-php; make clean ; make
make install
ldconfig
vi /etc/ld.so.conf

Add the following line if it doesn't already exist

/usr/local/lib

Find the location of the newly installed geos.so

updatedb
locate geos.so

You'll get something like this:

/usr/local/lib/php/extensions/no-debug-non-zts-20090626/geos.so

Add the extension info to your php.ini

vi /usr/local/lib/php.ini

Add the following (somewhere around the rest of your extension, e.g. APC):

For PHP 5.3:

Tags: centos geo Geocoder Geofield Drupal

Upgrade Drupal 6 to Drupal 7 using Drush site-upgrade

Ok... So you decided that it's time to upgrade from Drupal 6 to Drupal 7. It's not going to be easy, but using Drush will make life a little easier.

What this will do is save you the time of manually upgrading Drupal 6 core and drupal 6 modules to Drupal 7 core and drupal 7 modules. Of course likely your site will be broken after the drush site-upgrade, but at least you have the manual job of searching for upgraded modules taken care of.

So, let's begin...

Install latest version of Drush


cd /usr/local/share
# install GIT if not available
yum install git
git clone https://github.com/drush-ops/drush.git drush
ln -s /usr/local/share/drush/drush /usr/local/bin/drush
drush

Tags: Drupal drush

Add memcached Support to Magento

After you successfully install memcached and pecl/memcached (memcached PHP support), you will next want take full advantage of it by enabling native support for memcached in magento.

NOTE: you must have memcached and pecl/memcached already installed. Otherwise your Magento installation will break if you try following this guide.

Ok... now that the warning is out the way. Here's how we do it...

Edit your local.xml


vi ./app/etc/local.xml

Add the following between

Tags: magento memcached Linux

How to set a custom sub-domain path in DirectAdmin

UPDATE: See below, there's an easier way to do this. Plus DirectAdmin's way doesn't seem to be working through the 'Custom HTTPD Configurations' way.... So, just use the way listed below. It's much easier.

*** OLD WAY / start ***
I work with Drupal's Domain Access module a lot. However, if you're using DirectAdmin as your hosting control panel, then making sub-domains will not work with the default setup. DirectAdmin puts the sub-domain into a separate directory, and in order for Domain Access to work with sub-domains on DirectAdmin, this needs to be set as the same directory/path as the top domain.

A simple work around is to login to DirectAdmin as administrator, and go into "Custom HTTPD Configurations".

Here you will paste the following code:

Tags: DirectAdmin Linux Drupal Domain Access

Magento Google Shopping Setup aka Google Base aka Google Content aka Google Merchant

Here's a quick (and hopefully easy) tutorial on how to properly setup Magento with Google Base aka "Google Shopping" or "Google Content" .

I know there is very limited help for Google Base/Shopping for Magento Community Edition 1.6 and 1.7 (and nothing official exists on any lower versions)...

The interested fact is, Magento is knowingly supplying a broken extension with 1.6 and 1.7--i.e. there is no way it will work unless you hack the core code; as we will below.

Hopefully, the community edition will get a working extension soon, just like the Magento Go version.

Anyhow... on to self help!

Tags: magento google

How to install APC on CentOS and DirectAdmin


cd /usr/local/src
mount -o remount,exec,suid /tmp
yum install autoconf
yum install php-pear
yum install php-devel
yum install httpd-devel
yum install pcre-devel
wget http://pecl.php.net/get/APC
tar xvfz APC-VERSION.tgz
cd APC-VERSION
phpize
whereis php-config

This will give you the location of php-config, which you will put after --with-php-config=

Tags: Server PHP APC

Flush or Clear out Exim mail queue

Exim mail queue can get out of control. If your var is on a separate smaller sized partition it can quickly run out of space.

We can see what's using up all that space via:


cd /var
du -sh * | sort -n

and as with Exim, our culprit location should be:


/var/spool/exim/input

So to quickly clear out the exim mail queue we do the following:


cd /var/spool/exim/;rm -rf input msglog;/scripts/eximup --force

And that should do it.

Flush MySQL log-bin data and disable binary log files

If your disk is starting to run out of space due to an excess of mysql-bin.XXXXXXXX files here's what to do to fix that.


vi /etc/my.cnf

under 'log-bin=mysql-bin' (the destination could be different in your my.cnf) put:


expire_logs_days = 10

Change 10 to whatever you're comfortable with.

or you can simply disable the binary log files by uncommenting the line:


# log-bin=mysql-bin

You'll also want to remove all the excessive binary log files like so:


mysql -u root -p -e "PURGE BINARY LOGS BEFORE '2012-02-15 09:00:00';"

TROUBLESHOOTING

In case you can't shutdown mysqld do the following:


pidof mysqld
kill -9 NUMBEROFPROCESS

Tags: Server how-to mysql

How to install Apache Solr 3.x for Drupal 7 or Drupal 6

First we'll need to install Java 1.6 JDK, and be on PHP 5.2 or higher (You can check my PHP installation tutorial here. Also I'm on CentOS.

Install Java 1.6 JDK


yum install java-1.6*

Install Apache Solr

We're going to install Apache Solr into /usr/local/share; however you can install it somewhere else if you'd like (e.g. install it in the root dir / )


cd /usr/local/share

Download Apache Solr. We're going to use the latest version at the time of this writing: Apache Solr 3.5. Look for the latest version here: http://www.apache.org/dyn/closer.cgi/lucene/solr/

Tags: Server Drupal linux server apache solr solr

Magento Google Analytics goals setup

Ok... let's get right into it...

We'll assume you already have google analytics setup and working with magento...

So... we want to add Google Analytics Goals so we can track what people are doing at the different steps of checkout.

Alright... here we go...

  1. Log into your Google Analytics account
  2. Click "Admin" at the top right (of the new version of Google Analytics)
  3. Click the name of your domain
  4. Click "Goals" tab--towards the middle of page
  5. Click one of the non used "+ Goal" links
  6. Now we fill in all the info...

Tags: magento google analytics