Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
XAMPP
1. XAMPP
XAMPP is a bundled combination of Apache web server, MySQL (or MariaDB) database, PHP server side programming system, for Linux operating systems. (The Windows version has some quirks).
Note: These notes are oriented towards Linux and CentOS 7.
2. XAMPP installation
Note: During the installation you need to answer some questions. I typically use the default responses.
The following Linux command(s) install XAMPP.
cd ~
wget https://www.apachefriends.org/xampp-files/7.1.31/xampp-linux-x64-7.1.31-2-installer.run
sudo chmod +x xampp-linux-x64-7.1.31-2-installer.run
sudo ./xampp-linux-x64-7.1.31-2-installer.run
3. Windows installation
Note that installation on Windows is not easy. XAMPP installs fine, but Windows wants to control http port 80 and https port 443 and getting around this is not easy.
The usual hack found on the Internet is to switch the ports to, say, 81 and 444 but this creates a lot of complications in developing, testing, and using web systems.
4. Start and stop XAMPP
The following Linux command(s) start XAMPP from command line.
sudo /opt/lampp/lampp start
On
2019-08-19 the output was as follows.
Starting XAMPP for Linux 7.1.31-2...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
The following Linux command(s) stop XAMPP from command line.
sudo /opt/lampp/lampp stop
Note: I had trouble getting XAMPP to stop and start and to recognize certain configuration changes.
For now, I ended up rebooting after changes to configuration files.
5. Start and stop Apache
The following Linux command(s) start just Apache from the command line.
sudo /usr/sbin/apachectl start
The following Linux command(s) stop just Apache from the command line.
sudo /usr/sbin/apachectl stop
6. Access a page on the installed web sever
To see if the default installation is working, from a web browser on the same computer, go to the following URL, where
CENT1 is the local domain name (and host name) of that computer.
http://CENT1
You should see the XAMPP default page.
Now go to another computer on the network. If that page cannot be accessed, then the firewall needs to be adjusted.
7. Firewall customization
The security subsystem SELinux restricts access to other computers so some commands are needed to adjust this.
The following Linux command(s) allow firewall access for http for XAMPP, Apache, etc..
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=http
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --zone=public --add-service=https
The following Linux command(s) to see what firewall exceptions have been added.
sudo firewall-cmd --zone=public --list-services
On
2019-08-19 the output was as follows.
ssh dhcpv6-client samba http https
There are:
ssh for SSH remote access
dhcpv6-client for DHCP via router
samba for Windows file sharing
http for HTTP remote access
https for HTTPS remote access
8. Apache GUI
There is a separate Apache GUI for managing XAMPP but it is not covered here yet.
9. Remote web page access
After the above firewall customizations, the default XAMPP page should not appear at the following URL from another computer on the local network.
http://CENT1
10. XAMPP configuration
XAMPP usually requires configuration after installation and this depends on a lot of architectural decisions of the network, the computers, etc.
11. Auto start on boot
12. Access and error logs
13. Graceful restart
After updating certain configuration files, or for other reasons, one may want to stop and start XAMPP.
to be added
14. Web site customization
Of course, you may want your own page and customizations.
I had trouble getting apache to stop and start once started.
I ended up rebooting for each change. When I find out a work-around or how to do it better, I will add it here.
I did not have this issue with Ubuntu or Mint Linux, just CentOS 7 Linux.
The following Linux command(s) edit the httpd.conf configuration file using nano.
sudo nano /opt/lampp/etc/httpd.conf
Do not change the
ServerRoot setting.
Scroll down.
I change the
ServerName to match the host name of the computer, in this case
CENT1.
Before:
ServerName localhost
After:
ServerName CENT1
For historical reasons, my web site root on Windows is
D:.
The Linux box accesses
D: at
/media/AX8-DATA. For more information, see
Windows file sharing to Linux using cifs .
So I change the
DocumentRoot and
Directory (for
DocumentRoot) as follows.
Before:
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
I comment out these lines as follows.
# DocumentRoot "/opt/lampp/htdocs"
# <Directory "/opt/lampp/htdocs">
Then I add lines so that it appears as follows.
# DocumentRoot "/opt/lampp/htdocs"
# <Directory "/opt/lampp/htdocs">
DocumentRoot "/media/AX8-DATA"
<Directory "/media/AX8-DATA">
Note: These log files can grow quite large, so you may want to delete them from time to time.
Since they are locked files while the web server is running, you need to stop the web server, delete the files, then restart the web server.
If after the above changes your web site (in this case, on the main Windows computer on the local network), then you may need to adjust access permissions.
15. Error logs
Do not change this location until the above works since one needs a way to see any configuration errors before changing the location of the error log.
To more easily access the error logs I make the following changes using the above method where I have made the
logs/CENT1 folder on the Windows machine.
#ErrorLog "logs/error_log"
ErrorLog "/media/AX8-DATA/logs/CENT1/error_log"