Setting Up PHP in XAMPP
To set up a PHP environment in XAMPP, you need to follow the steps below:
- Download and install XAMPP: Visit the official Apache Friends website (https://www.apachefriends.org/) to download the XAMPP version suitable for your operating system, and follow the installation wizard to install it.
- To start XAMPP: After installation, launch the XAMPP control panel. Typically on Windows, you can find the XAMPP folder in the Start menu and click on XAMPP Control Panel to start it.
- Start the Apache and MySQL services: In the XAMPP control panel, click on the “Apache” and “MySQL” buttons next to the “Start” button to initiate both services.
- Configure PHP: In the XAMPP control panel, click on “Apache (httpd.conf)” next to the “Config” button, then search for “LoadModule php” in the opened file and locate the following line:
AddHandler application/x-httpd-php .php
Make sure that these lines are not commented out (do not have a # symbol in front), if they are, remove the comments.
- Configure the PHP.ini file: In the XAMPP control panel, click on “PHP (php.ini)” next to the “Config” button, then make necessary configuration changes in the opened file. For example, you can set the “error_reporting” parameter to display PHP errors, or set the “upload_max_filesize” parameter to increase the file upload size limit.
- Test PHP: In the XAMPP control panel, click on “Apache” next to the “Admin” button to open the default XAMPP welcome page. Enter http://localhost in the browser’s address bar and press Enter. If everything is working properly, you will see the XAMPP welcome page, and you can access detailed PHP information by visiting http://localhost/phpinfo.php.
You have now successfully set up the PHP runtime environment and can start using XAMPP for PHP development.