XAMPP is one of the most popular PHP development environment XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use. Here’s a breakdown of the four components of XAMPP.
XAMPP – most of the web developer will know what it is! This simple description is for the newbies.
XAMPP is completely free PHP development environment. It contains Apache distribution packed with mysql , PHP and Pearl which is available for most popular OS’s like Windows/Linux/Mac OSX, that makes you to configure and run Apache server in your local machine.
Before downloading the XAMPP, be sure about the PHP version you need. You can download the Latest Version of XAMPP here.
Yeah thats it ! now your MAC is equipped with XAMPP.
Its time to start apache server in the local machine!
phpMyadmin -> you can create or manipulate database easily with the help of this tool.
webalizer – > its a web analyser tool.
The virtual host is required whenever you are working in multiple projects and their directories are at different location. Virtual Host allows you to run multiple local sites using single apache server.
You can configure n number of virtual host but it must have unique different name
You have to enable the virtual host in this configuration file.
Search for “# Virtual hosts” and uncomment the “Include etc/extra/httpd-vhosts.conf” line by removing ‘#’ before it.
Before:
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
After:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Find these “User/Group” line and Change the user group name (daemon) to your MAC user name. This prevents the server from making 403 access forbidden error.
Before:
<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
</IfModule>
After
<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 YourMacUserName
Group daemon
</IfModule>
after making this changes save the configuration file and restart the apache servers.
Now you can see a new file inside “/Applications/XAMPP/xamppfiles/etc/extra” called “httpd-vhosts.conf”
Open and edit : /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
Add the below lines at the end of the file
# My custom host
<VirtualHost *:80>
ServerName yourSiteName.local
DocumentRoot “/Users/yourusername/path/to/your/site”
<Directory “/Users/yourusername/path/to/your/site“>
Options All
Allow from all
AllowOverride All
Require all granted
</Directory> ErrorLog “logs/mysite.local-error_log”
</VirtualHost>
Replace the yourSiteName.local & document root path to the required one.
# XAMPP VirtualHost mappings
127.0.0.1 yourSiteName.local
To create multiple host replicate the code added in /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf file again but with different site name and add the host entry for that also. Restart the Apache server for the changes to take effect.
Yeah it’s all done. Now you can hit the virtual host in the browser.If you have any doubts and clarification regarding this, drop it in the comment section.
If you like this post, Share it to your friends. Dont forget to Subscribe our Feeds, Follow us on Twitter, Facebook and Pinterest.
Amazon.com Widgets