phpMyAdmin not working missing function [duplicate] - php

This question already has answers here:
phpmyadmin issuing a fatal error for PMA_DBI_num_rows()
(2 answers)
Closed 9 years ago.
I have installed phpmyadmin but when I try to launch it won't. I have this error :
Fatal error: Call to undefined function PMA_DBI_num_rows() in /usr/share/phpmyadmin/libraries/navigation/Nodes/Node.class.php on line 397
I have installed php5-mysql but it still not working. Which module that contains PMA_DBI_num_rows() function?
Thanks in advance

The PMA_DBI_num_rows() function is implemented in one of the dbi libraries, which are located under phpmyadmin/libraries/dbi
They should be part of any phpMyAdmin installation, so I'm wondering if you have an incomplete or damaged installation.
phpMyAdmin will load one of its dbi drivers depending on the value of the extension, in your config file:
$cfg['Servers'][$i]['extension'] = 'mysqli';
Here's where it loads the dbi, from code in libraries/database_interface.lib.php:
include_once './libraries/dbi/'
. $GLOBALS['cfg']['Server']['extension'] . '.dbi.lib.php';
So either you have misconfigured your config file with an unknown value for extension, or else you are missing the file corresponding to a valid extension.
The valid values for extension are 'mysql', 'mysqli', and 'drizzle'.

Just install the following:
apt-get install php5-mysql

Related

PDOException: could not find driver - pdo_mysql enabled [duplicate]

This question already has answers here:
PDOException “could not find driver”
(42 answers)
php - PDOException could not find driver [duplicate]
(2 answers)
Laravel 5 PDOException Could Not Find Driver [duplicate]
(11 answers)
Laravel: PDOException: could not find driver
(32 answers)
Fatal error: Uncaught PDOException: could not find driver - windows MAMP php. The PHP.ini file has the correct part uncommented
(1 answer)
Closed 29 days ago.
I’ve been struggling trying to connect PHP to MySQL using the PDO() constructor since yesterday, and despite all the answers I’ve found on this problem, none of them worked.
In phpMyAdmin I have a database called ‘database_test’ and I’m trying to connect to it.
I’ve tried with ‘localhost’ and with ‘localhost:3306’:
<?php $mysqlConnection = new PDO('mysql:host=localhost;dbname=database_test;charset=utf8','root','root');?>
Both returning the same error when accessing http://localhost:8080/home.php :
Fatal error: Uncaught PDOException: could not find driver in
C:\Users...\home.php:3 Stack trace: #0 C:\Users...\home.php(3):
PDO->__construct('mysql:host=loca...', 'root', 'root') #1 {main}
thrown in C:\Users...\home.php on line 3
Yet, the module pdo_mysql is enabled
Mamp says : “To connect to the MySQL server from your own scripts use the following connection parameters”:
Host : localhost
Port : 3306
User : root
Password : root
Which I did.
Configuration
System : Windows 11
MAMP 4.2.0
Apache 2.2.31
MySQL 5.7.24
PHP 7.4.1
PhpMyAdmin 4.8.3
In phpinfo():
mysqlnd
enabled
API extensions
mysqli,pdo_mysql
PDO support
enabled
PDO drivers
sqlite, mysql
PDO Driver for MySQL
enabled
Client API version
mysqlnd 7.4.1
Pdo_sqlite
enabled
SQLite Library
3.30.1
In my php.ini (located here : C:\MAMP\conf\php7.4.1\php.ini), among the extensions that are uncommented I have :
extension=php_mysqli.dll
extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
extension=php_pdo_mysql.dll
; ...
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\MAMP\bin\php\php7.4.1\ext\"
; ps : I've checked, they're all here

PHP: mysqli extension doesn't load

I try to use MySQL with PHP and I have this error:
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in 'file_name Stack trace: #0 {main} thrown in 'file_name'`
When doing print_r( get_defined_functions()), I see that the MySQLi extension isn't there, but it is "loaded" in the php.ini file (I mean this is not in a commentary).
I specify that the PHP directory is in the PATH (I'm under windows) and MySQL, PHP and Apache are on my C: disk.
I don't know where is the problem, this is probably a small thing but I can't see which one so.
My versions are:
Apache 2.4.47
PHP 7.1.7
MySQL 5.7
Windows 7
PS : php_mysqli.dll do only 97k. I don't know if it's normal.
HOW I SOLVED THIS : I have just added extension_dir="path_to_php\ext" under the lines who load extentions, in the php.ini file. This line is used to indicate where are the extentions in your hard disk. Don't forget to restart your server, it will reload the php.ini file.
First of all, run phpinfo() to make sure you are looking at the correct php.ini.
If your php.ini file has extension=php_mysqli.dll uncommented check your extension directory. You may need to set it explicitly, like:
extension_dir="C:\xampp\php\ext"
If the problem persists check the apache error log, you should find more info there.

load sqlite extension from within php on ubuntu (15.04)

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

Fatal error: Call to undefined function printer_open()

I'm trying to print some string using PHP, i'm using the PHP print functions:
$printer = ("HP LaserJet Professional P1102");
$handler= printer_open($printer);
$content="Test Content";
printer_write($handler, $content);
printer_close($handler);
but I got that error :
Fatal error: Call to undefined function printer_open() in C:\xampp\htdocs\print.php on line 12
after googling it i found that i must add the php_printer.dll to the extensions file in php and add it's extension to the php.ini file, then restarting the server services, all of that accomplished but still getting that error.
p.s. I've tried it on WAMP and XAMPP
I think solution would be extension location.php_printer extension should be stored in c:\xampp\php\ext and not in c:\xampp\php. So move it to the ext-folder, and restart Apache.
Can you look into the error_log, which tells you, if it fails to load the module. You should also run a phpinfo(), which shows up all loaded modules, you must find the printer extensions there.
I hope it may resolve your issue.

"unable to load dynamic library" Errors when running PHP from command line

When I try to run my script I at first I put the shebang in the script at the top and then tried this:
php -f /home/phil/www/disable_script.php
But I'm immediately greeted by this:
PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/zlib.so' - /usr/lib/php4/zlib.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Call to undefined function: date_default_timezone_set() in /home/phil/www/disable_script.php on line 3
When I just say:
php -v
I get:
PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/zlib.so' - /usr/lib/php4/zlib.so: cannot open shared object file: No such file or directory in Unknown on line 0
What should my next step be? Do I need to reinstall php?
Sounds like there's a setting in your php.ini that is trying to load an extension that it can't find. Check to make sure the extension exists or edit your php.ini so it doesn't try to load the extension.
Also, date_default_timezone_set() is only available in PHP 5.1.0 or later. Your install looks to be PHP4.
PHP4 is old, ugly and not supported anymore. You should upgrade to PHP5 as soon as possible.
before that extension list (the .so's resp. dll's on Windows) the php.ini says:
; extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
I had luck with giving an explict path, i.e.
extension=d:\dev\fronker\php\ext\php_openssl.dll

Categories