Raw php displayed in the browser

I’m trying to install a popcard script. There’s not of installation instructions but it says to navigate to popcard.php. When I do I get just raw php displayed in the browser.

What causes this? Is it a setting in Apache?

Thanks

It appears that Apache isn’t configured to process PHP scripts. As a result, it is just sending the PHP code as text to the browser instead of executing it.

http://www.php-mysql-tutorial.com/wikis/php-tutorial/installing-php-and-mysql.aspx

Apache doesn’t know that you just install PHP. We need to tell Apache about PHP and where to find it.

I am running Wamp on my local machine. I have a php shopping cart working great. So i have php installed, I just wonder if there is something that needed turned on.

Here’s an example of the frist few lines I get in my broswer:


[COLOR="#FF0000"]_tpl = $objTPL[/COLOR]; // Instantiate the environment data object $this->_dat = $objDAT; $this->allowed_form_data[] = "category"; $this->allowed_form_data[] = "imagefile"; $this-

See it starts at _tpl = $objTPL

Here’s the php page it is accessing:


<?

/*
*
*	PopCard 3.0
*	Copyright 2002 - 2008 Jamie Longstaff
*
*/

ini_set('display_errors','on');
error_reporting(~E_NOTICE);

// This constant tells included PHP scripts it's safe to run code
define("POPCARD","ON");

// Set a default timezone - not really important but required for PHP 5 strict mode
if (function_exists('date_default_timezone_set')) { date_default_timezone_set("Europe/London"); }

// Load form data processor
include ("resources/includes/class.envData.php");

// Load template engine
include ("resources/includes/class.templateEngine.php");

// Instantiate the environment data object
$objDAT = new EnvData();
		
// Load the configuration file
include("resources/includes/popcard.config.php");

// Load required localisation file
include (POPC_BASE_PATH."resources/localisations/".POPC_LOCALISATION.".php");

// Move the localised strings into the global scope
$GLOBALS['_STR_'] = $lang;

// Free up a bit of working memory
unset($lang);

// Instantiate the template engine object
$objTPL = new templateEngine();

// Instantiate the object
$objPopCard = new Pixaria_PopCard();

/*
*
*/
class Pixaria_PopCard {
	
	var $remote_image = false;
	var $image_path;
	
	/*
	*
	*/
	function Pixaria_PopCard () {
		
		global $cfg, $objTPL, $objDAT;
		
		// Instantiate the template engine object
		$this->[COLOR="#FF0000"]_tpl = $objTPL;[/COLOR]
		
		// Instantiate the environment data object
		$this->_dat = $objDAT;

Notice the part I have in red in the above code. It seems when it gets to this line something goes wrong. I’ve tried many things but I figure it something simple like something isn’t turned on. :slight_smile: Because it seems when it gets to tpl it stops working.

Thanks

While debugging try the following:



ini_set('display_errors','on');
# error_reporting(~E_NOTICE);
error_reporting(-1); # display everything
...
...
...
function Pixaria_PopCard () {
		
		global $cfg, $objTPL, $objDAT;
		
		// Instantiate the template engine object
		$this->_tpl = $objTPL;

echo __LINE__, 'break to see if this is displayed correctly'; die
		
		// Instantiate the environment data object
		$this->_dat = $objDAT;


Try changing the opening php tag from <? to <?php Sometimes servers will be set up to not allow the use of short tags (if you have access to the server’s php.ini file then you can set it to allow short tags.

John,

Didn’t know where to put your code. But SpacePhoenix adding the <?php done it!

Thanks