Diving in face first with LAMP – Part 2: I only know how to do this command and the command immediately after

Ahh...to be a linux user.
Immediately, I’m running into issues with Linux.

 

I really like the command line interface, it really gives you a direct sense of what the computer is doing.  For example, if you’re using Microsoft Excel and trying to open a massive file, the app will just freeze and you’re not sure if the program is working or crashing. For me, the best part is that if I type in a command and I get the next line returned, it worked.  And it’s also really cool to type all this stuff and have your screen explode in text like you’re hacking the Pentagon. 

 

The downside for me is that if it doesn’t work, you’re shit out of luck.  Since I’m working off a tutorial, any outdated information or any sort of situation that isn’t outlined is going to completely derail this entire process.  But I guess that’s technically the fun part.

 

Programming languages are literally languages.  You learn some words, put them together in the right way and you’re off to the races.  Tutorials are the phrase books of the programming world, which are sort of great but also sort of awful.  With a phrase book, you can ask “where is the bathroom”, but you literally will have no idea where the bathroom actually is unless that is also in the book.  This problem is excellently summarized in the following Family Guy clip:

 

For me, this was the problem I had to deal with from the LAMP installation guide from Ubuntu Forums:

 

To test the new site, create a file in /home/user/public_html/:
$ echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html

 

This makes perfect sense.  You’re trying to write an .html file in the directory /home/user/public_html/.  I get this.  This is easy.

 

What actually happens is me spending 20 minutes finding out why Bash won’t let me create this .html file.  Do I not have permission?  No, I used sudo in the command… is it because echo isn’t the right thing to use?  Lets try nano.  No?  What is going on?

 

There were 2 problems.  First, there was no /home/user/public_html/ directory made yet.  Looking back, I’m pretty sure my username was supposed to go where “user” is.  Either way, I’ve already gone too far to turn back now.

 

What fixed it for me was the following:

 

$ sudo mkdir /home/user/public_html/

 

Growing up with a GUI, this problem doesn’t really exist because you would click on the folders to get to that directory and if you discover that it’s not there – boom.  Problem solving.  However, I might be doing it wrong but I’m not going to be using ls commands every folder, for the most part.

 

The second problem is that the line $ echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html wouldn’t work for me. I tried adding sudo in the beginning and a couple other things in order to do it. It just wouldn’t work. I went online and found this page aptly titled “sudo echo” does not work together in Ubuntu (another “waste of time issue”) and picked one of the solutions:

 

$ sudo sh -c 'echo "<b>Hello! It is working!</b>" > /home/user/public_html/index.html'

 

I can’t even begin to explain what this exactly means.  Here’s what my friend @therumbler, resident programmer/Australian explained it:

 

 

So as you can very clearly tell by my friend’s extremely knowledgable response, I still have no idea why it worked.  But it does and I’m using this command forever and there’s nothing you can do to stop me.

 

Stay tuned for when I solve the next problem which is it appears that after installing suPHP, the permissions setting doesn’t allow the .php files to render. I’ll keep you all posted if I figure that one out.  Wish me luck!

Leave a Reply