This question already has answers here:
Why shouldn't I use mysql_* functions in PHP?
(14 answers)
Closed 4 years ago.
Uncaught Error: Call to undefined function mysql_connect() in
E:\newxmp\htdocs\schoolm\ss\service\mysqlcon.php:7 Stack trace: #0
E:\newxmp\htdocs\schoolm\ss\service\check.access.php(2):
include_once() #1 {main} thrown in
E:\newxmp\htdocs\schoolm\ss\service\mysqlcon.php on line 7
You are most likely using PHP 7.x which has this function removed.
Warning
This extension was deprecated in PHP 5.5.0, and it was removed
in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be
used.
See http://php.net/manual/function.mysql-connect.php
Related
This question already has answers here:
PDOException “could not find driver”
(42 answers)
PHP Fatal error: Uncaught PDOException: could not find driver
(4 answers)
Closed 16 days ago.
I'm trying to run a php site that use mysql but i get error
Fatal error: Uncaught PDOException: could not find driver in C:\Users\aoshe\OneDrive\Desktop\test\includes\config.php:3 Stack trace: #0 C:\Users\aoshe\OneDrive\Desktop\test\includes\config.php(3): PDO->__construct('mysql:host=sql7...', 'sql7595523', Object(SensitiveParameterValue)) #1 C:\Users\aoshe\OneDrive\Desktop\test\account\login.php(3): include('C:\\Users\\aoshe\\...') #2 {main} thrown in C:\Users\aoshe\OneDrive\Desktop\test\includes\config.php on line 3
I'm running from windows
This question already has answers here:
Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' with pdo
(14 answers)
Closed 26 days ago.
I tried to migrate my application to php8.2. On 8.1 it works perflectly.
I have the same configuration on my php.ini 8.1 and 8.2 and I have this error appears :
php 8.2 Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' with pdo
Beloy my code :
if (!isset($this->driver_options[\PDO::MYSQL_ATTR_INIT_COMMAND])) {
// STRICT_ALL_TABLES 5.0.2
// NO_ZERO_DATE 5.0.2
// NO_ZERO_IN_DATE 5.0.2
// ERROR_FOR_DIVISION_BY_ZERO 5.0.2
// NO_ENGINE_SUBSTITUTION 5.0.8
$this->driver_options[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'set session sql_mode="STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"';
}
Do you any idea to resolve that ?
Thank you
Find the solution, The problem come from the Cpanel php setting must be updated
This question already has answers here:
Undefined function mysql_connect() [duplicate]
(14 answers)
Closed 3 years ago.
Fatal error: Uncaught Error: Call to undefined function
mysql_connect() in F:\xampp\htdocs\hms\includes\database.php:7 Stack
trace: #0 F:\xampp\htdocs\hms\init.php(8): db_connect() #1
F:\xampp\htdocs\hms\index.php(61):
require_once('F:\xampp\htdocs...') #2 {main} thrown in
F:\xampp\htdocs\hms\includes\database.php on line 7
Acording to php.net:
This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.
This question already has answers here:
Why shouldn't I use mysql_* functions in PHP?
(14 answers)
Closed 7 years ago.
Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\phoenixproject\register.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\phoenixproject\register.php on line 9
How to solve this??
It is most likely MySql extensions are not being loaded. Open your php.ini file and check if extension=php_mysql.dll and extension=php_mysqli.dll is uncommented
I am using the latest WAMPServer64 with PHP 5.5.12.
What I did: From a webserver (runs PHP 5.4.16) I have copied the modx folders to localhost, then I copied the entire database. I have also changed the database credentials accordingly via manager/includes/confic.inc.php.
When opening the manager login, I see the following:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in \manager\includes\extenders\dbapi.mysql.class.inc.php on line 93
When I try to login, the manager does not show up and I get a bunch of errors, content of php_error.log:
PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in manager\includes\extenders\dbapi.mysql.class.inc.php on line 93
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. DBAPI->escape() manager\processors\login.processor.php:51
PHP 3. DBAPI->connect() manager\includes\extenders\dbapi.mysql.class.inc.php:156
PHP 4. mysql_connect() manager\includes\extenders\dbapi.mysql.class.inc.php:93
PHP Notice: Undefined index: captcha_code in manager\processors\login.processor.php on line 53
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined index: rememberme in manager\processors\login.processor.php on line 54
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: allowed_ip in manager\processors\login.processor.php on line 134
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: allowed_days in manager\processors\login.processor.php on line 148
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: newloginerror in manager\processors\login.processor.php on line 224
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Warning: Cannot modify header information - headers already sent by (output started at manager\processors\login.processor.php:54) in manager\processors\login.processor.php on line 298
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. setcookie() manager\processors\login.processor.php:298
PHP Notice: Undefined variable: sql in manager\includes\extenders\dbapi.mysql.class.inc.php on line 276
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. logHandler->initAndWriteLog() manager\processors\login.processor.php:302
PHP 3. logHandler->writeToLog() manager\includes\log.class.inc.php:42
PHP 4. DBAPI->insert() manager\includes\log.class.inc.php:76
I have searched for solutions on the net, some suggested to clear the cache, which is not directly possible since the manager interface does not load. I also tried to upgrade using the default install folder, same problem remains.
So if anyone has a clue how I can solve this without installing an old version of PHP, that would be great.
To get rid of the mysql deprecated warning you have to use Evo 1.0.15+ and you should change
$database_type = 'mysql';
to
$database_type = 'mysqli';
in config.inc.php
The 'only' thing that uses the old mysql_ functions is the installer then. The deprecated warnings are disabled in there for PHP 5.5.
MODx Evolution has a lot of old code in it. As you see by your warnings it is using deprecated mysql-functions. This is long known in the MODx Forums.
As for now you have two possible solutions:
Downgrade your local php version via WAMP to some (best, the same) PHP 5.4 version.
Change your PHP error-reporting level (inside the affected files or in your php.ini) to omit deprecated errors, as long as Evo has this issue.
Can check following solution
https://toster.ru/q/125593
really works !
:)