PDA

View Full Version : Is this broken with PHP7?


dungeon
06-18-2016, 11:36
Trying to do an install using XAMPP which has installed Apache/2.4.18 (Win32), OpenSSL/1.0.2e and PHP/7.0.6.

I'm at the point where I am adding the DB info to the config fie for the website however after I added the info I tried to connect to the site and I get the following errors

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_mysql has a deprecated constructor in D:\xampp\htdocs\hlstatsx\includes\class_db.ph p on line 58

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Table has a deprecated constructor in D:\xampp\htdocs\hlstatsx\includes\class_table .php on line 48

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; TableColumn has a deprecated constructor in D:\xampp\htdocs\hlstatsx\includes\class_table .php on line 515

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\xampp\htdocs\hlstatsx\includes\class_db.ph p:87 Stack trace: #0 D:\xampp\htdocs\hlstatsx\hlstats.php(130): DB_mysql->DB_mysql('localhost', '', '', '', 0) #1 {main} thrown in D:\xampp\htdocs\hlstatsx\includes\class_db.ph p on line 87*note i replaced the config file with the blank one so it didn't show all my database info.

Anybody know what is going on here?

melkor217
06-18-2016, 12:23
Afaik "mysql" module had completely dropped from php7.

Heil mysqli!

melkor217
06-18-2016, 12:26
http://php.net/manual/en/function.mysql-connect.php

dungeon
06-18-2016, 12:32
Hmm, so short of learning php and rewriting things my only choice is to go back to php 5.5.

Guess that's not a huge issue.

Thanks all.

Akuba
06-18-2016, 15:02
why do people still use mysql when mysqli is available?

melkor217
06-18-2016, 15:07
why do people still use mysql when mysqli is available?

Because hlstatsx is dead

dungeon
06-18-2016, 18:46
Went to an older version of xampp, all working now.

XERXES AT
06-28-2016, 03:38
Had the same problem some time ago, I did compile the "mysql" module for php7, this is not an ideal solution but it works.

Darkimmortal
08-10-2016, 14:47
https://github.com/kijin/mysql-compat

php.ini auto_prepend_file with this and everything written for the old mysql extension will just work (including HLX:CE)

PAL-18
08-22-2016, 00:27
https://github.com/kijin/mysql-compat

php.ini auto_prepend_file with this and everything written for the old mysql extension will just work (including HLX:CE)

I couldn't get that one to work (resulted in blank pages everywhere on my website). I found this one that does the same and does work:

https://sourceforge.net/projects/mysqlwithmysqli

Save file to your stats/include folder.

Edit: include/class_db.php

Below:
if ( !defined('IN_HLSTATS') ) { die('Do not access this file directly.');

Add:
include 'mysql_mysqli.inc.php';

dexslab
08-22-2016, 17:58
Here is modified class_db.php. Overwrite the one in the includes folder. I am working on getting a pull request sent in this works i have tested it myself it uses mysqli instead of mysql and still supports persistent connections if needed.

dexslab
08-23-2016, 08:28
Looks like dailyawardinfo using mysql for one line so here is that file as well. Thanks to my forum members they helped me with full testing and checking out almost every page. If there are any more i will post them. This goes in the pages folder of your hlstats website

Starkiller
06-27-2017, 21:03
Hello,

I tried the solution of PAL-18, then dexslab and to finish the 2 at the same time I still have problems on various pages ...

Example on my main page:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_mysql has a deprecated constructor in C:\UwAmp\www\stats\includes\class_db.php on line 58

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Table has a deprecated constructor in C:\UwAmp\www\stats\includes\class_table.php on line 48

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; TableColumn has a deprecated constructor in C:\UwAmp\www\stats\includes\class_table.php on line 515

Precision of my configuration:
-I'm local, web server and game server.
-I'm under windows 10
-For the web part I use UwAmp which emulates "Apache" and "php-7.1.6-Win32-VC14-x86" and "mysql-5.7.11"

Thank you in advance for the help you can bring me.
Have a good day.

MAMAC
10-20-2017, 06:19
anyone fix this errors 58 48 and 515

NomisCZ
10-22-2017, 08:14
anyone fix this errors 58 48 and 515

Try attached zip.

MAMAC
10-22-2017, 09:36
Try attached zip.
yap that fix that errors but i get new one...

PHP Warning: Illegal string offset 'Position' in /public_html/stats/statistics/includes/pChart/pData.class on line 57,
PHP Warning: Illegal string offset 'Format' in /public_html/stats/statistics/includes/pChart/pData.class on line 58,
PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /public_html/stats/statistics/includes/pChart/pData.class:58,
Stack trace:,
#0/public_html/stats/statistics/trend_graph.php(114): pData->pData(),

csgoandsm
12-25-2017, 22:07
yap that fix that errors but i get new one...

PHP Warning: Illegal string offset 'Position' in /public_html/stats/statistics/includes/pChart/pData.class on line 57,
PHP Warning: Illegal string offset 'Format' in /public_html/stats/statistics/includes/pChart/pData.class on line 58,
PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /public_html/stats/statistics/includes/pChart/pData.class:58,
Stack trace:,
#0/public_html/stats/statistics/trend_graph.php(114): pData->pData(),



https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/pull-requests/14/made-compatible-with-php-7/diff

https://forums.alliedmods.net/showthread.php?t=303876


:)