On my Ubuntu 15.04 machine I'm trying to load an sqlite-extension within my php code using the following snippet:
<?php #content of test.php
$db = new SQLite3(':memory:');
$db->query("SELECT load_extension('/dir/to/sqlite/extension/libsqlitefunctions.so');");
$resultSet = $db->query("SELECT asin(1) as a;");
But I always get the following error message:
PHP Warning: SQLite3::query(): not authorized in /my/dir/test.php on line 3
PHP Stack trace:
PHP 1. {main}() /my/dir/test.php:0
PHP 2. SQLite3->query() /my/dir/test.php:3
PHP Warning: SQLite3::query(): Unable to prepare statement: 1, no such function: asin in /my/dir/test.php on line 4
PHP Stack trace:
PHP 1. {main}() /my/dir/test.php:0
PHP 2. SQLite3->query() /my/dir/test.php:4
Loading the same extension from the command line works fine:
$sqlite3
SQLite version 3.8.7.4 2014-12-09 01:34:36
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> SELECT load_extension('/dir/to/sqlite/extension/libsqlitefunctions.so');
sqlite> SELECT ASIN(1) as a;
1.5707963267949
See this question on how to get this to work.
Can anyone help me get this working from within php on Ubuntu 15.04.
Thanx a lot in advance.
Cheers,
D.
PS: as I use this when running phpunit tests with sqlite as database, I run it on the command line and not in a web-server context.
I did not manage to get it working in Ubuntu 15.04. Upgrading to Ubuntu 16.04 solved the problem.
PS: the default php version on Ubuntu 16.04 is 7.0.x. You might need to install php5.6 if you want to use it. See http://www.lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu
Related
When redeploying or newly deploying a Node with PHP 7.3 (nginx 1.14.2) i get the following error when trying to create a zip-archive in php using zip.so
php: symbol lookup error: /usr/lib64/php/modules/zip.so: undefined symbol: zip_file_add
(this is from calling the $zip->addFile() function.
This is a problem across jelastic hosting-providers (tested on two different hosting-providers)
I am a beginner to mongoDB, I want to learn mongoDB. So I read few tutorials and tried to configure mongoDB in my local machine, for that I have downloaded mondoDB's php_mongo.dll file and placed that on my local machine into the path "php/ext/php_mongo.dll" and after that I added this code "extension = php_mongo.dll" to php.ini file, after that I am trying run my XAMPP server but immediately it is showing the below error :
C:xampp\php\ext\php_mongo.dll is either not designed to run on Windows
or it contains an error. Try installing the program again using the
original installation media or contact your system administrator or
the software vendor for support.
after that somehow Apache server has been started And when I try to run the application on browser by URL http://localhost/mongoapp/index.php then it is throwing the following error:
Fatal error: Uncaught Error: Class 'MongoClient' not found in C:\xampp\htdocs\mongoapp\index.php:3 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mongoapp\index.php on line 3
File: index.php
// connect to mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// select a database
$db = $m->mydb;
echo "Database mydb selected";
My php version is "PHP Version 7.0.8". hope someone helps, Thanks in advance.
Check your phpinfo if mongodb is loaded.
Download mongodb from "https://www.mongodb.com/download-center?jmp=nav#community" and install.
Check your architecture in phpinfo match with mongodb.
I compiled the library couchbase for php7: https://github.com/couchbase/php-couchbase/tree/php7.
When I try to make an operation(upsert) I have an error.
$cluster = new CouchbaseCluster('127.0.0.1', "user", "password");
$db = $cluster->openBucket('default');
$db->upsert('testdoc', ['name' =>'Frank']);
PHP Warning: Invalid callback , no array or string given in Unknown on line 0
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. CouchbaseBucket->upsert() php shell code:1
PHP 3. _CouchbaseBucket->upsert() [CouchbaseNative]/CouchbaseBucket.class.php:134
PHP Warning: Invalid callback , no array or string given in Unknown on line 0
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. CouchbaseBucket->upsert() php shell code:1
PHP 3. _CouchbaseBucket->upsert() [CouchbaseNative]/CouchbaseBucket.class.php:134
If I try
$db->upsert('testdoc', 'Frank');
or
$db->upsert('testdoc', json_encode(['key' => 'Frank']) );
Generate the same warning and insert in couchbase for that key(testdoc) an empty string. How can fix this error?
That branch is still under development and is effectively a port of the extension, since the APIs for extension developers has changed so much. We have it partially done, working on some platforms, but with enough known issues that it's not released yet. It'd be helpful to let us know what OS/architecture and specific PHP version you're using so I can verify our test coverage says the same thing-- then it's just a known issue.
I'm hopelessly stuck on this: I'm trying to connect to MS SQL Server 2008 R2 with PHP, but I can't seem to get the configuration right.
Windows Server 2012 Standard
MS SQL Server 2008 R2
PHP:
Version: 5.4.31
Branch: HEAD
Build: C:\php-sdk\php54dev\vc9\x86\obj\Release_TS
All I need is to call a PHP script from command line and save result to database. But I get following error:
C:\ankety>php uctenka.php 1012814411
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54 in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54_ts.dll in Unknown on line 0
PHP Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Now, of course there is correct version of php_sqlsrv_54_ts.dll in correct folder (C:\php-5.4.31-ts\ext\). In php.ini I changed:
extension_dir = "C:\php-5.4.31-ts\ext\"
extension=php_sqlsrv_54_ts.dll
When I run the script it also says that MSVCP100.dll is missing on a computer, but it is in fact there - in C:\Windows\System32 and I also tried C:\php-5.4.31-ts\ext\ but without luck.
In phpinfo() there isn't loaded sqlsrv part.
I don't know where I could possibly went wrong, I searched this problem but none of those solutions worked. Hope someone has an idea how to fix this.
For those, who don't want to waste time as myself - try restarting the IIS server :-)
I have installed Codeception following the guide on their website. Everything went okay, so I created my first basic test.
<?php
$I = new WebGuy($scenario);
$I->wantTo('ensure that frontpage works');
$I->amOnPage('/');
$I->see('Homepage');
Trying to execute this and it gave Stack trace errors so I dumped them in result.txt page.
Codeception PHP Testing Framework v1.6.2
Powered by PHPUnit 3.7.19 by Sebastian Bergmann.
Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in phar://C:/wamp/www/dugun/codecept.phar/src/Codeception/Configuration.php on line 175
Notice: Use of undefined constant CURLOPT_CERTINFO - assumed 'CURLOPT_CERTINFO' in phar://C:/wamp/www/dugun/codecept.phar/src/Codeception/Configuration.php on line 175
Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in phar://C:/wamp/www/dugun/codecept.phar/src/Codeception/Module/PhpBrowser.php on line 78
Fatal error: Call to undefined function Guzzle\Http\Curl\curl_version() in phar://C:/wamp/www/dugun/codecept.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlVersion.php on line 47
Using WAMP on Windows 7. PHP ver 5.4.3. Apache ver 2.4.2. CURL is enabled in settings. Tried restarting several times, no luck.
Anyone knows how to solve this issue, what may be wrong?
Update
The problem was related to curl.dll. Downloading a fresh one from this topic (PHP cURL not working - WAMP on Windows 7 64 bit) solved the issue.
Based on the errors I'd guess that CURL is missing even though it's enabled, try running a phpinfo() to see if the extension is running.
From the PHP site:
"Note: Note to Win32 Users
In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH. You don't need libcurl.dll from the cURL site."
http://www.php.net/manual/en/curl.installation.php