How to run php file in localhost or browser ?
To run PHP in XAMPP, follow these steps:
- Open XAMPP Control Panel and start the Apache and MySQL modules.
- Open your web browser and go to http://localhost/xampp/.
- Click on the "phpMyAdmin" link to open the phpMyAdmin interface.
- Create a new database or use an existing one.
- Create a new PHP file in the "htdocs" folder of your XAMPP installation. You can use any text editor to create the file (e.g. Notepad, Sublime Text, etc.). Name the file with the .php extension (e.g. myfile.php).
- In the PHP file, add your PHP code. For example:
php Copy code <?php echo "Hello, world!"; ?>
- Save the PHP file.
- Open your web browser and go to http://localhost/myfile.php (replace "myfile" with the name of your PHP file).
- If everything is working correctly, you should see the message "Hello, world!" displayed on the web page.
Congratulations! You have successfully run PHP in XAMPP.
0
Howdy, Stranger!