Setting up a local development environment with Apache, PHP, and MariaDB/MySQL on Windows allows you to develop and test web applications efficiently. This article will guide you through the installation and configuration process step-by-step.
C:\Apache24C:\Apache24\conf\httpd.conf file in a text editor.ServerRoot directive to: ServerRoot "C:/Apache24"Listen directive to the desired port, e.g.,: Listen 80ServerName directive to: ServerName localhost:80bin directory: cd C:\Apache24\binhttpd.exe -k installhttpd.exe -k startC:\PHP.php.ini-development to php.ini.php.ini in a text editor and uncomment extension_dir = "ext"extension=mysqliEnvironment Variables.System variables, select Path and click Edit.C:\PHP to the list.C:\Apache24\conf\httpd.conf file in a text editor.LoadModule php_module "C:/PHP/php8apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/PHP"
httpd.exe -k restartphp.ini file in a text editor.extension=mysqli and extension=pdo_mysql
pdo only if you want to use PDO for connecting with mysqlhttpd.exe -k restartinfo.php in the C:\Apache24\htdocs directory.info.php<?php
phpinfo();
?>
Connect to MariaDB/MySQL
db_test.php in the C:\Apache24\htdocs directory.db_test.php:<?php
$mysqli = new mysqli("localhost", "root", "your_password", "mysql");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
echo "Connected successfully";
?>
Connected successfully is displayed.You have successfully installed and configured Apache, PHP, and MariaDB/MySQL on your Windows machine. This setup will provide you with a robust local development environment for your web projects
Thankyou for reading!
© 2025 Khaalis Technologies. All Rights Reserved. Designed by HTML Codex