Open PHP File

Information, tips and instructions

Open PHP File

PHP files are used to store code written in Hypertext Language or PHP, a computer language used in web development to create dynamic pages.

PHP code allows to create a web page which can display according to several parameters, such as user location, type of client equipment (mobile, PC, etc). Often used to create spaces for members, it is associated with other code systems (CSS, HTML, etc.).

PHP files can include elements that offer additional features and functions for websites, such as contact forms, widgets and menus.

They are used to provide more functionality to web pages and work in conjunction with standard HTML files.

PHP files could be opened either for editing, debugging, adding code or for execution.

To edit a PHP file, just use a text editor. It can be Notepad, native to Microsoft Windows or it can also be a programming environment intended for this purpose, such as Visual Studio Community.

For example, to open the following PHP file, just right click on the file, 'Open with' and choose Notepad, as follows:

Doing so will show the code that would run on any well-configured PHP server:

If you want to create a HelloWorld.php, copy the code below and paste in a notepad file and save with the PHP extension:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '

Hello World

'; ?>
</body>
</html>

It is necessary to emphasize that PHP files can only be 'executed' behind a configured server, if you are on Windows, you need to install a suitable PHP server, such as the XAMP which is an Apache server package which contains a PHP engine.

You can download the XAMP software from the following link:

Once installed, locate the content folder of the helloworld.php file created with the code above. Put it to the C:\xampp\htdocs folder and write the following in a browser:

http://localhost/helloworld/HelloWorld.php

And the following will be displayed:

That corresponds to the correct execution of the PHP file on a server, which is different from editing the file itself.

If you find problems opening a PHP file, it may be due to coding errors, malware damage or the file is corrupted, in any case, you must scan the file with an antivirus program, prior to editing/execution.

Open PHP file in Windows OS

  • If you know the application which uses that particular PHP file use it to open it
  • If you don't know which application uses your PHP file try opening PHP file with PHP or text editor to see what is inside
  • You can use Microsoft Visual Studio Code, Rapid PHP Editor, UltraEdit
  • If the PHP file in question was downloaded from the web you may want to refer to the website from where it was downloaded. Typically PHP files are not expected to be downloaded from websites.

Get more information about how to open PHP file.

Also check how to:

If you are not able to open file with certain file extension make sure to check if extension for the file is correct. It is possible that information in the file doesn't match file extension.

File Extension Info

PHP Quick Info
  Hypertext Preprocessor
MIME Type
  text/plain
Opens with
  Notepad
  Sublime