php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81534 Math Functions are not working on SQLITE connection.
Submitted: 2021-10-18 06:10 UTC Modified: 2021-10-18 08:13 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: iyashpal dot dev at gmail dot com Assigned:
Status: Open Package: SQLite related
PHP Version: 8.0.11 OS: Windows 11, 10
Private report: No CVE-ID: None
 [2021-10-18 06:10 UTC] iyashpal dot dev at gmail dot com
Description:
------------
PHP Version: 8.0.11
OS Edition: Windows 11 Pro
OS Version: 21H2
OS Build: 22000.258

PHP Framework Used: Laravel 8.63
 

Test script:
---------------
Route::get('/', function () {

    $sqlite = new SQLite3(base_path('sqlite3.dbi'), SQLITE3_OPEN_READWRITE);


    dd($sqlite->query('SELECT SQRT(4)'));
    dd(DB::select("SELECT SQRT(4)"));
    return view('welcome');
});

Expected result:
----------------
Should show 2

Actual result:
--------------
ErrorException
SQLite3::query(): Unable to prepare statement: 1, no such function: SQRT

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-18 06:16 UTC] iyashpal dot dev at gmail dot com
-Operating System: Windows 11 +Operating System: Windows 11, 10
 [2021-10-18 06:16 UTC] iyashpal dot dev at gmail dot com
PHP files were downloaded from this link : https://windows.php.net/download#php-8.0

I have tested this on Windows 10 Pro and 11 Pro.
 [2021-10-18 06:17 UTC] requinix@php.net
-Package: PDO SQLite +Package: SQLite related
 [2021-10-18 08:13 UTC] cmb@php.net
-Type: Bug +Type: Feature/Change Request
 [2021-10-18 08:13 UTC] cmb@php.net
These functions need to be explicitly enabled when building
SQLite3[1], what has not been done so far.  Are these usually
available on other systems?

[1] <https://www.sqlite.org/lang_mathfunc.html>
 [2021-10-21 01:36 UTC] iyashpal dot dev at gmail dot com
On a mac, it's working fine without extra effort. On Linux, working smoothly without any extra effort.
 [2021-10-21 01:46 UTC] iyashpal dot dev at gmail dot com
The thing is I am not aware of how I can enable the sqlite3 math functions. I have tried to replace the sqlite3 extension but PHP isn't working with it. I don't know I have done this wrong way or not but it wasted my 2 days. When I am unable to fix this, I came here to find a solution but no luck. Then I posted this issue here. I don't think this is a bug but maybe there should be some guidelines on the official documentation how we can deal with such problems. I am not able to find a perfect solution on the web. You are the only hope here. I can't proceed with my Test Driven Development with php sqlite3. Please help me. And I am sorry for the late reply because I thought this issue won't get anyone's attention because this is not a bug.

Please help me with a solution. I will be very greatful for this help.

Thank You
Yash Pal
 [2021-10-21 09:58 UTC] iyashpal dot dev at gmail dot com
If I try to compile the sql php showing this error.

PHP Warning:  PHP Startup: Can't load module 'C:\Users\<user-name>\.php\8.0\ext\php_sqlite3.dll' as it's linked with 2.37, but the core is linked with 14.29 in Unknown on line 0
 [2021-10-21 10:48 UTC] iyashpal dot dev at gmail dot com
Can anyone help me here?
 [2022-11-24 04:55 UTC] ayhenswcnickolas at gmail dot com
Hello
please any one can help I am struggling from last 3 weeks so please help me.
All suggestions appreciated.  (https://www.mybkexperience.one)github.com
 [2022-12-19 06:06 UTC] kimia dot salamxxo9881 at gmail dot com
Thaks for that. (https://www.onecognizant.net/)github.com
 [2023-05-02 12:28 UTC] timsmith12 at aol dot com
Has this been resolved yet?

(https://www.linkedin.com/pulse/augusta-precious-metals-review-best-gold-ira-company-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/goldco-review-gold-ira-rollover-precious-metal-company-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/how-apply-employee-retention-credit-erc-complete-guide-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/best-gold-ira-companies-investment-retirement-accounts-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/ira-allowable-precious-metals-best-ira-approved-metal-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/roth-gold-ira-account-best-companies-how-works-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/what-employee-retention-tax-credit-ertc-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/best-precious-metals-ira-2023-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/best-silver-ira-companies-2023-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/how-protect-your-401k-from-market-crash-recession-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/goldco-vs-augusta-precious-metals-which-best-gold-ira-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/how-move-401k-gold-ira-without-penalty-jeffrey-keever/)github.com 
(https://www.linkedin.com/pulse/how-buy-physical-gold-your-401k-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/noble-gold-investments-review-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/best-paying-jobs-precious-metals-jeffrey-keever/)github.com
(https://www.linkedin.com/pulse/how-buy-gold-ira-jeffrey-keever-1e/)github.com
 [2023-05-10 19:07 UTC] kevinwilsonq1 at aol dot com
(https://groups.google.com/a/seoconsultinggroup.com/g/best-fake-id-websites/c/1-RMOkYg738)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 08:01:27 2024 UTC