Sunday, 30 July 2017

Installing XAMPP on Linux


Downloading XAMPP 

Download the XAMPP installer. You can get it from https://www.apachefriends.org/index.html
Make sure to download the correct version for your system (32-bit or 64-bit).

1. Open the Terminal.

Before you can install XAMPP, you'll need to change the permissions for the downloaded file so that it can be executed.
2. But first go to the directory in which you have downloaded XAMPP.
Example: $ cd Downloads

3. Now, change the permissions, enter the following command and press Enter, entering your password if required:
$ sudo chmod +x xampp-linux-x64-7.1.7-0-installer.run

4. Run the installer. After changing the permissions, you can run the installer to begin installing XAMPP. Type the following command and press Enter:
$ sudo ./xampp-linux-x64-7.1.7-0-installer.run

Configuring XAMPP

1. Start the XAMPP service. You can start XAMPP using the Terminal by entering the following command and pressing Enter. You may be prompted for your password.
$ sudo /opt/lampp/lampp start

2. Open the XAMPP splash page in your web browser. Open your web browser and type in http://localhost/xampp/ in your address bar. If the XAMPP service is running, you'll see the Welcome page. This will help you test that XAMPP is running correctly.

3. Set XAMPP to start when Linux boots. If you want XAMPP to run whenever the computer is turned on and logged in, you can add a line to your rc.local file:

a) Open the Terminal, type
$ sudo nano /etc/rc.local
and press Enter to open the rc.local file in the editor.

You can replace nano with your preferred editor. Example: gedit

Add: /opt/lampp/lampp start
to the line before exit 0.
Save and close the rc.local file.

4. Configure your security settings. XAMPP installs with no passwords, and it is not recommended that you run it when it is not secured. You can configure all of your security settings by entering the following command. This will take you through a process where you will be given a series of prompts related to various security aspects.
$ sudo /opt/lampp/lampp security

You will be asked to set a password for XAMPP, set some MySQL security settings, create a MySQL password, phpMyAdmin password, and FTP password.
Note that this will set your XAMPP username to llamp.

5. Activate eAccelerator. XAMPP includes eAccelerator, which is an optimization tool for PHP development. If you want to use it, you'll need to open the
$ sudo nano/opt/lampp/etc/php.ini
or
$ sudo gedit/opt/lampp/etc/php.ini (If you have gedit)

file and remove the " ; " from the beginning of each of the following lines. Restart XAMPP after saving the file:

Before:
;extension="eaccelerator.so"
;eaccelerator.shm_size="16"
;eaccelerator.cache_dir="/opt/lampp/tmp/eaccelerator"
;eaccelerator.enable="1"
;eaccelerator.optimizer="1"
;eaccelerator.check_mtime="1"
;eaccelerator.debug="0"
;eaccelerator.filter=""
;eaccelerator.shm_max="0"
;eaccelerator.shm_ttl="0"
;eaccelerator.shm_prune_period="0"
;eaccelerator.shm_only="0"
;eaccelerator.compress="1"
;eaccelerator.compress_level="9"


After:
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/opt/lampp/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"


Voila, it's done! Now you can enjoy coding in PHP and do whatever stuff you like.