Ubuntu 7.04 : Apache-PHP-MySQL Server

Here are the packages you need to install to make your Ubuntu 7.04 as webserver with PHP and MySQL support.

  1. Install Apache:
    sudo apt-get install apache2
  2. Install PHP5:
    sudo apt-get install php5-common php5 libapache2-mod-php5
  3. Install MySQL:
    sudo apt-get install mysql-server mysql-client
  4. To use MySQL with PHP:
    sudo apt-get install php5-mysql

Comments

Folder permission tutorial(kinda)

You might not be running as root and root is most likely owner - which disallows you the right to change permissions. execute the following
cd /var
su
"enter password for root"
chown -R john www or /www
now maybe after successful
chmod -R 775 www or /www
A little info:
chown allows for changing the owner - you must be root to change the ownership if root is the owner :)
chmod 775 does this U+G+O User+Group+Others 7 = read write execute 5 = read and execute
change john to YOUR username (the one you log in as)
-R tells the commands to make the internal files of the directory "owned" by John as well.
read =1 write=2 execute=4 for a total of 7 for all permissions granted to UGO would be 777 (NOT recommended)
Hope this helps

Conrad

test php

How to test if PHP is working?
Thanks. Nice and informative site.

php doc

The best place for you to start is here.

Hi! I'm kinda new at using

Hi!

I'm kinda new at using linux and stuff, and I just installed apache php-MySql with your tutorial... (Thanks for that!). Now, where do I put the *.php files to see, if this thing works?

/var/www

Put it in your /var/www directory

permissions

For some reason I am unable to put any files in my /var/www directory, even after doing
sudo chmod 777 /var/www
any ideas?

How to Write Files in /var/www/

Hit Alt+F2 and enter "gksudo nautilus" (obviously don't type the quotes) - this opens the file browser as root

Navigate to /var/ and right-click on the www directory. Choose Properties > Permissions.

Click the box next to 'Group' to bring up the list of users, and select the user you usually log in as.

Then change 'Folder Access' to 'Create and delete files'.

You should then have full access to the www directory from a regular file browser window as well as from applications such as your PHP editor.

Before I forget -- thanks str for the tutorial on setting up PHP! Just what I wanted - the facts and no fluff :)

What Linux distro you are using?

Strange.

Try adding -R in the chmod command.

What Linux distro you are using?

Problems with permissions(possible solution)

You might not be running as root and root is most likely owner - which disallows you the right to change permissions. execute the following
cd /var
su
"enter password for root"
chown -R john www or /www
now maybe after successful
chmod -R 775 www or /www
A little info:
chown allows for changing the owner - you must be root to change the ownership if root is the owner :)
chmod 775 does this U+G+O User+Group+Others 7 = read write execute 5 = read and execute
change john to YOUR username (the one you log in as)
-R tells the commands to make the internal files of the directory "owned" by John as well.
read =1 write=2 execute=4 for a total of 7 for all permissions granted to UGO would be 777 (NOT recommended)
Hope this helps

Conrad

Running as root.

I'm new to all this (ie. Linux :"] ), and when I tried switching to root via 'su' it wouldn't accept my pasword.

So instead I put 'sudo' in front of the 'chown' command. This will prompt you for your password before it runs the command (you have to 'sudo' every time you want to run as root).

Hopefully this will help fellow Linux n00bs like me :D

Back to the point of my post, why can't I use 'su'?

:")

I was on Ubuntu 6.06 - I've updated to 7.10 and it works fine.