Page 1 of 1

Running PHP Scripts in Includes

PostPosted: Fri Oct 28, 2011 9:40 am
by bwokich
I'm trying to call a PHP script from inside an include. I have my include named FILENAME.php and am then including it with [-- INCLUDE FILENAME.php PROCESS --]

The include's a simple hello world at the moment.

Code: Select all
<?php echo 'hello world';?>


The PHP is appearing in the source of the markup without being interpreted.

Any advice on what I'm doing wrong?

Bryan

Re: Running PHP Scripts in Includes

PostPosted: Fri Oct 28, 2011 9:47 am
by loren_d_c
ShopSite does not process PHP code, that is up to your webserver. Is the page that the PHP code is showing up on named with a .php file extension? Some servers require this in order for them to process the PHP code. Note that PHP will not work in the shopping cart, search, gift certificate, or customer registration pages, these are .cgi pages and the webserver will not parse the output of .cgi's for PHP code.

-Loren

Re: Running PHP Scripts in Includes

PostPosted: Wed Nov 20, 2013 10:31 pm
by bkerns
I believe you can enable PHP to run in HTML docs by adding a type or handler to your .htaccess:

AddType application/x-httpd-php .html .htm
or
AddHandler application/x-httpd-php .html .htm

-Brian