Getting Started With XAMPP
Tags: php, beginners, productivity, discuss
Published: 2020-03-13 07:28:21

Cover: [studykouffee.tumblr.com](https://i.pinimg.com/564x/d7/52/0f/d7520f7212b694b06962d022bead98ed.jpg)

Watch in Youtube: https://youtu.be/z2heFiDrH_I

One of the most useful application for developer, the XAMPP. And one of my starter kit in development. This is how I configure this application.

<h3>I.Installing XAMPP</h3>

1. Download <a href="https://www.apachefriends.org/download.html">XAMPP</a> depends upon the OS you are using.<br>
Note: In these example, I'm using Windows operating sytem
2. Install the application, ignore the UAC first. Decide where your XAMPP folder will be created. In my case I have an allocated drive for all my development applications  and I never put it in drive C.
3. And then Start XAMPP Control Panel.

<h3>II.Configuring Apache, PHP and MySQL</h3>
A. Accessing phpMyadmin

By default you will get the following error when accessing the phpMyadmin over network in during fresh installation. 

<pre>
Access forbidden!
New XAMPP security concept:
Access to the requested directory is only available from the local network.
This setting can be configured in the file "httpd-xampp.conf".
If you think this is a server error, please contact the webmaster.
Error 403
192.168.5.6
Apache/2.4.37 (Win32) OpenSSL/1.1.1a PHP/7.3.1
</pre>

The following are the steps to fix the problem:
1. Open XAMPP Control Panel
2. In the Apache service config button or select box, click httpd-xampp.conf
<img src="https://thebnhs.000webhostapp.com/images/httpd-xampp-conf.png" alt="http-xampp-conf preview" width="100%">
<i>A preview of http-xampp.conf file</i>
3. Go to the following line and change the <b>Require local</b> by <b>Require all granted</b>.
4. The go back to the XAMPP control panel and restart the Apache service. 

B. Setting PHPMyAdmin With Credentials

1. Open XAMPP Control Panel
2. In the Apache service config button or select box, click config.inc.php
<img src="https://thebnhs.000webhostapp.com/images/config-inc-php.png" alt="config-inc-php preview" width="100%">
<i>A preview of config.inc.php file</i>
3. Add blowfish secret key
<p><code>$cfg['blowfish_secret'] = 'yourblowfishkeyhere12345';</code></p>
4. And change the <i>auth_type </i>,<i>user</i>, <i>password</i>, and  <i>AllowNoPassword</i>  <b>Authentication type and info</b>
<p><code>
$cfg['Servers'][$i]['auth_type'] = 'cookie'; <br>
$cfg['Servers'][$i]['user'] = 'root';<br>
$cfg['Servers'][$i]['password'] = 'yourpasswordhere';<br>
$cfg['Servers'][$i]['extension'] = 'mysqli';<br>
$cfg['Servers'][$i]['AllowNoPassword'] = false;<br>
$cfg['Lang'] = '';
</code>
</p>
4. The go back to the XAMPP control panel and restart the Apache service. 

C. Grant All Privileges To MySQL User in Any Host

By default <b>root</b> account are not accessible outside your localhost 
It means that you are not allowed to connect to the MySQL database over the network, but you can use it in your host PC or server and use with your project. Even adding new connection to your database management tool like HeidiSQL and Navicat is not working. To fix the following problem, this is the solution.

1. Go to phpMyadmin or CLI login using root account or any SUPER USER.
2. Run the following query to grant all privilage of your user in any valid host.

<p>
<code>
mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
</code>
</p>
3.To save changes using the execute <code>FLUSH PRIVILEGES</code>.
<p>
<code>
mysql > FLUSH PRIVILEGES;
</code>
</p>

D. Configuring Timezone

By default PHP timezone is <code>date.timezone=Europe/Berlin</code>, to change timezone, follow the steps below.

1. Open XAMPP Control Panel
2. In the Apache service config button or select box, click php.ini
3. Find <code>date.timezone</code> using <b>CTRL + F</b> in your text editor.
4. Change the value of the timezone depends on your location or preference. In my case it set it to <code>date.timezone=Asia/Manila</code>.
5. Save and restart apache services.

E: Changing Apache Ports

By default XAMPP ports are set to <b>80</b> but some instances that port <b>80</b> are already use by other web server like IIS and Nginx. Here's the way to change it.

1. Open XAMPP Control Panel
2. Click the <b>Config</b> button on panel side to show the <b>Configuration of Control Panel</b>.
3. Click <b>Service and Port Settings</b> and Save.
4. In the Apache service config button or select box, click <b>httpd.conf</b>
5. Find <code>Listen 80</code> and change the port to your desired port number. To easily change all port number use <b>CTRL + H</b> to find and replace all ports.
5. The go back to the XAMPP control panel and restart the Apache service. 

<h3>III.Configuring FileZilla</h3>

XAMPP also has <b>FileZilla Server</b> in order for the developer securely tranfer all files via ftp or sftp. By default Filezilla server listen to port 21 and has unlimited user set. To get started to use filezilla server follow the simple instructions below.

1. Open XAMPP Control Panel and start Filezilla services
2. In the Filezilla service click the admin button to show the filezilla server login credentials. By default it's server address <code>127.0.0.1</code>, port <b>14147</b> and empty administration password.
3. To configure settings, just go to <b>edit</b> and select settings. In these section we just change the <b>admin password</b>. To do this go to the <b>Admin Interface Settings</b> and check the change admin password. Then enter your desired password for your FileZilla server and click OK.
4. Then start to add ftp group for your team.

a. Click the group icon to show the groups configuration window.
b. In <i>General</i> click the add group button and enter your desired group name.
c. The go to the<i>Shared Folder</i> to add project directory.
 
<i>Note:</i>
In these part, the shared directory are the directory where my project located. For example our group project directory name <b>firstproject</b> are located under the <b>htdocs</b> folder. Therefore, the directory will be added to this part. If there are more than one project directory for your group, use aliases to display each folder every time you use you FTP account.

5.Then start to add ftp user.

a. Click the user icon to show the user configuration window.
b. In <i>General</i> click the add user button and enter your desired username. Add password, choose your group if you belong to a group, and make sure to check the enable account.
c. To add project directory go to <i>Shared Folder</i> to add project directory. If you belong to a group, make sure you choose a groupname under <i>General</i> tab because  a configure group has shared folder that will be display to your account when you login.

6.To check if the FTP configuration properly working, open <b>Windows Explorer 
 or browser</b>,type <code>ftp://yourhostserver</code>, and press enter. Then login credentials will appear, use the account created in your ftp server to enter the directory. Once you log successfully all project will be display, you can read, write, append, and delete file directly depends on your account.

<h3>IV.Overview with Mercury</h3>

<b>Mercury</b>  is a fully independent mail server and can provide email services to all standards-compliant email clients. This is a application that you can create email for your organization.

{% youtube 7dcaUUlsMOg %}
Credits:<a href="https://www.youtube.com/channel/UCURQDDFDNE8kFOHLXdGMrkw">Parag Dhali</a> 
 
<h3>V.Configuring Tomcat</h3>

Tomcat provides a "pure Java" HTTP web server environment in which Java code can run. By default tomcat server are set to port <b>8080</b> and tomcat users are not set in the <b>manager-gui</b>. <b>manager-gui</b> role are required to operate the "/manager/html" web application.

Tomcat Roles:
{% gist https://gist.github.com/aice09/404319fc3d674c56f6f49ac76ce9c05d %}

1. Open XAMPP Control Panel
2. In the Tomcat service config button or select box, click <b>tomcat-users.xml</b>
3. Copy and paste the given roles above inside <code>tomcat-users</code>.
4. The go back to the XAMPP control panel and restart the Tomcat service.

All things ready for your development.

<i>Info: XAMPP configuration video tutorial is posted soon in my <a href="https://youtu.be/z2heFiDrH_I">youtube channel</a>.</i> Please like, subscribe and press notication bell.