Pages

Showing posts with label Xampp. Show all posts
Showing posts with label Xampp. Show all posts

How to run a php file

A php script is usually used to build websites and is interpreted by a web server. So you need to install a server like Apache and also PHP. As a beginner it is better to install Xampp server because if you install each separately you also need to configure the files accordingly. So it's better to install Xampp Server, you can install by following the steps here.

Create a sample php file to check whether the xampp works. Type the below code in a tex editor and save it as "first.php" in /opt/lampp/htdocs/ .


Open any browser type http://localhost/first.php in the url bar and press enter. You will get the output as
"My first PHP script!". That's all you PHP file is working, now start coding ;)

Installing latest Xampp in ubuntu[Easy way]

Xampp for ubuntu includes apache, mysql, php and phpMyadmin.

Download the installer run file for linux from http://www.apachefriends.org/en/xampp-linux.html . Download the 64-bit version if your ubuntu is 64-bit to check your OS type :
  • Open the terminal Type uname -a
Result for 32-bit Ubuntu:
Linux discworld 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386GNU/Linux
whereas the 64-bit Ubuntu will show:
Linux discworld 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 x86_64 x86_64x86_64 GNU/Linux
After the file download is complete, goto terminal and follow the steps below
  • Change working user to root, type "sudo su"
  • Change your directory to your Downloads folder "cd /home//Downloads/" 
  • Change the permissions to the installer "chmod 755 xampp-linux-1.8.2-0-installer.run"
  • Run the installer "./xampp-linux-1.8.2-0-installer.run"

XAMPP is now installed below the /opt/lampp directory.


Important:
Before starting the xampp server you should setup the password for it to keep it secure, to do this

/opt/lampp/lampp security

and follow the instructions, it will ask you to set user and passwords for xampp,mysql, PhpMyAdmin  and also network access for mysql daemon.

To start xampp
/opt/lampp/lampp start


To stop xampp
/opt/lampp/lampp stop