0

I am moving some php/adodb pages from my Ubuntu 12 to my Ubuntu 14 VM. I believe I installed all the packages,

apt-get -y install apache2 php5 libapache2-mod-php5
apt-get -y install postgresql php5-pgsql php5-adodb libphp-adodb

but I am getting strange results. My index.php code starts like this.

require "./main.inc";
require "./util.php";

$conn = ADONewConnection($dbtype);
$conn->PConnect($dbhost, $dbuser, $dbpass, $dbname);

$step=1;

if (isset($_POST["submit"]))
{
        $step=2;
}

if ($step == 2)    #verify logon
{

When I open the browser and look at the page, I see this code partially being echoed. The first line in the browser shows this, plus more.

PConnect($dbhost, $dbuser, $dbpass, $dbname); $step=1; if (isset($_POST["submit"])) { $step=2; } if ($step == 2) #verify logon { 

The php seems to be fine as the html parts are displayed properly, but the adodb calls are just getting printed instead of run. It seems whatever code I have after the 'ADONewConnection' line just gets printed out.

I checked phpinfo and the module for adodb is listed. I'm just not sure if I missed a setup step somewhere.

Thanks.

Greg
  • 473
  • 1
  • 4
  • 13
  • Actually, to be more specific, everything after the first '$conn->' get printed. – Greg Jul 09 '15 at 04:04
  • 2
    So you are mixing PHP and HTML code, can you post more code? This seems to be a very shortened part. And also, is your file extension `.php`? Are you enclosing the PHP code between ``? – Eric Martinez Jul 09 '15 at 04:07
  • OK, this is weird. It doesn't seem to be adodb related. The first time it gets to a '->', it prints the code. @EricMartinez, this code is correct. I just moved the files from a working VM to this one. I didn't make any code changes. – Greg Jul 09 '15 at 04:11
  • Because that's the first place where the tag is closed. Check the source on the browser and you'll see all the code. Server not running it as PHP at all. – Sami Kuhmonen Jul 09 '15 at 04:18
  • 1
    Check this thread and see if those steps help you http://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-i-can-see-it-on-source-code-of-page – Eric Martinez Jul 09 '15 at 04:18

1 Answers1

0

Thanks to @EricMartinez for pointing to the other post, specifically point #5. It was the following line in the php.ini that needed to be turned on.

short_open_tag = On

I should probably update all the old code to use the long tag, but enabling this got my pages back up.

Thanks.

Greg
  • 473
  • 1
  • 4
  • 13