1

I just started dabbling in PHP and the Zend 3 framwork for my new job. I wanted to train myself in the framework since this is what they use.

I have followed the tutorial from here in which you are faced with creating a module for the framework. In their example they use SQLite for the simple database actions that the task is set up for. Here in lies my problem. I have implemented the example code up until the point where I should first see all albums inserted into the database. That is when I get the error:

File: .../vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php:282

Message: Connect Error: could not find driver

Fair - I then googled and found that in my php.ini file I must uncomment the extension=pdo_sqlite line. Which I have done. I have also installed the package php7.3-sqlite package and everything, that I can find is needed for this to run.

I'm not using apache or nginx for this, I'm simply using PHP's own built-in webserver for this simple tutorial.

When I run my command: php -S me.localhost:1337 -t public public/index.php from my workspace directory I get:

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20180731/pdo_sqlite (/usr/lib/php/20180731/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/pdo_sqlite.so (/usr/lib/php/20180731/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver)) in Unknown on line 0

And:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite.so' (tried: /usr/lib/php/20180731/pdo_sqlite.so (/usr/lib/php/20180731/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name), /usr/lib/php/20180731/pdo_sqlite.so.so (/usr/lib/php/20180731/pdo_sqlite.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

I checked my filesystem and the filepath: /usr/lib/php/20180731/pdo_sqlite.so does exist.

ls -la /usr/lib/php/20180731/
total 6792
drwxr-xr-x 2 root root    4096 Mar 13 16:34 .
drwxr-xr-x 4 root root    4096 Mar 13 16:31 ..
-rw-r--r-- 1 root root   30824 Mar  7 21:31 calendar.so
-rw-r--r-- 1 root root   14440 Mar  7 21:31 ctype.so
-rw-r--r-- 1 root root   84072 Mar  7 21:31 exif.so
-rw-r--r-- 1 root root 5425264 Mar  7 21:31 fileinfo.so
-rw-r--r-- 1 root root   59496 Mar  7 21:31 ftp.so
-rw-r--r-- 1 root root   14440 Mar  7 21:31 gettext.so
-rw-r--r-- 1 root root   43112 Mar  7 21:31 iconv.so
-rw-r--r-- 1 root root   43112 Mar  7 21:31 json.so
-rw-r--r-- 1 root root  506352 Mar  7 21:31 opcache.so
-rw-r--r-- 1 root root  108648 Mar  7 21:31 pdo.so
-rw-r--r-- 1 root root   30824 Mar  7 21:31 pdo_sqlite.so
-rw-r--r-- 1 root root  268392 Mar  7 21:31 phar.so
-rw-r--r-- 1 root root   34920 Mar  7 21:31 posix.so
-rw-r--r-- 1 root root   30824 Mar  7 21:31 readline.so
-rw-r--r-- 1 root root   14440 Mar  7 21:31 shmop.so
-rw-r--r-- 1 root root   88168 Mar  7 21:31 sockets.so
-rw-r--r-- 1 root root   51304 Mar  7 21:31 sqlite3.so
-rw-r--r-- 1 root root   14440 Mar  7 21:31 sysvmsg.so
-rw-r--r-- 1 root root   10344 Mar  7 21:31 sysvsem.so
-rw-r--r-- 1 root root   14440 Mar  7 21:31 sysvshm.so
-rw-r--r-- 1 root root   18536 Mar  7 21:31 tokenizer.so

As you can see the ls -la output states that the files exist. I really don't know what to do from here. I have tried many things, even purging my php installation and installed ONLY php 7.3. Hop you can help.

double-beep
  • 5,031
  • 17
  • 33
  • 41
IncrediblePony
  • 645
  • 9
  • 31
  • 1
    Well, have you `apt-get install php-sqlite3` ? – mario Mar 13 '19 at 16:13
  • 1
    Also make sure you uncomment `extension=pdo` in your php.ini file. (And I think it might have to appear in the file before the pdo_sqlite line.) – Alex Howansky Mar 13 '19 at 16:17
  • @mario - yes :) I specifically chose to `apt install php7.3-sqlite3` @Alex-howansky - I will try this :) seems like a good idea :) – IncrediblePony Mar 14 '19 at 09:02
  • @mario - I don't get why you marked this as a duplicate? I have seen many questions asked on this subject, yes, but none of the answers given anywhere else have offered a solution that fixed my problem. Could you please unmark it again? – IncrediblePony Mar 14 '19 at 09:40
  • 1
    An unsolved problem is not the same as a question not having been asked before. Adding more variations of these question just dilutes the search results. It's not quite a programming problem anyway. (Though `ldd` might have answered it.) – mario Mar 14 '19 at 15:38
  • Fair enough - I will bow to your superior wisdom :) – IncrediblePony Mar 15 '19 at 09:25

0 Answers0