4
  1. I installed Xampp in my linux os
  2. I've also written a php program in gedit and saved it in /opt/lampp/htdocs

The problem is I don't know how to run the php file I saved in /opt/lampp/htdocs

1

If lampp is not already running start it from a Terminal crtl + alt + t type:

sudo /opt/lampp/lampp start

Then open a browser and go to the url localhost/yourFile.php.
Replace yourFile.php with the name of your php file.

Or name the php file index.php and just enter localhost in the browser.

|improve this answer|||||
1

firstly you will have to start the local host as mentioned

sudo /opt/lampp/lampp start

you will see the output on the termminal saying

Starting XAMPP for Linux 7.1.9-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

you will have to check the permissions given to htdocs folder to make life simpler try this

cd /opt/lampp

this will redirect you to the lampp folder , here change the permission of the document root , i.e permissions of htdocs

sudo chmod 777 htdocs

go into the folder

cd htdocs

now make your own document root file to store all your files

mkdir yourfoldername

now it is as simple as copying the files into this folder , now open your browser and type in

-> in your browser localhost

you will see -> localhost/dashboard/ remove the dashboard part and replace with

-> localhost/yourfoldername

and here click on the file you put inside the folder you had made in htdocs , and there you go . you can run the php file from here

|improve this answer|||||
1

First, you have to check if your lampp server is running or not.

If not, open your terminal by pressing Alt+Ctrl+t.

Type: sudo /opt/lampp/lampp start

Something like this should appear:

Starting XAMPP for Linux 1.8.3-4...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

Then, do as Pabi has suggested.

localhost/yourfile.php in your browser bar.

|improve this answer|||||
0

Create a symbolic link in your /var/www folder pointing to /opt/lampp/htdocs.

mkdir /var/www/htdocs
ln -s /var/www/htdocs /opt/lampp/htdocs

From there just go to localhost/htdocs

|improve this answer|||||
  • This is not necessary as the default directory is /opt/lmapp/htdocs not /var/www/htdocs – Pabi Jul 21 '14 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.