Install and configure LAMP, Ubuntu

Installing PHP on a linux box is far from complicated. There is several guides and HOWTO. If this page is not enough for you. Google: LAMP-server ubuntu.

LAMP is acronym for Linux, Apache, MySQL, PHP. And thats everything you need for developing PHP. Start by type the following in a terminal.

sudo apt-get update
sudo apt-get install apache2 php5 php5-cli libapache2-mod-php5 mysql-server php5-mysql php5-mcrypt


Restart the server.

sudo /etc/init.d/apache2 restart


Go to http://localhost and see if It works!

Apache 2 needs to be configured according to the instuctions found in the Symfony cookbok / Jobeet tutorial.

Virtual hosts

To enable virtual hosts in ubuntu, create /etc/apache2/sites-available/YOURSITE.com with the following content:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName YOURSITE.com
	ServerAlias *.YOURSITE.com
	DocumentRoot /var/www/YOURSITEROOT
	<Directory / >
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/YOURSITEROOT >
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride All
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>
	ErrorLog /var/log/apache2/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /var/log/apache2/access.log combined
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>


Where serverName, serverAlias, documentRoot and the second Directory tag is the only thing you need to worry about. Save the file and create a symbolic link to that file from /etc/apache2/sites-enabled/00X-YOURSITE

a2ensite YOURSITE

Enable modRewrite

To get nice URLs you must enable modRewrite. Example on a clean urls:

http://example.com/weblog/index.php?y=2000&m=11&d=23&id=5678
http://example.com/weblog/archive/00005678.html
Symfony uses Clean URLs. To enable modRewrite, run these commands:

sudo a2enmod rewrite
sudo /etc/init.d/apache restart

Configure hosts

If you want local access (non-public) then you need to configure the hosts-file.
Open /etc/hosts and add www.aDomain.whatever to point to localhost / 127.0.0.1.

Example:

127.0.0.1	localhost.localdomain localhost www.aDomain.whatever
127.0.1.1	myPC #computer name

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I've been trying to make

I've been trying to make ubuntu work for me but it kept my head spinning. I've been reading a lot of ubuntu books online and hopefully I can make it work this time.

Marylee
Ubuntu Help
10bomb.com

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <strong> <cite> <code> <b> <i>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.