PHP Basic Tutorial
MySQL Connection
Installing PHP is a straightforward process that enables you to run PHP scripts locally on your computer for development. To install PHP, we will suggest you to install AMP (Apache, MySQL, PHP) software stack. It is available for all operating systems. There are many AMP options available in the market that are given below:
XAMPP is a free software package that includes Apache (web server), MySQL (database server), and PHP, making it easy to set up a local development environment.
Step:1 Download XAMPP: Go to the XAMPP website and download the version compatible with your system.
Step:2 Install XAMPP: Run the installer and follow the prompts. During installation, ensure PHP and Apache are selected.
Step:3 Start Apache Server: Open the XAMPP Control Panel and click on the "Start" button next to Apache to run the web server.
Step:4 Verify Installation: Create a file named info.php
with the following content:
<?php phpinfo(); ?>
Save this file in the htdocs
folder of XAMPP (e.g., C:\xampp\htdocs\info.php
). Open a web browser and go to http://localhost/info.php
. If PHP is installed correctly, you should see a PHP information page.
Step:1 Download PHP: Go to the PHP downloads page and get the latest version of PHP for Windows.
Step:2 Extract PHP: Extract the contents to a folder (e.g., C:\php
).
Step:3 Configure PHP:
php.ini-development
to php.ini
.php.ini
in a text editor and configure settings like enabling extensions if needed. Step:4 Add PHP to Path: Add the PHP directory to the Windows PATH
environment variable so you can run it from the command line.
Step:5 Verify Installation: Open the Command Prompt and type php -v
to check the PHP version.