2

I tested a simple Php program using Sqlite3 instead of mySQL on my own computer and it works fine. What the program does is simple insert of record into a certain table. Now, when I try to do that on a remote web server running on Linux (CentOS) with Sqlite3 enabled it does not work.

I thought at first it was simply a file permission issue since my Sqlite file had an initial permissions of 644 so I changed it to 646 then 767 both to no avail.

The Php version by the way on web server is a little bit dated, namely, Php 5.1.6 but on my local PC it is 5.5.11.

This is the sample code that I ran on both servers.

$db = new PDO('sqlite:test.db');

$lastname = "Doe";
$firstname = "John";
$sql = "INSERT INTO people (Lastname,Firstname) VALUES (:lastname,:firstname)";

$q = $db->prepare($sql);
$q->execute(array(':lastname'=>$lastname,
                  ':firstname'=>$firstname));

I tried a simple query on a sqlite3 database on the webserver by the way and it works.

So, could this be a simple Php version issue or some elevated rights that I need on Linux?

I cannot by the way change the php.ini so forgo that possible direction for the moment. And I don't have any choice of having a new Php version on that server since I use it for free.

I tried to asked this same question SO but to no avail so I am trying my luck here.

  • Try getting an exception on error with $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); – meuh Nov 1 '15 at 10:12
  • @meuh Thanks I'll try this one and I'll get back to you if I have something. GOD bless. – Edper Nov 2 '15 at 6:47
  • @meuh I tested and it has the same unfavorable result :-( Thanks for your help by the way. – Edper Nov 7 '15 at 10:34
  • but did it log any error messages in a file somewhere (/var/log/...)? – meuh Nov 7 '15 at 10:47
  • Honestly @meuh I have no permission to view those files. – Edper Nov 7 '15 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.