Puzzled by PHP installation.
Posted by: bobbyman (---.static.tierzero.net)
Date: August 30, 2007 02:58AM

Hello. I installed WAMP 5 v1.7.2, a first time install on my Windows XP SP2 computer (Toshiba Satellite laptop). The install went okay and without error, very smooth. Apache loads. The index.php WAMP 5 screen comes up perfectly, a test phpinfo.php file brings up my PHP details, PHPmyAdmin opens MySQL and I can create/edit databases, as well as sqlitemanager running okay, and a few test HTML pages render just fine (Firefox and IE being my browsers).

So far so good. However, when I attempt to run a PHP program other than noted above, I get browser screen filled with lots of text or just some PHP. For example, I downloaded a few small and simple PHP scripts from Hotscripts, their READMEs indicating a similar system as mine (Windows, PHP version, etc.). The programs/scripts run fine on my hosted web site, but not via my WAMP installation either locally or publicly. Their CSS and HTML renders fine, just nothing for the PHP.

One script is a very basic few lines for a countdown (how many days until a given date, etc.). When I run it, I just get on browser screen:
---------------------------------------
$cdtime seconds
$cdminutes minutes
$cdhours hours
$cddays days
$cdmonths months
$cdyears years "; ?>

created by urQuiz a Geekndiva company
---------------------------------------

Thus the HTML works (breaking each line) but the PHP does not as those $variables should of course display their content instead. With some PHP scripts it just brings up a browser screen of jumbled code. For example, a snip from a small Wiki program when run:
---------------------------------------
username==""winking smiley die("$__INSTRUCTIONS"winking smiley; //This is the main 'servlet' like file //It controls all branches and forks the code to different files if (isset($_GET['saveArticle']) && isset($_SESSION['username'])) { //Save the article, and reload with the new ID $cCon = new controller(); $articleId = $_GET['saveArticle']; if (!ereg("^[0-9]+$", $articleId)) { $articleId=""; } $articleTitle = $_POST['saveTitle']; $articleHTML = $_POST['saveHTML']; //Loop through articleHTML and replace ant text of the form : // http://[title] //With : // index.php?viewArticle=$tmpId while (strpos($articleHTML, "[!=""" rel="nofollow">%5B"winking smiley!=""]winking smiley { $start = strpos($articleHTML, "[%5B"]winking smiley + 10; $end = strPos($articleHTML, "%5D", $start); $newTitle = substr($articleHTML, $start, $end-$start); $oldTitle = $newTitle; $newTitle = str_replace("%20", " ", $newTitle); $newHTML = ""
---------------------------------------
And so forth.

Any thoughts on what's going on?

TIA,
Bob


Options: ReplyQuote
Re: Puzzled by PHP installation.
Posted by: bobbyman (---.static.tierzero.net)
Date: August 30, 2007 03:35AM

Researching the forum further, I found a post by CyberSpatium that looks like is solved the problem. The PHP scripts should contain full PHP tags, thus:

<?php

and not just

<?

This correction to what I was trying to run did indeed do the trick as those programs now run okay and they all had simple the <? tag instead of <?php

Anyone know if this can be a PHP and/or Apache config setting? I downloaded a somewhat larger collection, a PHP-written discussion board, and it has tons of files all of which start with or contain within the body the shorter <? tag. I can do search/replacing of course to change every such tag but was curious if a configuration setting exists to permit just the <? tag.

Thank you CyberSpatium for your post on the tag issue. smiling smiley

Bob

Options: ReplyQuote


Sorry, only registered users may post in this forum.