How to Test PHP & Apache Working or Not – PHP Tutorials

test apache and php

In our previous post, we shared how to install PHP on windows. If you don’t know how to install PHP then you can check our previous post. PHP is used to make websites dynamic.

PHP is a server-side scripting language. It has lots of frameworks to do programming. To use PHP you need to install PHP first. Then after you have to install Apache server that will help you to run your PHP script through a web browser using localhost.

Apache’s main job is to listen to any incoming request from a browser and return an appropriate response. Apache is quite powerful and can accomplish virtually any task that you as a webmaster require.

According to the website (, Apache is running over 83.5 million internet servers, more than Microsoft, Sun ONE, and Zeus. To make sure that both PHP and Apache have been configured to work together let’s write a short test program.

To write program code you can choose any of your favourite Text-Editor and save that file to an appropriate location to execute, otherwise, you can not run your PHP script. If you are using Xampp,


If you are using Apache official,

C:Program FilesApache Software FoundationApache2.2

if you are using Wamp,


Before that, you have to start Apache server. If you are using Xampp then go to xampp control panel and start Apache server. If you are using Wamp server then put it online. If any other than run Apache server online to execute .php extension files. PHP CODE

<title>My First PHP Code</title>
echo "Hello World!";
echo "<p>Testing Apache and PHP</p>";
Browser Output: localhost/tphp.php - localhost/filename.php -
PHP is the extension

Now you get output on your browser then PHP and Apache both are working fine. If you are not getting output then your Apache and PHP configuration is wrong. provides tutorials related to tech and programmings. We are also setting up a community for the users and students.