Install PHP 5.6 , Mysql , phpMyAdmin, Apache Server using XAMPP 5.6.40
Understanding the Need for Legacy Stacks
In modern software development, the relentless march towards the latest stable versions of languages, frameworks, and databases is often a strategic imperative. However, a significant portion of the internet’s infrastructure still relies on older, albeit stable, software versions. This is particularly true for legacy applications that are critical to business operations but are too costly or risky to refactor immediately. For such scenarios, maintaining environments with specific older versions like PHP 5.6, MySQL, and Apache becomes a necessity. This guide details the installation of XAMPP 5.6.40, a bundle that provides precisely this stack, along with phpMyAdmin for database management.
XAMPP 5.6.40: The Chosen Stack
XAMPP (Cross-Platform Apache MySQL PHP Perl) is a popular, free, and open-source cross-platform web server solution stack developed by Apache Friends. It comprises an Apache HTTP Server, MariaDB (a drop-in replacement for MySQL), PHP, and Perl. Version 5.6.40 is a specific release that bundles PHP 5.6, which is crucial for compatibility with older PHP applications. While newer XAMPP versions are readily available, targeting this specific older release is key for maintaining legacy systems.
Installation Procedure
The installation process for XAMPP is generally straightforward, but it’s essential to download the correct version. For this guide, we will focus on XAMPP for Windows, as it’s a common deployment target for legacy applications. The principles can be adapted for other operating systems.
Downloading XAMPP 5.6.40
Navigate to the Apache Friends archive page. It’s crucial to find the specific version 5.6.40. Older versions are typically archived and may require a bit of digging. The direct download link for Windows 5.6.40 is usually found under the “Previous Releases” or “Archive” section.
Note: Direct links to older archived software can change. Always verify the download source for security. A typical URL structure might look like this:
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.40/xampp-win32-5.6.40-1-VC11-installer.exe/download
Running the Installer
Once downloaded, execute the installer. You may encounter User Account Control (UAC) prompts. It is generally recommended to install XAMPP in a directory outside of “Program Files” to avoid potential permission issues, especially on older Windows versions. A common choice is C:\xampp.
- During the installation, you will be prompted to select components. Ensure that “Apache”, “MySQL”, “PHP”, and “phpMyAdmin” are selected. Other components like FileZilla FTP Server or Mercury Mail Server are optional for this specific stack.
- Choose your installation directory (e.g.,
C:\xampp). - The installer will proceed to copy files. This may take several minutes.
- Upon completion, you will be asked if you want to start the Control Panel. It’s advisable to check this box.
Configuring and Managing Services
The XAMPP Control Panel is your central hub for managing the Apache and MySQL services. It provides a simple interface to start, stop, and configure these core components.
Starting Apache and MySQL
Open the XAMPP Control Panel. You will see a list of modules. Click the “Start” button next to “Apache” and “MySQL”.
Troubleshooting Port Conflicts: If Apache or MySQL fails to start, it’s likely due to port conflicts. Common culprits are Skype (uses port 80 and 443) or other web servers already running. The Control Panel often shows error messages or highlights the conflicting module. You can click the “Netstat” button to see which processes are using specific ports.
To resolve port conflicts for Apache:
- Click the “Config” button next to Apache.
- Select
httpd.conf. - Search for
Listen 80and change it to a different port, e.g.,Listen 8080. - Search for
ServerName localhost:80and change it toServerName localhost:8080. - Save the file and restart Apache from the Control Panel.
- You will then access your web server via
http://localhost:8080.
Accessing phpMyAdmin
Once MySQL is running, you can access phpMyAdmin to manage your databases. Open your web browser and navigate to:
http://localhost/phpmyadmin/
The default username for MySQL in XAMPP is root with no password. This is a critical security consideration for production environments and should be changed immediately.
Securing the Installation
A default XAMPP installation is not secure enough for production use. The most critical step is to secure your MySQL installation.
Securing MySQL
XAMPP provides a script to help with this. Open your command prompt (as administrator) and navigate to the XAMPP installation directory’s mysql\bin folder:
cd C:\xampp\mysql\bin
Then, execute the security script:
mysql_secure_installation
This script will guide you through setting a root password, removing anonymous users, disallowing remote root login, and removing the test database. It is imperative to complete these steps.
Securing Apache
For Apache, security involves several aspects:
- Disable Directory Listing: Prevent users from browsing directory contents. Edit
httpd.conf(located inC:\xampp\apache\conf) and ensure thatOptions Indexes FollowSymLinksis changed toOptions FollowSymLinkswithin relevant<Directory>blocks, or removeIndexesfrom the globalOptionsdirective if applicable. - Enable HTTPS: For secure communication, you’ll need to configure SSL/TLS. This involves generating or obtaining SSL certificates and configuring
httpd-ssl.conf(inC:\xampp\apache\conf\extra). This is a more involved process and often requires dedicated certificate management. - Access Control: Use
.htaccessfiles or Apache’s configuration directives (e.g.,Require ip) to restrict access to certain directories or files.
PHP Configuration for Legacy Apps
PHP 5.6 has specific configuration directives that might need tuning for older applications. The primary configuration file is php.ini, located in C:\xampp\php\php.ini.
Key `php.ini` Directives
When working with legacy PHP 5.6 applications, pay close attention to these settings:
memory_limit: Older applications might have higher memory requirements. Increase this value if you encounter “Allowed memory size exhausted” errors. Example:memory_limit = 256M.upload_max_filesizeandpost_max_size: Crucial for applications that handle file uploads. Ensure these are set appropriately for the expected file sizes. Example:upload_max_filesize = 64M,post_max_size = 64M.max_execution_time: For long-running scripts, you might need to increase this. Be cautious, as excessively high values can mask performance issues. Example:max_execution_time = 300.display_errors: For development, settingdisplay_errors = Onis useful. For production, it should beOff, with errors logged to a file vialog_errors = Onanderror_logdirective.date.timezone: Ensure this is set to your server’s timezone to avoid date/time inconsistencies. Example:date.timezone = "UTC"ordate.timezone = "America/New_York".magic_quotes_gpc: This directive was removed in PHP 7.0 but is present in PHP 5.6. If your legacy application relies on it (which is bad practice), you might need to ensure it’s enabled (magic_quotes_gpc = On). However, the ideal solution is to refactor the application to not depend on it.register_globals: Also deprecated and removed in later versions. If your application uses it, you’ll needregister_globals = On. Again, refactoring is the long-term solution.
After modifying php.ini, you must restart Apache for the changes to take effect.
Virtual Hosts Configuration
For managing multiple legacy applications, setting up Apache Virtual Hosts is essential. This allows you to host different websites on the same server, each with its own domain name.
Enabling Virtual Hosts
First, ensure the virtual hosts module is enabled in Apache. Edit httpd.conf (C:\xampp\apache\conf\httpd.conf) and uncomment the following line:
#Include conf/extra/httpd-vhosts.conf
Change it to:
Include conf/extra/httpd-vhosts.conf
Defining Virtual Hosts
Now, edit the virtual hosts configuration file: C:\xampp\apache\conf\extra\httpd-vhosts.conf. Add entries for your applications. For example, to host an application named ‘legacy-app’ on legacy-app.local:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs/legacy-app"
ServerName legacy-app.local
ErrorLog "logs/legacy-app-error.log"
CustomLog "logs/legacy-app-access.log" common
</VirtualHost>
You will also need to map legacy-app.local to your local machine in your hosts file. Edit C:\Windows\System32\drivers\etc\hosts and add:
127.0.0.1 legacy-app.local
Ensure the DocumentRoot directory (C:/xampp/htdocs/legacy-app in this example) exists and contains your application’s files. After saving these changes, restart Apache from the XAMPP Control Panel.
Conclusion: Managing the Past for Present Stability
While the industry pushes forward, the reality of maintaining critical legacy systems often necessitates working with older software stacks. XAMPP 5.6.40 provides a contained and manageable environment for PHP 5.6, MySQL, and Apache. By following these steps for installation, configuration, security, and virtual host setup, you can effectively deploy and manage legacy applications, ensuring their continued operation while strategic decisions about modernization are made.
Leave a Reply
You must be logged in to post a comment.