1

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.

Avatar
  • 14,622
  • 9
  • 119
  • 198
  • The cache should be physical, isn't it? So there should be a "cache"-folder somewhere in your project-folder. Did you try clearing it's content? – Sebastian G. Marinescu Jun 29 '15 at 17:40
  • Yes, I have removed all files from `\assets\cache`, same errors as above. I also copied the cache folder from the fresh installation, same problem. – Avatar Jun 29 '15 at 17:43
  • clearing the cache won't help. you either upgraded to a newer mysql on the local machine, or your other machine has warnings disabled - the warnings are NOT going to away without fixing the code to NOT use the deprecated mysql_*() functions. – Marc B Jun 29 '15 at 17:52
  • Now I have done the following: 1. Clear install of ModX Evo 1.0.15 on localhost with a new db, 2. then changing the database in `manager/includes/confic.inc.php` ($dbase) to the original database. Now I can login. 3. Problem: These are not the files from the webserver, I'd need to compare both for the same files/modules/etc. However, for simple testing purpose it might be sufficient. 4. Nevertheless, I would really like to know a direct solution to the problem above. – Avatar Jun 29 '15 at 17:59
  • Did you try one of the two mentioned solutions in my answer http://stackoverflow.com/a/31122537/1166642 ? – Sebastian G. Marinescu Jun 29 '15 at 18:17

3 Answers3

3

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.

Jako
  • 832
  • 5
  • 11
  • Due to your fix above the manager shows up, thanks a thousand Jako. Sidenode: modx then tried to load `includes/extenders/dbapi.mysqli.class.inc.php` (mysqli) which did not exist on my localhost. Obviously when copying from the webserver to my localhost not all files were copied. – Avatar Jun 30 '15 at 06:58
0

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:

Community
  • 1
  • 1
Sebastian G. Marinescu
  • 2,374
  • 1
  • 22
  • 33
  • Solution 1: Did not work, WAMP server x64 did not accept the PHP 5.4 packages I tried. Solution 2: Did not work, I added the `error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); ` to both stated fileds, still the deprecated warning appears. – Avatar Jun 29 '15 at 18:31
  • Did you download the PHP package from the official "Get more..." button? (updated post with link to SO-post) Adjusting the error_reporting should actually work - If you'd do it right, in the right spot, the warnings definitely shouldn't appear any more. – Sebastian G. Marinescu Jun 29 '15 at 18:38
0

Can check following solution https://toster.ru/q/125593

really works ! :)

Alex
  • 769
  • 1
  • 11
  • 18