How to run a PHP file in Chrome in 2021

PHP is a server-side scripting language. It is impossible to open a PHP script file in Chrome, unlike static HTML pages.

PHP scripts should be saved to a web server that supports PHP services. They can then be found by either entering the web address into the address bar or following a link at the same place.

How to run a PHP file from Chrome in 2021

Solution: Use XAMPP software

XAMPP is a free program released under the GNU General Public License. It allows you to view dynamic pages created in PHP language locally.

The software also includes PhpMyAdmin which is a useful program for managing your databases. This can then be integrated with your PHP pages.

Instructions step by step

1. Install XAMPP – It is easy and simple to install. I suggest that you leave all default and recommended settings.

2. Start XAMPP – Once the installation is complete, you will need to open XAMPP’s Control Panel.

You will see this screen once you have started.

Click on “Start” to view your PHP pages. MySQL can be used if you need data from your database.

If the modules are started, the operation will be successful. You will see it in the Control Panel if you observe a similar situation.

3. Your PHP page is now created- Create a PHP page if you don’t have one. The following outline structure is recommended:

4. The PHP file should be placed on the server – It doesn’t matter if you’re using the server from your computer or via the internet. Place the PHP file where you want it to be found.

You will need to place the PHP file into the.htdocs directory for XAMPP.

You will need an FTP connection to connect to web servers using FileZilla, or your web host control panel.

5. In your Chrome browser – find the path to your PHP webpage. In the Chrome address bar, type the address.

You can place the file in the root directory. This page address will use its domain name and file name.

http://yourdomain.com/yourfile.php

The following structure will be applied to PHP files located in subdirectories.

http://yourdomain.com/directoryname/yourfile.php

If the PHP file is being run on a local server on your computer. This is the structure of the file location. HTTP: //localhost/yourfile.php

6. Verify the page’s functionality – Depending on the purpose of your PHP test, you will need to determine how to test it.

First, ensure that the content appears as it should and that it is correctly formatted in HTML.

You can view the HTML source page by using the browser menu. To ensure that user controls are working as intended, make sure you test them thoroughly.

Conclusion

You will not be able to run a PHP file in Chrome. XAMPP, however, is a great tool that allows you to test and run your PHP files.

This tutorial should be a good start to explaining how to open a PHP file in Chrome.

Coding with joy!

Leave a Comment

x