I'm unable to run sqlite functions in php - php

When I run the following code
<?php
echo sqlite_libversion();
echo "<br>";
echo phpversion();
?>
I get this error
Fatal error: Call to undefined function sqlite_libversion()
I was brought to this page PHP isn't working with SQLite
Like the person who asked a similar question I typed php -m and the modules running are
bcmath bz2 calendar Core ctype date dba dom ereg exif fileinfo filter ftp gd gettext hash ice iconv json libxml mbstring mcrypt mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib
From the advice given I put these in the dynamic extension section in php.ini
extension=pdo_sqlite.so
extension=sqlite.so
I restarted apache2 and unfortunately I am still getting the same error
And I confirmed I have
lighttpd
sqlite
php5-sqlite installed and dependencies
I am running,
raspbian,
Apache/2.2.22 (Debian),
php5.4.4,
sqlite3,
SQLite Library 3.7.13,
SQLite3 module version 0.7,
I'm not sure where I'm going wrong can anyone help?

pdo + sqlite = use the PDO functions: http://php.net/manual/en/intro.pdo.php
Simply create a PDO object with the sqlite: protocol and off you go. Don't use the sqlite_... functions, they're something completely different.

Related

Call to undefined function pcntl_wifsignaled()

I'm attempting to use the import functionality in mediawiki 1.27.0, but I'm getting the error message:
Call to undefined function pcntl_wifsignaled() in extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 645
I'm running PHP version 5.6.30 on Ubuntu 14.0.4 with Apache2.4.7. I've followed various bits on information to install pcntl module and to the best of my knowledge the module is operational. phpinfo reports that pcntl is enabled. I have also commented out the line in php.ini regarding disabled_functions. Below are some reports from various bits of Ubuntu to explain the current config.
Any ideas on how to fix this?
Installed php modules:
$ php -me
[PHP Modules]
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
XCache
XCache Cacher
XCache Coverager
XCache Optimizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
Disabled PHP functions:
$ php -i | grep disable_functions
disable_functions => no value => no value

How Enable MySQLi Extension on PHP7 (LAMP / CPANEL)?

My server upgraded to PHP7 and now I am getting an error which reads "Your PHP installation appears to be missing the MySQL extension which is required by WordPress."
I have tried adding extension=php_mysqli.so to my PHP INI but that doesn't seem to help. I am on a LAMP with CentOS and Apache 2.4 with MariaDB 10.0... All was working before the update. \
php -m shows:
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
enchant
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
ionCube Loader
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SourceGuardian
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend Guard Loader
Zend OPcache
zip
zlib
[Zend Modules]
Zend Guard Loader
Zend OPcache
the ionCube PHP Loader
You can not solve your issue by adding MySQLi to php.ini, here you have install real mysqli extension on server that can be done Easyapache by enabling MySQL Improved extension , and it can be done by root user only. if you have than check below link.
Check full here: http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=650

The mysql driver is not currently installed, but pdo_mysql.so/mysqli.so is loaded

I installed PHP 7 in a docker container as fcgi. My php.ini looks like this:
extension=/usr/lib/php/20151012/curl.so
extension=/usr/lib/php/20151012/gd.so
extension=/usr/lib/php/20151012/igbinary.so
extension=/usr/lib/php/20151012/intl.so
extension=/usr/lib/php/20151012/json.so
extension=/usr/lib/php/20151012/mcrypt.so
extension=/usr/lib/php/20151012/memcached.so
extension=/usr/lib/php/20151012/mysqli.so
extension=/usr/lib/php/20151012/opcache.so
extension=/usr/lib/php/20151012/pdo_mysql.so
extension=/usr/lib/php/20151012/pdo_sqlite.so
extension=/usr/lib/php/20151012/readline.so
extension=/usr/lib/php/20151012/sqlite3.so
extension=/usr/lib/php/20151012/xdebug.so
extension=/usr/lib/php/20151012/xsl.so
If I run php -m I get the following output:
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
igbinary
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
xsl
zlib
[Zend Modules]
You see mysqli and pdo_mysql are definitely loaded. But if I run my php application it says: The mysql driver is not currently installed.
I can connect to mysql on command line successfully. What is wrong here?
mysql extenstion was deprecated and is totally removed in php7 so do not be surprised. Just quickly change to mysqli or pdo

Unable to find Mongo class in Connection.php Symfony 2

This is quite an often occurring error, but since I tried a lot of stuff to fix it, I'm kind of getting out of the ideas.
I have a symfony 2 with mongo DB. I have set up my composer.json file to download doctrine-mongo and doctrine-mongo-bundle,
"doctrine/mongodb-odm": "1.0.*#beta",
"doctrine/mongodb-odm-bundle": "3.0.*#beta",
In order to download this 2 modules, I needed to have mongo extension installed into PHP. I have both of them, mongo and mongodb, installed via brew
brew install php56-mongo
brew install php56-mongodb
I believe I have mongo extensions allowed as well, since when I write
php -m
I get this results
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mhash
mongo
mongodb
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
and you can see mongo there.
Also php -i returns info that mongo is enabled.
But when I'm trying to hit app_dev.php file in my project, I still get this:
ClassNotFoundException in Connection.php line 284: Attempted to load
class "Mongo" from the global namespace. Did you forget a "use"
statement?
I'm using a Mac OS X and have chmod 777 on
app/logs
app/cache
web/
recursively.
Do you have any idea what can trigger this ?
Thank you.
PHP Cli and fpm/apache doesn't use the same configuration, which means your php -m may be not accurate.
What you can do is call http://php.net/manual/en/function.extension-loaded.php inside your php entry point file on your server and make sure its loaded. Restarting the processes can help as well.

DOMPDF 0.5.1 - new server environment breaks PDF output formatting

I'm using DOMPDF to generate PDFs inside of a symfony application.
On my current production server, it works great. I was tasked with moving
it to a new server. I checked out the code on the new server, and while it does generate a PDF still, most of the formatting is broken.
Here's an example of what happens:
http://geoffreymaddock.com/work/project-dompdf-working.jpg
http://geoffreymaddock.com/work/project-dompdf-broken.jpg
Some of the formatting works on the new server, some does not.
Both servers have identical code. They both run php 5.1.6.
The only difference that I can really see is that there are extra php modules installed on the new server. I'm not sure what could be causing this issue though.
Working server modules:
[PHP Modules]
bz2
calendar
ctype
curl
date
dom
exif
ftp
gd
gettext
gmp
hash
iconv
ldap
libxml
mime_magic
mssql
mysql
mysqli
oci8
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
posix
pspell
Reflection
session
shmop
SimpleXML
snmp
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zlib
New server modules:
[PHP Modules]
apc
bcmath
bz2
calendar
ctype
curl
date
dba
dom
exif
ftp
gd
gettext
gmp
hash
iconv
imap
ldap
libxml
mbstring
mime_magic
mssql
mysql
mysqli
ncurses
oci8
odbc
openssl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_OCI
PDO_ODBC
pdo_sqlite
phpcups
posix
pspell
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
SQLite
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib
Anyone run into this before, or know of specific conflicts?
I figured out the problem.
dompdf_font_family_cache
Contained static paths for font locations on the original server which broke
on the new server. Took a long time to figure that out, but glad I did.

Categories