Difference between revisions of "Xampp"

From ArchWiki
Jump to: navigation, search
(added simple security advice for local test server (taken from stackexchange, I am not the author))
(Installation: Added AUR package)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Web Server]]
+
[[Category:Web server]]
 
[[cs:Xampp]]
 
[[cs:Xampp]]
 
[[es:Xampp]]
 
[[es:Xampp]]
 
[[it:Xampp]]
 
[[it:Xampp]]
 +
[[ja:Xampp]]
 
[[ru:Xampp]]
 
[[ru:Xampp]]
[http://www.apachefriends.org/en/xampp.html XAMPP] is an easy to install Apache distribution containing MySQL, PHP and Perl. It contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.
+
[http://www.apachefriends.org/en/xampp.html XAMPP] is an easy to install Apache distribution containing MySQL, PHP and Perl. It contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.
  
 
== Installation ==
 
== Installation ==
=== AUR ===
 
* [https://aur.archlinux.org/packages.php?ID=14141 Xampp package] in the [[AUR]]
 
  
=== Manual ===
+
==== Using AUR package ====
{{Note|If you are running 64-bit arch, you must install {{Pkg|lib32-glibc}} and {{Pkg|gcc-libs-multilib}} from the [[multilib]] repository.}}
+
 
# Download the latest version from [http://www.apachefriends.org/en/xampp-linux.html#374 here].
+
Install {{AUR|xampp}}.
# In the terminal run the following from the folder where the archive was downloaded to: {{bc|# tar xvfz xampp-linux-*.tar.gz -C /opt}}
+
 
 +
==== Manual Installation ====
 +
 
 +
Download the installer from [https://www.apachefriends.org/index.html the website].
 +
 
 +
The downloaded file is an installer script. Make it executable and run it by typing:
 +
 
 +
# chmod +x xampp-linux-'''version'''-installer.run
 +
# ./xampp-linux-'''version'''-installer.run
 +
 
 +
==== Removal ====
 +
 
 +
Be sure to stop all lampp services.
 +
 
 +
# /opt/lampp/lampp stop
 +
 
 +
All the files needed by Xampp to be installed are located in the previous {{ic|/opt/lampp}} folder. So, to uninstall Xampp:
 +
 
 +
# rm -rf /opt/lampp
 +
{{Note|If you created symlinks, you may need to destroy them too.}}
  
 
== Configuration ==
 
== Configuration ==
Line 19: Line 37:
 
Setting the individual parts of XAMPP can by made by editing following files:
 
Setting the individual parts of XAMPP can by made by editing following files:
  
'''/opt/lampp/etc/httpd.conf''' - Apache configuration. For example you can change folder with web page's source files.
+
{{ic|/opt/lampp/etc/httpd.conf}} - Apache configuration. For example you can change folder with web page's source files.
  
'''/opt/lampp/etc/php.ini''' - PHP configuration.
+
{{ic|/opt/lampp/etc/php.ini}} - PHP configuration.
  
'''/opt/lampp/phpmyadmin/config.inc.php''' - phpMyAdmin configuration.
+
{{ic|/opt/lampp/phpmyadmin/config.inc.php}} - phpMyAdmin configuration.
  
'''/opt/lampp/etc/proftpd.conf''' - proFTP configuration.
+
{{ic|/opt/lampp/etc/proftpd.conf}} - proFTP configuration.
  
'''/opt/lampp/etc/my.cnf''' - MySQL configuration.
+
{{ic|/opt/lampp/etc/my.cnf}} - MySQL configuration.
  
 
If you would like to set up security of server, you can do it simply by this command:
 
If you would like to set up security of server, you can do it simply by this command:
Line 51: Line 69:
 
XAMPP for Linux started.
 
XAMPP for Linux started.
 
}}
 
}}
Install net-tools and inetutils from [core] and you are good to go:
+
Install {{Pkg|net-tools}} and {{Pkg|inetutils}} from the [[official repositories]].
# pacman -S net-tools inetutils
+
  
== Removal ==
+
== Hosting files outside the htdocs directory ==
 
+
Be sure to stop all lampp services.
+
 
+
{{bc|# /opt/lampp/lampp stop}}
+
 
+
All the files needed by Xampp to be installed are located in the previous /opt/lampp folder. So, to uninstall Xampp, consider this command.
+
  
{{bc|# rm -rf /opt/lampp}}
+
The document root (web root) directory is located at {{ic|/opt/lampp/htdocs/}}.  All files placed in this directory will be processed by the web server.
 
+
'''NOTE:'''If you had create symlinks, you need to destroy them too!
+
 
+
== Hosting files outside the htdocs directory ==
+
The document root (web root) directory is located at '''/opt/lampp/htdocs/'''.  All files placed in this directory will be processed by the web server.
+
  
 
To host other files on your system with XAMPP, you can configure an alias with apache.
 
To host other files on your system with XAMPP, you can configure an alias with apache.
  
#Edit apache's httpd.conf with your favorite editor. {{bc|nano /opt/lampp/etc/httpd.conf}}
+
* Edit apache's httpd.conf with your favorite editor.
#Find "DocumentRoot", you will see something like:
+
# nano /opt/lampp/etc/httpd.conf
 +
* Find "DocumentRoot", you will see something like:
 
{{bc|
 
{{bc|
 
DocumentRoot "/opt/lampp/htdocs"
 
DocumentRoot "/opt/lampp/htdocs"
Line 81: Line 88:
 
</Directory>}}
 
</Directory>}}
  
In the next line after "</Directory>" paste this:
+
* In the next line after "</Directory>" paste this:
 
{{bc|
 
{{bc|
 
<Directory "/yourDirectory/">
 
<Directory "/yourDirectory/">
Line 89: Line 96:
 
</Directory>}}
 
</Directory>}}
  
Next find the "<IfModule alias_module>":  
+
* Next find the "<IfModule alias_module>":  
 
{{bc|
 
{{bc|
 
<IfModule alias_module>
 
<IfModule alias_module>
Line 102: Line 109:
 
</IfModule>
 
</IfModule>
 
}}
 
}}
And before the "</IfModule>" paste this:
+
* And before the "</IfModule>" paste this:
{{bc|
+
 
Alias /yourAlias /yourDirectory/
+
Alias /yourAlias /yourDirectory/
}}
+
  
Now do not forget to restart apache: {{bc|# /opt/lampp/lampp restart}}
+
* Now do not forget to restart Apache:
 +
# /opt/lampp/lampp restart
  
 
This will allow you to host files from your home directory (or any other directory) with XAMPP.
 
This will allow you to host files from your home directory (or any other directory) with XAMPP.
Line 113: Line 120:
 
In the above example, you can access the files by pointing your web browser to '''localhost/yourAlias'''.
 
In the above example, you can access the files by pointing your web browser to '''localhost/yourAlias'''.
  
== Debugging and Profiling with Xdebug and Xampp ==
+
== Debugging and profiling with Xdebug and Xampp ==
  
 
For detailed instructions go [http://xdebug.org/find-binary.php here].
 
For detailed instructions go [http://xdebug.org/find-binary.php here].
Line 119: Line 126:
 
You must first download the Xampp Development Tools from the same download page [http://www.apachefriends.org/en/xampp-linux.html here].
 
You must first download the Xampp Development Tools from the same download page [http://www.apachefriends.org/en/xampp-linux.html here].
  
Extract this into your Xampp directory.
+
Extract this into your Xampp directory:
  
{{bc|tar xvfz xampp-linux-devel-x.x.x.tar.gz -C /opt}}
+
# tar xvfz xampp-linux-devel-x.x.x.tar.gz -C /opt
  
You should be able to successfully run {{bc|/opt/lampp/bin/phpize}} in your xdebug folder.
+
You should be able to successfully run
 +
/opt/lampp/bin/phpize
 +
in your xdebug folder.
  
 
== PhpMyAdmin 403 Access Forbidden ==
 
== PhpMyAdmin 403 Access Forbidden ==
  
If your http://localhost/phpmyadmin returns "403 Access Forbidden", you need to edit the following settings in /opt/lampp/etc/extra/httpd-xampp.conf:
+
If your http://localhost/phpmyadmin returns "403 Access Forbidden", you need to edit the following settings in {{ic|/opt/lampp/etc/extra/httpd-xampp.conf}}:
  
 
  <Directory "/opt/lampp/phpmyadmin">
 
  <Directory "/opt/lampp/phpmyadmin">
Line 136: Line 145:
 
  </Directory>
 
  </Directory>
  
== Local Test Server Security ==
+
== Local test server security ==
  
 
Apache and MySQL can be configured so that they only listen to requests from your own computer. For most test systems this is fine and it greatly reduces the risk because the services are not reachable from the Internet.
 
Apache and MySQL can be configured so that they only listen to requests from your own computer. For most test systems this is fine and it greatly reduces the risk because the services are not reachable from the Internet.
Line 144: Line 153:
 
For Apache edit the files xampp\apache\conf\httpd.conf and xampp\apache\conf\extra\httpd-ssl.conf. Look for lines starting with "Listen" such as
 
For Apache edit the files xampp\apache\conf\httpd.conf and xampp\apache\conf\extra\httpd-ssl.conf. Look for lines starting with "Listen" such as
  
{{bc|Listen 80}}
+
Listen 80
  
 
and replace them with
 
and replace them with
  
{{bc|Listen 127.0.0.1:80}}
+
Listen 127.0.0.1:80
  
 
For MySQL open the file xampp\mysql\bin\my.cnf find the section "[mysqld]" and add this line
 
For MySQL open the file xampp\mysql\bin\my.cnf find the section "[mysqld]" and add this line
  
{{bc|1=bind-address=localhost}}
+
bind-address=localhost
  
 
After starting the services, verify the result by going to a command window and start and execute:
 
After starting the services, verify the result by going to a command window and start and execute:
  
{{bc|netstat -a -n}}
+
netstat -a -n
  
 
For the entries marked as LISTEN in the last column, look at the Listen column. It should always start with 127.0.0.1 or ::1 but not with 0.0.0.0.
 
For the entries marked as LISTEN in the last column, look at the Listen column. It should always start with 127.0.0.1 or ::1 but not with 0.0.0.0.

Latest revision as of 09:58, 11 February 2016

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. It contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.

Installation

Using AUR package

Install xamppAUR.

Manual Installation

Download the installer from the website.

The downloaded file is an installer script. Make it executable and run it by typing:

# chmod +x xampp-linux-version-installer.run 
# ./xampp-linux-version-installer.run 

Removal

Be sure to stop all lampp services.

# /opt/lampp/lampp stop

All the files needed by Xampp to be installed are located in the previous /opt/lampp folder. So, to uninstall Xampp:

# rm -rf /opt/lampp
Note: If you created symlinks, you may need to destroy them too.

Configuration

Setting the individual parts of XAMPP can by made by editing following files:

/opt/lampp/etc/httpd.conf - Apache configuration. For example you can change folder with web page's source files.

/opt/lampp/etc/php.ini - PHP configuration.

/opt/lampp/phpmyadmin/config.inc.php - phpMyAdmin configuration.

/opt/lampp/etc/proftpd.conf - proFTP configuration.

/opt/lampp/etc/my.cnf - MySQL configuration.

If you would like to set up security of server, you can do it simply by this command:

# /opt/lampp/lampp security

You will be asked step by step to choose passwords for web page's access, user "pma" for phpMyAdmin, user "root" for MySQL and user "nobody" for proFTP.

Usage

Use the following commands to control XAMPP:
# /opt/lampp/lampp start,stop,restart

If you get this error when you start it:

Starting XAMPP for Linux 1.7.7...
/opt/lampp/lampp: line 21: netstat: command not found
/opt/lampp/lampp: line 21: netstat: command not found
XAMPP: Starting Apache with SSL (and PHP5)...
/opt/lampp/lampp: line 241: /bin/hostname: No such file or directory
/opt/lampp/lampp: line 21: netstat: command not found
XAMPP: Starting MySQL...
/opt/lampp/bin/mysql.server: line 263: hostname: command not found
/opt/lampp/lampp: line 21: netstat: command not found
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

Install net-tools and inetutils from the official repositories.

Hosting files outside the htdocs directory

The document root (web root) directory is located at /opt/lampp/htdocs/. All files placed in this directory will be processed by the web server.

To host other files on your system with XAMPP, you can configure an alias with apache.

  • Edit apache's httpd.conf with your favorite editor.
# nano /opt/lampp/etc/httpd.conf
  • Find "DocumentRoot", you will see something like:
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
    ...    
    ...

</Directory>
  • In the next line after "</Directory>" paste this:
<Directory "/yourDirectory/">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>
  • Next find the "<IfModule alias_module>":
<IfModule alias_module>

    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar
  ...
</IfModule>
  • And before the "</IfModule>" paste this:
Alias /yourAlias /yourDirectory/
  • Now do not forget to restart Apache:
# /opt/lampp/lampp restart

This will allow you to host files from your home directory (or any other directory) with XAMPP.

In the above example, you can access the files by pointing your web browser to localhost/yourAlias.

Debugging and profiling with Xdebug and Xampp

For detailed instructions go here.

You must first download the Xampp Development Tools from the same download page here.

Extract this into your Xampp directory:

# tar xvfz xampp-linux-devel-x.x.x.tar.gz -C /opt

You should be able to successfully run

/opt/lampp/bin/phpize

in your xdebug folder.

PhpMyAdmin 403 Access Forbidden

If your http://localhost/phpmyadmin returns "403 Access Forbidden", you need to edit the following settings in /opt/lampp/etc/extra/httpd-xampp.conf:

<Directory "/opt/lampp/phpmyadmin">
	AllowOverride AuthConfig Limit
	#Order allow,deny
	#Allow from all
	Require all granted
</Directory>

Local test server security

Apache and MySQL can be configured so that they only listen to requests from your own computer. For most test systems this is fine and it greatly reduces the risk because the services are not reachable from the Internet.

Before you start XAMPP for the first time find and edit these files:

For Apache edit the files xampp\apache\conf\httpd.conf and xampp\apache\conf\extra\httpd-ssl.conf. Look for lines starting with "Listen" such as

Listen 80

and replace them with

Listen 127.0.0.1:80

For MySQL open the file xampp\mysql\bin\my.cnf find the section "[mysqld]" and add this line

bind-address=localhost

After starting the services, verify the result by going to a command window and start and execute:

netstat -a -n

For the entries marked as LISTEN in the last column, look at the Listen column. It should always start with 127.0.0.1 or ::1 but not with 0.0.0.0.