PDO code that works on my localhost does not work on your lamp stack on Lightsail

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bndiagnostic ID: 2bbe297f-4649-af6a-0de0-527b0b0b93c0

bndiagnostic output:

? Apache: Found possible issues

bndiagnostic failure reason: The suggested guides are not related with my issue

As a test I ran the following code recommended by php.net to get the number of records in my table. This code and other PDO code run on my local host but not on your lamp stack. Some PDO code will run on your stack while other code does not. All the PDO code in question will run on my localhost. This is the link to the recommended COUNT(*) snippit. The function call is below the link.


public function getFacultyTotal(){
// Total number of records without filtering
$sql = "SELECT COUNT(*) FROM Table Name ";
$results = $this->db->query($sql);
$TotalCount = $results->fetchColumn();
return $TotalCount;

I’m using the Ubuntu LAMP stack on Lightsail.

What error do you get? Maybe it’s a extension/module that is not enabled what is causing the problem. You can take a look at the enabled modules in the /opt/bitnami/php/etc/php.ini file or using the php -m command

Thanks, I spent too much time and it really wasn’t worth the effort to trouble shoot an out-of-the-box and unmodified image and instance. I deleted the instance and decided not to go with Lightsail.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.