Question

I am working on a Drupal-based website that works fine on the remote server (LAMP stack) as well as all other developer's systems (WAMP stack). But when I try to run it, the PHP code is spit out in the browser along with the HTML instead of being parsed like it should.

There's very little information that I can glean from error logs. PHP itself is installed properly and a clean Drupal installation works. It's only the code that I check out from our repository that goes awry and only on my own system.

Pretty URL's also don't work, and I have to use the /q=xxx format to get to pages at all. Pretty URL's just end up with a parsing error in weird locations when there shouldn't be any parsing error there. I reiterate - the code works well everywhere else except on my system.

Is there even some place I can begin to look to solve this problem?

.p

Was it helpful?

Solution

If you see PHP code in the html then the interpreter is not being invoked. PHP is either not installed or mis-configured. Are you using short tags? If so, do you have the short tags option enabled in php.ini?

An easy way to test this is to through out all the variables and try a simple php script outside of Drupal. Put the following in a script and run it. This could give you some idea of what's going on.

<?php
  echo 'Hello World!';
?>

<?
  echo 'Hello World!';
?>

OTHER TIPS

If you created a node, and then used PHP code as its body, then check the input format has been set to "PHP code"; differently, the PHP code will be parsed as text, and the <?php ?> tags escaped.
This would explain why you see them.

If this is not the case, then I would check what reported by Mike B, or if files with extension .php are not considered PHP files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top