Tag Archives: hosting

HostGator’s upgrade to PHP 5.4

Recently, HostGator sent around some emails saying they were forcing a PHP upgrade to 5.4 in the coming weeks. The steps provided by HostGator are basically:

  1. Login to CPanel
  2. Go to PHP Configuration
  3. Change from 5.2 to 5.4
  4. See if your site works

I’m off work this week to work on my self-published book, so I went ahead and tried the PHP 5.4 upgrade. First, I made sure my sites were backed up and all WordPress plugins/themes were updated.

After running the PHP 5.4 configuration change, my site didn’t work. I received an HTTP 500 error with the cute alligator smiling his smug face at me. I’m on the current version of WordPress with everything (including my database) fully up-to-date. Naturally, the first thing I did was check the error logs in CPanel… empty. Next, I contacted customer support.

I was on with support for 1h 15m. At first, the support representative couldn’t see the internal server error page. She could run through kproxy.com and see my main page. I tried kproxy.com and saw my site, while other proxies and is-it-down-type checkers reported my site as being down.

After some time, we tracked down the following error message:

Cannot load the ionCube PHP Loader - it was built with configuration 2.2.0, whereas running engine is...

I was initially told this was a problem with my theme (which is the default theme with WordPress, btw). I was getting frustrated, but with the error message I was able to Google what would cause this and it turned out to be a php.ini issue. At first, I assumed it was the server’s php.ini causing problems. After about 5-10 minutes of the support representative investigating further, I loaded ~/www/php.ini from within my SSH session and found that the PHP configuration switcher in HostGator’s CPanel doesn’t modify php.ini in any way to account for the updated PHP version.

zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"

The fix for this whole problem was to change the version of IonCube used for script loading to match the version of PHP I chose in the PHP Configuration switcher. That’s really something that should be done automatically by a utility. Without error logs displaying in CPanel, I don’t know how the average customer is supposed to figure that one out.

Even after the day of downtime recently, I still give HostGator a 9/10. They’re always quick to respond to customer concerns and very nice. They resolve issues as quickly as possible and provide a pretty solid and affordable hosting environment.

Flattr this!

Hostgator: ssh warns ‘too many authentication failures’

I requested for HostGator to provide ssh access. Since then, I haven’t used it. I attempted to ssh into the server today and received the message ‘too many authentication failures’.

If you haven’t done so already, create a PubKey:

ssh-keygen -t dsa

The ssh-keygen program will ask a few questions such as the key name and the passphrase. Enter whatever you’d like. I’ll refer to the file as id_dsa.pub (which is the default name).

Navigate to your .ssh directory:

cd ~/.ssh

Make sure your file exists in this directory.

Now this one-liner does it all:

cat ~/.ssh/id_dsa.pub | ssh -p 2222 -o PubkeyAuthentication=no user@hostname 'cat >> .ssh/authorized_keys'

If you’re not familiar with the linux pipe, I will explain a bit. If you understand the above command, you’re done. Enjoy.

The first part before the vertical line {the ‘|‘ is called a pipe) dumps all of the text (cat) inside the file (~/.ssh/id_dsa.pub) into STDOUT, or the standard output stream. The pipe forces STDOUT from before the pipe to become STDIN (standard input) for the command after the pipe. Normally, on HostGator you would open an ssh session with ssh -p 2222 user@hostname. But, because there is a conflict in either existing keys on your machine or the authentication of those keys on the server, you’ll have to add -o PubkeyAuthentication=no. Finally, the command within single quotes at the end dumps the text in STDIN into a file handle (the ‘>‘ causes the dumping of this text to redirect STDIN to an existing filehandle, while two of those characters ‘>>‘ redirects to a file, creating the file if it doesn’t exist).

Flattr this!

How to move WordPress without breaking web links

WordPress allows you to specify your blog url as, for example, www.ipreferjim.com/site. It also allows you to run the blog from the base of your domain, e.g. www.ipreferjim.com. For the longest time, I didn’t mess around with this because I didn’t see it as a big deal.

Not long ago, I upgraded linux hosting to Windows deluxe hosting at Godaddy.com. There were so many issues with WordPress under windows (see my previous post). On top of that, performance had never been exactly what I’d expect, and a lot of constraints were blocking me from being productive. So, I switched to hostgator.com.

The problem is that I have years of links to my site in the format:

http://www.ipreferjim.com/site/2011/06/godaddy-url-rewrite-fix-for-directory-without-trailing-slash/

and I now wanted it in the format:

http://www.ipreferjim.com/2011/06/godaddy-url-rewrite-fix-for-directory-without-trailing-slash/

I went about this by following WordPress’s guide to giving wordpress its own directory. This went well, then I had to update the .htaccess file to allow /site/wp-admin yet remove /site from all other links.

# BEGIN WordPress

RewriteEngine On
RewriteBase /site
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]

RewriteRule ^/site/wp-admin(.*)$ /site/wp-admin/$1 [L]

# END WordPress

Flattr this!

Godaddy URL Rewrite Fix for directory without trailing slash

Not too long ago, I upgraded my godaddy.com hosting account from the linux basic to windows deluxe plans. I did this because I have multiple domains I’d like to host with a single company. I’d never had issues with godaddy’s linux hosting.

The problem was that I am a .NET developer and I wanted to start hosting some ASP.NET applications. Since the windows plans are also capable of hosting WordPress, I decided to switch.

My first suggestion to you if you’re looking to switch from linux to windows with godaddy: don’t.

My second suggestion is that, when you have problems, you don’t contact godaddy customer service. After five emails or so, I’ve determined that the customer service is outsourced and the names in the signature of the email such as “Andrew P” or “Anna K” are fake.

I won’t go into it, though. I’ll just give you the fix.

Drop a web.config file into the root of your domain’s directory like so:

<?xml version="1.0"?>
<configuration>
   <system.webServer>
      <rewrite>
         <rules>
            <rule name="Host Directories Fix" stopProcessing="true">
		        <match url="^(.*)[^/]$" />
		        <conditions logicalGrouping="MatchAny">
		            <add input="{HTTP_HOST}" pattern="^ipreferjim\.com$" />
                 	<add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
		         </conditions>
		        <action type="Redirect" url="http://www.ipreferjim.com/{R:0}/" redirectType="Permanent" />
		    </rule>
         </rules>         
      </rewrite>
   </system.webServer>
</configuration>

On the highlighted lines (9 and 12), you will have to replace my domain name with your own.

The reason this is necessary is because godaddy has IIS 7 configured improperly for serving directories. In fact, here’s the initial email I received from them:

Dear Jim,

Thank you for contacting Online Support.  
Upon review of your account it appears you have a Windows hosting account running IIS7.  
The issue you are seeing happens because of the way it is configured with our system.  
I apologize for any inconvenience.

Please let us know if we can assist you in any other way.

Sincerely,

Anna P.
Online Support Team

Flattr this!

Can’t login to MySQL as root :(

I was having issues logging into MySQL as root the other day. It took a while to figure things out. Ultimately, I had to follow the steps on two separate posts: http://rimuhosting.com/howto/mysqlinstall.jsp and http://bugs.mysql.com/bug.php?id=22118.

Here are the steps I took:

  1. Stop MySQL:
    /etc/init.d/mysql stop
  2. Edit config:
    sudo vim /etc/my.cnf
  3. Add line to section [mysqld]:
    skip-grant-tables
  4. Start MySQL:
    /etc/init.d/mysql start
  5. Reset Root Password:
    mysql -e &quot;update user set password = old_password('newpassword') where user = 'root'&quot; mysql
  6. Kill MySQL:
    kill `cat /var/run/mysqld/mysqld.pid`
  7. Create an init-file:
    cat ~/mysql-init&lt;&lt;EOF
    UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; 
    FLUSH PRIVILEGES;
    GRANT ALL ON *.* TO 'root'@'localhost';
    EOF
    
  8. Run MySQL with the init file:
    mysqld_safe --init-file=~/mysql-init &amp;
  9. Remove the mysql-init file:
    rm ~/mysql-init
  10. Restart MySQL:
    /etc/init.d/mysql restart
  11. Login as root!

Part of this was also taken from the MySQL documentation for resetting a password, however, the contents of the file were changed to match one of the previously mentioned posts. If these steps don’t work, please visit the official documentation and give it a try again.

**IMPORTANT**
When you’re done following the above steps, please remove ‘skip-grant-tables’ from my.cnf. Thanks, Ian, for bringing this missed step to my attention!

Flattr this!