Table of Contents
Xampp
Xampp is an open source package that provide a PHP development environment.
Download e Installation
Download the last version of Xampp and follow the relative installation instructions.
In order to be able to install future extensions, like Xdebug, it's necessary to choose to install also the XAMPP Developer Files
:
Configuration of php.ini
Info: The PHP file configuration is in /opt/lampp/etc/php.ini
.
In order to detect errors during the development set:
display_errors=On
Create a virtul host
A virtual host allows several PHP development environments to be created on the same machine. Each of them will have a different name and will be associated with a different working directory.
In /opt/lampp/etc/httpd.conf
add the possibility to create virtual hosts (remove the #
):
# Virtual hosts Include etc/extra/httpd-vhosts.conf
and specify <user>
and <group>
to run httpd
as:
<IfModule unixd_module> # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # #User daemon #Group daemon User <user> Group <group> </IfModule>
In /opt/lampp/etc/extra/httpd-vhosts.conf
, at the bottom of the file, add the new virtual hosts (change <user>
):
# main local host <VirtualHost *:80> DocumentRoot "/opt/lampp/htdocs" ServerName localhost <Directory "/opt/lampp/htdocs"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Require all granted </Directory> </VirtualHost> # host for internal wiki <VirtualHost *:80> DocumentRoot "/home/<user>/dokuwiki" ServerName <user>.wiki <Directory "/home/<user>/dokuwiki"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Require all granted </Directory> <LocationMatch "/(data|conf|bin|inc)/"> Require all denied Satisfy All </LocationMatch> </VirtualHost> # host for testing php <VirtualHost *:80> DocumentRoot "/home/<user>/php" ServerName <user>.php <Directory "/home/<user>/php"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Require all granted </Directory> </VirtualHost>
Then, in /etc/hosts
associate the unique IP with the different hosts created:
127.0.0.1 localhost <user>.wiki <user>.php
With these settings, the previous hosts are reachable at the addresses:
http://localhost
http://<user>.wiki
http://<user>.php
(Re)Start/Stop Xampp
Every time a file in /opt/lampp/
is edited, in order to apply the changes, it's necessary to restart Xampp.
This can be done via:
Command Line
To start Xampp:
sudo /opt/lampp/lampp start
To restart Xampp:
sudo /opt/lampp/lampp restart
To stop Xampp:
sudo /opt/lampp/lampp stop
To know the status of Xampp
sudo /opt/lampp/lampp status
Xampp's control panel
Create a shortcut in the menu which execute the command:
sudo /opt/lampp/manager-linux-x64.run