What are common reasons for PHP scripts displaying only source code in the browser?
Common reasons for PHP scripts displaying only source code in the browser include not having PHP installed or configured correctly on the server, incorrect file extensions (e.g., using .html instead of .php), and errors in the PHP code itself. To solve this issue, ensure that PHP is installed and configured properly on the server, use the correct file extension (.php), and check for any syntax errors in the PHP code.
<?php
// Correct file extension and PHP opening tag
echo "Hello, World!";
?>