PeeKay
PeeKay

Reputation: 11

PHP page with SQL not executing SSI files

I have a php site which uses SSI files for headers, footers, menus etc. all functioning correctly when they are linked from my PHP page to their local folder directory.

eg: a PHP page has <?php require_once('ssi/menu.shtm'); ?> coded on the page and it displays the required menu correctly.

These pages also have data being fed out from a SQL dbase to build the page based upon what the user has 'clicked'. This also functions correctly.

Each different page now needs a different menu which I've added into an additional SQL field i.e. <?php require_once('ssi/menu.shtm'); ?> now appears in the relevant SQL field for its' required page.

Problem: the SSI does not execute or display on the page in the browser when it's coming from SQL. If I view the source code of the page in a browser it has the code written exactly as it is in the SQL field but does no execute the SSI. If I view the source code in 'Firefox' it has the <?php require_once('ssi/menu.shtm'); ?> in italic and red - when I hover the mouse over it this message pops up: Saw "<?". Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)

I know this is probably a quick fix, but I've been teaching myself all of this so far and have been struggling with this for many weeks now.

Upvotes: 1

Views: 129

Answers (1)

DevionNL
DevionNL

Reputation: 153

If a browser returns <?php that means your PHP script was not executed and returns as plaintext or html content. Your problem lies with the webserver that isn't processing it as PHP script.

Since SSI (SQL Management SSI?, not clear what that means in this context), if you are in any way trying to include PHP files without running them through PHP/PHP-CGI it will not work.

Upvotes: 1

Related Questions