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



Question:

  1. I installed Xampp in my linux os
  2. I also write php program in gedit and then that program saved in /opt/lampp/htdocs
  3. But problem is I don't khow how to run php program that saved in /opt/lampp/htdocs please give me some solution


Solution:1

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


Solution:2

First. You gotta check if your lampp server is running or not.

Either way. Open your terminal with 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 what Pabi suggest.

localhost/yourfile.php in your browser bar.


Solution:3

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:4

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »