Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP: Uncaught Error: Class 'SQLite3' not found #21852

Closed
ILadis opened this issue May 11, 2020 · 6 comments · Fixed by #22019
Closed

PHP: Uncaught Error: Class 'SQLite3' not found #21852

ILadis opened this issue May 11, 2020 · 6 comments · Fixed by #22019
Labels
bug Something isn't working

Comments

@ILadis
Copy link

ILadis commented May 11, 2020

System

  • xuname: Void 4.19.118_1 armv7l Unknown uptodate rF
  • package: php-7.4.5_1, php-sqlite-7.4.5_1

Actual behavior

I'm trying to get the PHP SQLite3 extension to work on my Raspberry PI. I installed the above packages and enabled the extension in /etc/php/php.ini by uncommenting ;extension=sqlite3.

Executing php -m does not list sqlite as a PHP module.
Executing php -i does not mention any SQLite3 support.

Expected behavior

SQLite3 should work after installing php-sqlite-7.4.5_1 and enabling the extension in /etc/php/php.ini.

Steps to reproduce the behavior

Install the above packages, enable SQLite3 extension and run php -r 'new SQLite3("db");':

PHP Fatal error:  Uncaught Error: Class 'SQLite3' not found in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1
@jnbr jnbr added the bug Something isn't working label May 15, 2020
@newbluemoon
Copy link
Contributor

Just did an install on my up-to-date RPi armv7l-musl and aarch64-musl. Running the command above succeeded. No error reported, an empty 'db' was created and php -m does report sqlite support.

On armv7l, however, it failed as above. I don’t have other systems to test handy right now.

It seems the cross built php does work, at least for musl systems. So what’s different on glibc systems?

@ILadis
Copy link
Author

ILadis commented May 16, 2020

I tried some other extensions and these did not work as well. So it does not seem to be a SQLite exclusive issue.

I also tried compiling php myself on the RPi by cloning this repository and running ./xbps-src pkg php. The package build without any errors and after installing it, everything worked as expected.

@newbluemoon
Copy link
Contributor

I think I found the solution, please test #22019 if it works for you.

@ILadis
Copy link
Author

ILadis commented May 18, 2020

I installed the updated version php-7.4.6_2 on my RPi and can confirm it's working now. Thanks for fixing!

@prog98
Copy link

prog98 commented Jul 11, 2022

if you use xampp or ... first close xampp or ...
go to this directori : xampp > php > php.ini ( find this file php.ini on php folder)
and open php.ini file with notepad
and search SQLite3
and remove ; this line ;extension=sqlite3
so finaly be extension=sqlite3
and save file
end open xampp

sorry my cant good speak english i hope i can help you.

@JimChristop
Copy link

if you use xampp or ... first close xampp or ... go to this directori : xampp > php > php.ini ( find this file php.ini on php folder) and open php.ini file with notepad and search SQLite3 and remove ; this line ;extension=sqlite3 so finaly be extension=sqlite3 and save file end open xampp

sorry my cant good speak english i hope i can help you.

It worked, a thumbs up from me, good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants