This post is all about configuring the lamp server for doing your php coding, for running mysql queries…I’m not going to talk anything about installing the lamp server (Linux Apache MySql PHP) … just about some post installation activities… While using a lamp server you are using apache server to service for the php scripts.
First we have to set the localhost address to a convinient folder for placing your web based projects or programs…To set a common directory for all the users using the same linux system follow the steps here
- 1. Take the gnome terminal
Applications -> Accessories -> Terminal
- 2. Type in $sudo a2enmod userdir
Then the terminal prompts for the password… type in and kick on the enter key…
- . To make this change to be take into effect you have to restart the apache server…that’s what we do in this step. Type in the terminal as follows..
$ /etc/init.d/apache2 restart
- 4. The above step enables the user directory called public_html as the default location (home page of the apache server) of the localhost. We have enabled it in the previous step… then who will create that folder….let’s do it now. Type in the terminal
$ cd ~
$ mkdir public_html
- 5. That’s all about configuring. Now you have to check everything done so far was right Letz write a sample php program and save it in that folder.. here is how i did it using the terminal
$ gedit (It will open a the gedit text editor)
- write the following php script in it and save it as x.php in the /home/your_username/public_html directory as in figure
- 6. That’s all … it’s the time to see the output of that phpscript. . . Take the web browser say mozilla forefox, Then type in the address bar as follows.
127.0.0.1/~your_username/ or localhost/~your_username
- 7. You can see their recently created x.php … Click on it and check wheather it loads the php information page
Itz all over. For veiwing the web pages or phpscripts you have save it to the public_html folder and call the same address in the address bar of the browser….
Comment if you find any difficulties or problems …
0 comments:
Post a Comment
speak out... itz your time !!!