Hi,
I've got some scripts that have been working actually, but recently broke. I don't know why, but I'm assuming something on my work system must have changed. Here's what I'm trying to do: PHP page executes perl script which uses DBI to pull some data from my database, then display the results back in my php page.
I know I can do all this from within PHP easily, but I have to build this in to an existing product at work that does things a particular way. The problem I'm having is that the PHP page executes the perl script fine, but for some reason the DBI connection seems to be causing issues. If I run the perl script on the command line it works just fine. From PHP I don't get the values printed back. Here's a simple sample of what I'm doing:
PHP code snip:
<?
$DBSCRIPT = "/home/rp/bin/test.pl";
system($DBSCRIPT);
?>
Perl code (simplified):
#! /usr/bin/perl
use DBI;
use strict;
print "before DBI connection";
my $dbh = DBI->connect('dbi😛g:dbname=test', 'postgres', '');
my $query = qq
{
SELECT
param_val
FROM
conf_tbl
WHERE
param_nm = 'MY_TEST';
};
my $sth = $dbh->prepare($query);
$sth->execute();
my $my_result = $sth->fetchrow();
$sth->finish();
$dbh->disconnect();
print $my_result;
So, the script runs and gives me my result on the command line. I execute it from the PHP script and I just get the first print statement from before the db connection. I tried rewriting the perl to just execute psql queries from the command line and return those values to PHP. That worked fine, so it seems to be only related to the DBI connection. Very strange as I've done this many times before without problem. Thanks in advance.