Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sqlite2 vs sqlite3

1,862 views
Skip to first unread message

john6630

unread,
Aug 28, 2008, 10:36:48 AM8/28/08
to
I asked this on another thread but an idiot responded with some
malware...so I am starting a new thread, hoping the other dies off
quickly without damage to others. I am still looking for an answer to
this issue...

I am trying to get PDO for sqlite to work on my localhost system. I
have modified the PHP5.ini file as shown below and run the following
PHP script. As stated below, it reports the mssql, mysql and sqlite2
drivers but then gives a "could not find driver" exception. Any help
is greatly appreciated. Also, I am concerned if PDO for sqlite is
widely supported by hosting companies, any input or opinions on that?

<?php
foreach(PDO::getAvailableDrivers() as $driver)
{
echo $driver.'<br />';
}
try {
/*** connect to SQLite database ***/
$dbh = new PDO("sqlite:./johns.db");
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>

Reports available drivers as mssql, mysql and sqlite2 (strange it is
sqlite2 when PDO is sqlite3 from what I understand)

Then throws the exception "could not find driver"

PHP.ini settings are:
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_perl.dll
extension=php_pgsql.dll
;extension=php_phpdoc.dll
;extension=php_pop3.dll
;extension=php_printer.dll
;extension=php_pspell.dll
;extension=php_radius.dll
;extension=php_runkit.dll
;extension=php_sdo.dll
;extension=php_sdo_das_xml.dll
;extension=php_shmop.dll
;extension=php_smtp.dll
;extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll

and php_pdo_sqlite.dll is found in the /php/ext/ directory.

TIA,
John

purcaholic

unread,
Aug 28, 2008, 1:10:06 PM8/28/08
to
I have tried this on a Windows OS with PHP 5.2.5 and it works.

Either your php_pdo_sqlite.dll extension or PHP Version hast a bug or
you have changed the wrong php.ini file.
Sometimes there are multiple php.ini files one in /php/ and one in
system dir.

Regards
purcaholic

john6630

unread,
Aug 28, 2008, 2:31:30 PM8/28/08
to

I only find php.ini and php5.ini and I changed both of them. I also
downloaded php_pdo_sqlite.dll and replaced the one in my /ext/
directory.

What I have found is that if I change my code from

/*** connect to SQLite database ***/

$dbh = new PDO("sqlite2:./johns.db");

It does connect via PDO but again using sqlite2. So I am at a loss.
Seems like something wrong in my PHP or DLL. But I do not know about
rebuilding such things.

Any other suggestions?

TIA,
John

JC

unread,
Aug 29, 2008, 5:57:37 PM8/29/08
to
"john6630" <john...@hotmail.com> wrote...
: I only find php.ini and php5.ini and I changed both of them. I also

: downloaded php_pdo_sqlite.dll and replaced the one in my /ext/
: directory.
:
: What I have found is that if I change my code from
:
: /*** connect to SQLite database ***/
: $dbh = new PDO("sqlite2:./johns.db");
:
: It does connect via PDO but again using sqlite2. So I am at a loss.
: Seems like something wrong in my PHP or DLL. But I do not know about
: rebuilding such things.
:
: Any other suggestions?

Try
$dbh = new PDO("sqlite3:./johns.db");

I believe sqlite: defaults to version 2. The other thing I'll mention
is that php5.ini are the suggested settings for PHP version 5. Sounds
like you might have a version of XAMPP installed which I think installs
two versions of PHP as well as Apache, Perl, MySQL, SQLite, et al.

Apache Version 2 (not sure if a specific subversion is required) supports
a PHPIniDir directive, see

http://www.php.net/manual/en/install.windows.apache2.php

for documentation. They show PHPIniDir getting configured inside the
httpd.conf file as follows, you will need to change the folder to
point to the appropriate folder in which your php.ini file resides:

PHPIniDir "C:/php"

NOTE, it does NOT provide a way to change the name of PHP.INI, so
I can not help in regards as how to configure Apache to use BOTH the
PHP4 and PHP5. My understanding has always been that ONE and ONLY ONE
version of PHP gets installed, but then again I've never tried to run
two different versions at the same time. I just do not see a way to
configure the:

AddType application/x-httpd-php .php

without recompiling and changing that Type string.

The php_pdo_sqlite.dll is the file representing version 3 methods for
accessing, creating and updating SQLite version 3 data files. And then
php_sqlite.dll represents the file for accessing SQLite Version 2 of
the data files. I started a webpage last year, but never finished it,
detailing how to create and access the different files.

http://www.microcosmotalk.com/tech/windows/php/sqlite/

The details are accurate but incomplete. If it's helpful, let me know,
if something needs to get updated or is confusing, please let me know
and I will update it.

I'll watch this thread for any and all replies as I need to complete
the information there.

Can you offer some more information about your Apache/PHP install?

--
Jim Carlock
You Have More Than Five Senses
http://www.associatedcontent.com/article/381163/more_than_five_senses.html


john6630

unread,
Aug 29, 2008, 11:43:30 PM8/29/08
to
On Aug 29, 2:57 pm, "JC" <jcarl...@127.0.0.1> wrote:
> "john6630" <john6...@hotmail.com> wrote...
> You Have More Than Five Senseshttp://www.associatedcontent.com/article/381163/more_than_five_senses...

Hi Jim,
Thank you for your help. I will need to research all you presented,
but here is a quick response to your question about versions.
According to the XAMP readme file:

###### ApacheFriends XAMPP (basic package) version 1.6.6a ######

Apache 2.2.8
MySQL 5.0.51a
PHP 5.2.5 + PHP 4.4.8 + PEAR
PHP-Switch win32 1.0 (please use the "php-switch.bat")
XAMPP Control Version 2.5 from www.nat32.com
XAMPP Security 1.0
SQLite 2.8.15
OpenSSL 0.9.8g
phpMyAdmin 2.11.4
ADOdb 4.96
Mercury Mail Transport System v4.52
FileZilla FTP Server 0.9.25
Webalizer 2.01-10
Zend Optimizer 3.3.0a
eAccelerator 0.9.5.2 for PHP 5.2.5 (comment out in the php.ini)

Also, I tried running the script with

$dbh = new PDO("sqlite3:./johns.db");

But that again fails.

Thanks for all the help,
John

john6630

unread,
Aug 29, 2008, 11:53:46 PM8/29/08
to
On Aug 29, 2:57 pm, "JC" <jcarl...@127.0.0.1> wrote:
> "john6630" <john6...@hotmail.com> wrote...
> You Have More Than Five Senseshttp://www.associatedcontent.com/article/381163/more_than_five_senses...

I found the answer!!! From the XAMP website FAQ
http://www.apachefriends.org/en/xampp-windows.html


* Question 6: Where can I change the configuration?
You adjust XAMPP settings with plain-text configuration files. The
following files exist:

* Apache basic configuration: .\xampp\apache\conf\httpd.conf
* Apache SSL: .\xampp\apache\conf\ssl.conf
* Apache Perl (only addon): .\xampp\apache\conf\perl.conf
* Apache Tomcat (only addon): .\xampp\apache\conf\java.conf
* Apache Python (only addon): .\xampp\apache\conf\python.conf
* PHP: .\xampp\apache\bin\php.ini
(with the apache actually running php version)
* MySQL: .\xampp\mysql\bin\my.cnf
* phpMyAdmin: .\xampp\phpMyAdmin\config.inc.php
* FileZilla FTP: .\xampp\FileZillaFTP\FileZilla Server.xml
* Mercury Mail basic configuration: .\xampp\MercuryMail
\MERCURY.INI
* Sendmail: .\xampp\sendmail\sendmail.ini

I suddenly realized I was changing the php.ini file in the EXT
directory not the ./xampp/apache/bin/ directory!! Changed it by
uncommenting the php_pdo_sqlite extension and it worked great. So as
purcaholic said, I was changing the wrong php.ini file! I should have
went to the XAMPP site to begin with...live and learn. Thanks for
everyone's help.

John

shraddha...@gmail.com

unread,
Mar 20, 2014, 3:42:19 AM3/20/14
to
I am using map guide server for gis application in which php is installed and trying to use pdo but having the same problem and it's not working. Also I have checked the apache httpd.config it gives same path.Any help will be apreciated

shraddha...@gmail.com

unread,
Mar 20, 2014, 4:31:09 AM3/20/14
to
> I am using mapguide server for gis application in which php is installed and trying to use pdo but having the same problem and it's not working and having eception 'Driver not found'. Also I have checked the apache httpd.config it gives same path.Any help will be apreciated.

Jerry Stuckle

unread,
Mar 20, 2014, 8:49:43 AM3/20/14
to
On 3/20/2014 3:42 AM, shraddha...@gmail.com wrote:

>
> I am using map guide server for gis application in which php is installed and trying to use pdo but having the same problem and it's not working. Also I have checked the apache httpd.config it gives same path.Any help will be apreciated
>

The same problem as someone 5 1/2 years ago? If so, did you fix your
php.ini file like the OP did?

Otherwise I suggest you start a new thread, describing exactly what
you're doing, the expected results and what you're actually getting.

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================

shraddha...@gmail.com

unread,
Mar 21, 2014, 8:01:14 AM3/21/14
to
Thanks for your reply. I am using mapguide server where in bundle configuration apache and php gets install. php has old version. I don't know how to update it.
Is their any way to convert sqlite3 to sqlite2
Message has been deleted

Jerry Stuckle

unread,
Mar 21, 2014, 9:25:34 AM3/21/14
to
On 3/21/2014 8:01 AM, shraddha...@gmail.com wrote:
> On Thursday, March 20, 2014 6:19:43 PM UTC+5:30, Jerry Stuckle wrote:
>> On 3/20/2014 3:42 AM, shraddha...@gmail.com wrote:
>>
>>
>>
>>>
>>
>>> I am using map guide server for gis application in which php is installed and trying to use pdo but having the same problem and it's not working. Also I have checked the apache httpd.config it gives same path.Any help will be apreciated
>>
>>>
>>
>>
>>
>> The same problem as someone 5 1/2 years ago? If so, did you fix your
>>
>> php.ini file like the OP did?
>>
>>
>>
>> Otherwise I suggest you start a new thread, describing exactly what
>>
>> you're doing, the expected results and what you're actually getting.
>>
>>
>
> Thanks for your reply. I am using mapguide server where in bundle configuration apache and php gets install. php has old version. I don't know how to update it.
> Is their any way to convert sqlite3 to sqlite2
>

I agree with Michael. If your PHP is that old, you need to update it.
PHP 4.x hasn't been supported for a several years now, and there are no
fixes (even security fixes) being issued. And the longer you use an old
version of PHP, the more problems you will have with software which
doesn't run under it.

Michael has good advice; you'll be much better off in the long run if
you follow it.
0 new messages