PHP TUTORIALPHP IntroductionPHP InstallationPHP Hello WorldPHP Basic SyntaxPHP VariablesPHP ConstantsPHP OutputPHP Data TypesPHP OperatorsPHP ConditionalsPHP Shorthand ConditionalsPHP LoopsPHP Loop Control StructuresPHP FunctionsPHP StringsPHP ArraysPHP Superglobal VariablesPHP in HTMLPHP RegexRegex IntroductionRegex PCRE SyntaxPHP PREG FunctionsPHP FormsPHP Forms IntroductionPHP Forms CreatingPHP Forms SecurityPHP Forms ValidationPHP Forms Required InputsPHP Forms StickyPHP Forms Advanced ValidationPHP Forms Finishing

PHP Hello World

Create a file named hello.php and save it in the root directory of your web server with following content.

PHP Hello World Example

echo 'Hello World'; 

Run Example ››

Now, enter your web server's URL in your browser, ending with /hello.php. If you are using a web server installed on PC, the full URL might be http://localhost/hello.php or

If you are using a host use the domain or sub-domain they have provided.

If everything configure correctly, you will see "Hello World" message in your browser. If you see that, you have just created your first PHP web page!

If you do not see any output, browser prompt for a download, or you see PHP file as text, then, either PHP is not enabled in your server or something went wrong on configuring. Read installation guide to learn more. If you are using a host, contact them to find a solution.