run php via shtml

Avatar
  • Answered
Hello, I am trying to include/run a php file via a shtml. I have the following two files inside my public_html directory: [file: hello.shtml]
[file: hello.php] When I try to browse to www.[my_domain].com/hello.shtml, all it shows is "[an error occurred while processing this directive]" I know the php file has correct syntax because www.[my_domain].com/hello.php shows "Hello, World!". I have created a .htaccess and filled it as suggested here: https://www.inmotionhosting.com/support/website/php/php-code-in-html-file?tsrc=aaq AddType text/html .shtml .shtm .htm .html AddHandler server-parsed .shtml .shtm .htm .html Options Indexes FollowSymLinks Includes AddHandler application/x-httpd-php54 .shtml Now the error is gone but the shtml page is blank. I'd expect to see "Hello, World!" Thanks in advance.
Avatar
anonymous
Hello, The best way to do this would to have the server treat your .shtml as a .php file by adding the following to your .htaccess: ForceType application/x-httpd-php Then you would be able to use the php include code to add your hello world script to your .shtml file. Kindest Regards, TJ Edens