how to run php program that saved in opt/lampp/htdocs

28,648

Solution 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.

Solution 2

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.

Solution 3

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

Share:
28,648

Related videos on Youtube

Mikpatel
Author by

Mikpatel

Updated on September 18, 2022

Comments

  • Mikpatel
    Mikpatel over 1 year
    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

  • Pabi
    Pabi almost 10 years
    This is not necessary as the default directory is /opt/lmapp/htdocs not /var/www/htdocs