Tuesday, June 21, 2011

Post #1: Setting up my LAMP

Not a desk lamp silly, a Linux-Apache-MySQL-PHP server! Feeling a bit crook so have decided to limit myself to light duties: setup my LAMP server. I've already installed Apache and it appears to be running smoothly. There needs to be better ways to organize notes and journal articles that I have read such that I don't read them again and such that I don't read them again and such that I don't read them again. The answer: PHP and MySQL! While at the minute I only know how to echo/print data to the browser, it is suggestive that I should be able to search databases stored on my server, and output the relevant information to a browser.

So the journey begins. This blog will be an installment of posts that regard and web design techniques that I implement over the coming months/years.

Install LAMP
So as per the Ubuntu Docs above, I checked my distro:
Linux 2.6.38-8-generic-pae #42-Ubuntu
Apache2 is installed. Next, install MySQL with PHP5:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Everything was already installed. :D Gotta love server edition!

PHP memory allowance
Ubuntu suggests increasing the maximum amount of memory that PHP using when executing scripts. I increased mine from 128 -> 256M. Locate memory_limit and change:
sudo nano /etc/php5/apache2/php.ini

MySQL bind address
Need to be changed if accessing the database from other computers on the network. So yes, needs to be done. Access /etc/mysql/my.cnf, and change bind-address to the IP address of the computer which will be accessing:
sudo nano /etc/mysql/my.cnf
Remember, when using nano, Ctrl + W is the keyboard shortcut for search.

phpmyadmin -> the GUI
So rather than using the CLI for doing mundane tasks, take advantage of the browser. That's where I want to send all my searches in the future anyway. Install phpmyadmin.
sudo apt-get install phpmyadmin
A thing came up about dbconfig-common and after a quick search, I just pressed "Yes".

Test PHP status
Yep, so PHP is working. Created a simple file in the root directory of my webserver testphp.php and then pointed my browser there. Vioala! Info about the variables of the PHP installation. It even shows the correct memory_limit that I set early.

So at this stage, I'm hoping that I haven't done anything around the wrong way. It appears that I haven't.

Just spent about 20mins trying to figure out where the phpmyadmin site was...turns out I forgot to edit apache2.conf. Add...
Include /etc/phpmyadmin/apache.conf
...to the bottom of /etc/apache2/apache2.conf, restart Apache and then point your browser to yourdomain/phpmyadmin. Beautiful!

Right. Now to teach myself some PHP stuff! I see the light at the end of the tunnel, I just can't make out the distance to it.

No comments:

Post a Comment