Category Archives: Uncategorized

Problem with Apache after upgrading from Ubuntu 10.04 to 10.10

After I upgraded from Ubuntu 10.04 to 10.10 my sites were no longer coming up.  I was only getting the basic contents of /var/www/index.html “The web server software is running but no content has been added, yet.”
A bit of googling later I found what appeared to be the issue <here>, but even after implementing what it suggested (renaming my vhost configurations in the sites-available folder to have the .conf extension) I was still having problems.

It turns out that apache 2.4 has a security feature that doesn’t allow you to have your files in any old place (either /usr/share or /var/www).  So rather than move all my projects to a different folder that adhered with the security gods I decided I would simply add the following to apache2.conf

<Directory /home/me/projects/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

Even after I did that, however, I was having problems.  Turns out this problem was just plain-old stupidity though.
When I was attempting to change the default site localhost was resolving to I used the following command:
sudo a2dissite default && sudo a2ensite newsite
and even changing it to be in line with the new config file extension didn’t work:
sudo a2dissite default.conf && sudo a2ensite newsite.conf
And then I realized, as part of the upgrade, there was no “default.conf”; it had been renamed to 000-default.conf.
so, sudo a2dissite 000-default.conf && sudo a2ensite newsite.conf worked fine.

Use Putty to connect “locally” to your Amazon EC2 server through your browser

First of all, if you are looking for shell access to your EC2 server, then it will be just as simple to follow Amazons Putty instructions here. This post assumes you have already set up an EC2 instance (including the *optional* puttygen section)and have connected to your server shell via putty already.

This post will focus on making a “local network” connection to your EC2 server so that you can connect to it with your web browser via a SOCKS proxy.  You would do this so you don’t have to open up additional ports in order to administer your server and it is good practice to minimize the number of ports you are exposing to the interwebs.   If you wanted to administer Glassfish via the GUI, for example, you would want to attach to your server on port 4848 in your browser. This is how you would do that.

Let’s get started!

1) First of all we will modify our existing putty connection to our EC2 instance (I have obfuscated my ip with an arbitrary 111.222 postfix)

2) Now expand  Connection -> SSH and select Tunnels. Enter a Source Port number (this can be any number you like), then select the Dynamic radio button as well as the Auto radio button and then click the Add button.
You may want to go back to the session screen from #1 and Save your changes at this point.PuTTYPortForwardSettings2

3) Open up your Browser. I have chosen Firefox as it is easily configurable without making system wide Proxy changes.  Open up your connection settings (in Firefox it is under Tools -> Options -> Network Tab -> Settings Button). Select the Manual proxy configuration radio button and enter into the SOCKS host, and enter the port number you chose in #2 into the port. Click Ok.

4) Log into your Amazon console (in a different browser like Chrome) and take note of the “Private IPs” ip address. In this case I have again replaced the postfix with the arbitrary 111.222.AWS-EC2Console5) Go back to putty and open the connection to your EC2 instance. Once the connection is established you can switch back to your browser and attach to that Private IP as though it was a server on your own internal network.glassfishConsole

Keep in mind that your (Firefox) browser will now be using the proxy server and you will not be able to visit sites other than those available through the proxy. This is simply a quick way to start administering your server on ports that are not accessible by default.

There are many ways to skin this cat, however. You could open ports on your server (ill advised), exercise your 1337 skills in VI to alter config on the server so a GUI is never required, or you could even set up a permanent proxy via a local apache server and v-host config.  Hopefully this will be enough to get you off the ground so you can explore other options at your liesure.


ERROR 2006 (HY000) at line xx: MySQL server has gone away – MySQL and BIG dumps

Every time I re-do my dev machine I ultimately get “ERROR 2006” once I try to import a SQL dump that is too big. It’s a simple fix. You just have to modify your my.ini config file located in the Data directory for MySQL. The default directory is  C:\Program Files\MySQL\MySQL Server 5.5
(or etc/my.cnf on linux)
Then just make a quick change (or addition)

max_allowed_packet = 64M

Restart your MySQL server Service and Bob’s your Uncle! Depending on how you installed MySQL, this value may already have been set to 1M, or it may be missing all together, so don’t hesitate in adding the setting should it be missing.

MySQL Dump file troubles, a dashes dilema

I really hate looking (or being) stupid. Nevertheless it happens from time to time. Most (if not all) times they are avoidable events. Had my observation of what the MySQL command line response was trying to tell me been a little better, perhaps my Google searching Kung-Fu failure would not have added additional salt to the wound.

When attempting to import data from a SQL dump I was getting the following error(s):

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)


mysql: unknown option

As it turned out, it was a simple matter of syntax minutia I was overlooking.  Since Google couldn’t help me save myself, I’m hoping that I can list a few of the deviations of syntax for importing a dump file and it will help somebody whom comes across it to save a little face.

mysql -uroot -ppassword test < test.dmp
mysql -uroot –password=password test < test.dmp
mysql –user=root –password=password test < test.dmp
mysql -uroot –password=password test < test.dmp

mysql -uroot -password=password test < test.dmp
mysql -uroot –ppassword test < test.dmp
mysql –uroot -password=password test < test.dmp
mysql -user=root –password=password test < test.dmp

May the Computer gods (Google?) shine upon those of you having a dashes dilema with MySQL dump files and bring you here for salvation.  🙂

Great Windows tool to test email functionality in your app

It can be onerous to set up an email server just to test the relatively simple email functionality of your application. Smtp4Dev makes testing that functionality completely trivial! Download it from , unzip it to your folder of choice, and run it. No muss, no fuss!

If you find yourself testing email functionality on a semi-regular basis, select the “Start automatically after login” and “Minimize to system tray” under the options button when the app is fired up.

The emails sent through smtp4dev will NOT be sent to their end destination, and this is definitely a bonus! Who needs more self created spam after all 😉

Thanks to Robert Wood for creating this great little app!

PhpUnit on Win7 with XAMPP – ERROR: unable to unpack \PhpDocumentor-1.4.3.tgz

I took it upon myself to be a good boy developer and get php unit tests working on my Windows 7 box.  To get PHPUnit working properly with my XAMPP install, I found an excellent tutorial here: (@ Courtney Robinson’s log)

It was pure gold, though I encountered the following caveats at step 5:

As Courtney states could happen, PhpDocumentor was already installed with pear, so I had to:

pear uninstall  PhpDocumentor

But then when I went to install it again I received “ERROR: unable to unpack <install-path>\PhpDocumentor-1.4.3.tgz”. I scoured the net for a bit, and found the required action to be:

pear upgrade pear (Mine was up to date however)
pear upgrade Console_Getopt
pear upgrade Structures_Graph
pear install PhpDocumentor

Then I was back in business and able to finish step 6 in Courtney’s tutorial.

P.s. If you don’t see the PHP tab when you go to Tools->Options (as mentioned in step 6)  you likely have the full install of NetBeans 7 but have not opened or created a PHP project yet.  You will need to click File-> New Project, pick PHP, click Next; then you can click Cancel.  This will initialize the PHP references in Netbeans and provide the PHP context tab when viewing the Options screen.

CodeIgniter – Unable to connect to your database server using the provided settings. DB_driver.php

It had been a while since I last had to install XAMPP from scratch, create my databases, and reconnect my CodeIgniter apps to my DB On my local Windows machine.  So when I set everything up, I was surprised when I could no longer connect to my database.

The issue turned out to be a relatively simple solution.  When creating the database, using phpMyAdmin, I had created the database with the default “Any host”:

What the connection requires is for the Host be changed to localhost (If you have already created the Database, this can be changed under the Privileges tab):

You can also get around this by leaving the user you created with the Host of Any host, and then create a second identical user that has Local as the Host (You would do this so both localhost and other computers can use your computer as the Database Server).  A more detailed example of user creation for both localhost and %; go to this MySQL page:


Thanks to the CodeIgnitor forums for helping me on this one :


Problems I had installing XAMPP on Windows 7 64bit Professional

I had 2 problems when installing XAMPP 1.7.4 on my most recently built computer (Windows 7 64bit Professional… they state 64 bit is not supported, though I suspect it installs in 32 bit compatibility mode just fine):

1: The pesky “XAMPP Component Status Check failure [3]” error.  Although the solution was simple, I feel dirty for using it as it is clearly an issue that should be addressed in the installer rather than hacking the registry to make the error message go away: <Oliver Baty’s post>

I installed XAMPP (right-click -> Run as administrator) to D:\XAMPP because the documentation suggests to install XAMPP off a root drive (apparently they only mean C:\ however).  Subsequently, as Oliver’s post states, I had to change the [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\xampp] -> Install_Dir registry setting from D:\xampp to C:\xampp.  Adios error message!

The second issue was significantly harder to track down, so I thought I would post all the variations of the same issue that I came across in hopes that it saves the hours of your life wasted googleing as I have had to:

The Problem
2: When in the XAMPP control panel, clicking Start for apache would provide the message “Apache started [Port 80]”, but apache would not really start. (This also originally showed itself as an error during install, stating “Ports 80 or 443 (SSL) already in use! Installing Apache2.2 service failed”)

The root cause was that Port 80 was being used by another process.  To get a list of “listening” processes, you can run the following at the cmd line:

netstat -oan

The important line in the output being:

   TCP                 LISTENING       4

This told me that PID 4 was hogging up port 80, which was not allowing Apache to use it.  The resulting hours of searching and screaming told me that one of the following possible processes were using port 80 under the guise of PID 4, which is the “NT Kernel & System” System process.:

exhibit A: Under the services panel, find the service that has the description of “world wide web publishing service” and stop the service.  If you found this service, you can check to see if port 80 is still being used by running the netstat command quoted above.  If that doesn’t work, or you didn’t find it, go on to exhibit B.

exhibit B: Again, under services, search for “SQL server reporting services”, and if you find the service, stop it. Check to see if port 80 is still being used by running the netstat command quoted above.  If that doesn’t work, or you didn’t find it, go on to exhibit C.

exhibit C: Again, under services, search for “Web Deployment Agent Service”(MsDepSvc). If you find the service, stop it. Check to see if port 80 is still being used by running the netstat command quoted above.  If that doesn’t work… then it might not be the NT Kernel & System Process (The PID is usually 4 for this)

exhibit D: SKYPE! The PID could be any variety of numbers if Skype is the issue. I would suggest that you disable Disable Skype from starting when windows starts(in Skype this is under Tools->Options->General settings)  After all, you are a developer, why would you need to speak to another human? 🙂  You can kick Skype off of port 80 simply by “Quitting” the application.  Skype will still work and simply pick another port the next time you start it.  You might want to set Apache to start as a service when windows starts so Skype doesn’t cause your Apache not to start the next time you forget to close it before you fire Apache up.

C solved it for me… until I restarted my machine and then D was the issue.  Hopefully one of those variations solves it for you!

Please feel free to leave comments relating to this issue and I will update the post accordingly.  Together we can save the lives of countless developers, one google search at a time.