CentOSServerSoftware

How to install XAMPP 1.8.3 with PHP 5.5.11 on Centos Sever

XAMPP is a collection of packages includes Apache web server, MySQL databse server, PEAR, SQLite, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype, openLDAP and nessary libraries. If you are not comfortable to install/configure each package separately, XAMPP is a good choice for you since everything is configured with XAMPP. XAMPP isn’t only run on Linux, XAMPP is an open source cross-platform means you can also run XAMPP on Windows, and MAC OS X Apple. I’m going to show you how to install XAMPP 1.8.3 with PHP 5.5.11 on Centos Sever.

Before you install XAMPP, make sure your Centos Linux system is up to date

# yum update

I’m installing XAMPP on a fresh Centos system, if you are installing to a VPS template, your VPS template may come with apache web server already. You need to remove Apache from VPS template before install XAMPP

# yum remove httpd*

Download XAMPP

Currently there are XAMPP 1.8.2 comes with PHP 5.4 and XAMPP 1.8.3 comes with PHP 5.5. I’m going to use XAMPP 1.8.3 in this article for PHP 5.5.

For Centos x32

# cd /tmp
# wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.8.3/xampp-linux-1.8.3-4-installer.run

For Centos x64

# cd /tmp
# wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.8.3/xampp-linux-x64-1.8.3-4-installer.run

Install XAMPP

It’s pretty simple to install XAMPP, all you have to do is to run the script and answer some questions.

# chmod 755 xampp-linux*
# ./xampp-linux*

You will be ask several questions, just say y for yes for all of them. The installation process may take sometimes depends on how fast your system is.

[root@namhuy tmp]# ./xampp-linux*
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

XAMPP Core Files : Y (Cannot be edited)

XAMPP Developer Files [Y/n] :y

Is the selection above correct? [Y/n]: y

----------------------------------------------------------------------------
Installation Directory

XAMPP will be installed to /opt/lampp
Press [Enter] to continue :

----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.

Do you want to continue? [Y/n]: y

----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.

Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.

To start XAMPP

# /opt/lampp/lampp start

You should see

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

Your XAMPP server should be up and running by now. The first time you browse your domain you may see “Access forbidden!” error. To fix that problem, you need to turn off some of XAMPP security features.

# nano /opt/lampp/etc/extra/httpd-xampp.conf

Scroll down to the end of the file, you will see

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
 Require local
 ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

You will need to Comment them out to

# <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
 # Require local
 # ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
#

Now restart XAMPP server

# /opt/lampp/lampp restart

The first time you run XAMPP from your web browser to http://domain.com you will be asked to choose language.

Configure LAMPP

We are now going to create virtual host

# nano /opt/lampp/etc/httpd.conf

Search for

# Include etc/extra/httpd-vhosts.conf

Remove the hash sign # in front of Include etc/extra/httpd-vhosts.conf to become this

Include etc/extra/httpd-vhosts.conf

Restart XAMPP again

# /opt/lampp/lampp restart

Next step is to configure httpd-vhosts.conf

# nano /opt/lampp/etc/extra/httpd-vhosts.conf

Default httpd-vhosts.conf file

ServerAdmin webmaster@dummy-host.example.com
 DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
 ServerName dummy-host.example.com
 ServerAlias www.dummy-host.example.com
 ErrorLog "logs/dummy-host.example.com-error_log"
 CustomLog "logs/dummy-host.example.com-access_log" common

ServerAdmin webmaster@dummy-host2.example.com
 DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
 ServerName dummy-host2.example.com
 ErrorLog "logs/dummy-host2.example.com-error_log"
 CustomLog "logs/dummy-host2.example.com-access_log" common

Depends on where you want to store you website html/php files, adjust DocumentRoot accordingly. For this tutorial, I’m going to use /var/www/html. First I’m going to create /var/log/www/html directory on my Centos system to store website’s files

# mkdir -p /var/www/html

This is sample httpd-vhosts.conf which I set

 ServerAdmin webmaster@namhuy.net
 DocumentRoot "/var/www/html"
 ServerName namhuy.net
 ServerAlias www.namhuy.net
 ErrorLog "logs/namhuy.net-error_log"
 CustomLog "logs/namhuy.net-access_log" common

Save httpd-vhosts.conf file and restart xampp again

# /opt/lampp/lampp restart

Secure XAMPP

By default XAMPP does not have any password which isn’t secure at all. You can make XAMPP more secure by running this command

# /opt/lampp/lampp security

You will be able to set xampp’s password, remove remote access to MySQL, set MySQL/phpMyAdmin user pma password, set MySQL root’s password, set FTP password

XAMPP: Quick security check...
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Password protection active. Please use 'xampp' as user name!
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes
XAMPP: Turned off.
XAMPP: Stopping MySQL...ok.
XAMPP: Starting MySQL...ok.
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Setting new MySQL pma password.
XAMPP: Setting phpMyAdmin's pma password to the new one.
XAMPP: MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Write the password somewhere down to make sure you won't forget it!!!
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Setting new MySQL root password.
XAMPP: Change phpMyAdmin's authentication method.
XAMPP: The FTP password for user 'daemon' is still set to 'xampp'.
XAMPP: Do you want to change the password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Reload ProFTPD...ok.
XAMPP: Done.

Note after you set xampp’s password, the next you go to http://domain.com/xampp you will be asked for username and password. The username is xampp and the password is the one you set.

Activate eAccelerator

eAccelerator is a free open-source PHP accelerator & optimizer. xampp includes eAccelerator but does not enable it by default. To activate eAccelerator, you need to make some change in /opt/lampp/etc/php.ini file

# nano /opt/lampp/etc/php.ini

Search for eaccelerator part in xampp’s php.ini file, you should see

;extension="eaccelerator.so"
;eaccelerator.shm_size="16"
;eaccelerator.cache_dir="/opt/lampp/temp/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"

To enable/activate eAccelerator, remove all of the the semicolons at the beginning of each line. Save php.ini file and restart xampp.

# /opt/lampp/lampp restart

 

Related Articles

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button