Tag: linux
PHP : Working over Linux Distro
by mage on Oct.03, 2009, under Programming, php
Well as you know PHP runs over server rather than your OS, so its platform independent.
So while working with PHP, Linux, Windows, OSX it doesn’t matters what are you using actually..
In this tutorial you’d get how to install LAMP server, and writting PHP scripts over it.
Installing LAMP server on Linux :
> Considering apt-get installation.
Since most of you use debian flavour of Linux esp. Ubuntu, So this tutorial would be targetted on it.
> First of all LAMP is Linux Apache MySQL PHP
To install Apache :
Apache is a server that is used to host the web files(html,js,php,asp etc.).
Goto Application>Accessories>Terminal
run :
mage@h4ck-b0x:~/$sudo apt-get update
mage@h4ck-b0x:~/$sudo apt-get install apache2
Testing Apache :
Open up any web browser and then enter the following into the web address:
http://localhost/
Open it and you will see a message saying “It works!” , congrats to you!
Your Apache server location would be
/var/www
To write html, javascript, PHP etc scripts, you’d need write permissions on that folder.
to do that run :
mage@h4ck-b0x:~/$sudo chmod 777 /var/www
mage@h4ck-b0x:~/$sudo chmod 777 /var/www/*
Working with Apache :
Basic functioning of apache server is operated via /etc/init.d/apache2 file.
starting apache server :
mage@h4ck-b0x:~/$sudo /etc/init.d/apache2 start
re-starting apache server :
mage@h4ck-b0x:~/$sudo /etc/init.d/apache2 restart
stoping the apache server :
mage@h4ck-b0x:~/$sudo /etc/init.d/apache2 stop
Installing PHP :
In the terminal type :
mage@h4ck-b0x:~/$sudo apt-get install php5 libapache2-mod-php5
In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:
mage@h4ck-b0x:~/$sudo /etc/init.d/apache2 restart
Testing PHP :
In the terminal copy/paste the following line:
mage@h4ck-b0x:~/$sudo gedit /var/www/testphp.php
This will open up a file called phptest.php.
Now write this code in this file :
<?php phpinfo(); ?>
Now goto your browser and browse to
http://localhost/phptest.php
If the page loads up, it means php is installed successfully.
Working with PHP :
PHP is a scripting language that is used to handle scripting over web,
It is primarily used to enter values in database and use them with algorithms to display into html content.
To learn PHP : google tutorials or refer w3xchools
Installing MySQL
Again open up your terminal,
mage@h4ck-b0x:~/$sudo apt-get install mysql-server
This would install the mysql server,
during installation, it’d prompt for root password for the mysql server.
Testing MySQL server
Goto terminal :
mage@h4ck-b0x:~/$mysql -u root -p
it’d prompt for password.. type the one you set during installation.
if it shows up like
mysql>
in the terminal, that means installation is successful!!
Configuring PHP with MySQL :
To do this we will need to open a file entitled php.ini. To open it type the following:
mage@h4ck-b0x:~/$sudo gedit /etc/php5/apache2/php.ini
Find this line :
; extention=msql.so
and remove the semi-colon from it and save the file.
Installing PHPmyadmin :
PHPmyadmin is a GUI utility for mysql database management.
mage@h4ck-b0x:~/$sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Now add link into the /var/www folder for phpmyadmin
mage@h4ck-b0x:~/var/www/$sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
Testing PHPmyadmin
Open your browser and traverse to
http://localhost/phpmyadmin
it’d show the GUI for MySQL, enter your mysql username as root and password that you set via installation,
There you have it
PS – All functioning must be Done via root using sudo command.
How to install your new Linux Distro : Ubuntu
by mage on Sep.25, 2009, under Open Source
Installation :
You can easily install ubuntu on your laptop/desktop via 2 methods.
1. Installing it inside windows’ partition.
- This one is really easy.
- When working on windows, put the Ubuntu Live CD inside the CD-ROM.
- In the AutoPlay menu launch the Install inside Windows feature.
- Select the desired options and here you have you ubuntu running fine.
PS- Installing it in supposing D drive would lead all the contents of D drive inaccessible from Ubuntu.
2. Installing on a separate partition.
- Put in your Ubuntu Live CD and reboot your computer.
- Now boot from your CD-ROM and enter into the Ubuntu Live CD.
- Now select the Install feature. A installer much like windows one would pop up.
- Follow the options that occur blindly except for the partition manager.
- Make sure you select it to manually specify the partitions or else your whole HDD would get formated.
- In the partition manager, you would get the partitions on HDD, you can recognize them with there size. For eg. 106 GB partition is supposed to be my E drive… similarily.
- Select the one you want to format and install ubuntu on then click on edit partition.
- Format the partition to ext3/ext4 format, and mark, use this space as ‘/’
- Now click on Next, it would ask you to create a swap partition, if you have enough memory on your RAM click on continue, other wise create another partition atleast 256mb and use it as swap.
- Finally enter remaining details and you are good to go.
Hope this article helps you install Linux on your machine.