mysql_connect in Co...
 
Notifications
Clear all

mysql_connect in Combu 2

8 Posts
2 Users
0 Likes
729 Views
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

We're upgrading our web server to php 7.2, and turns out that mysql_connect isn't supported there anymore. We've got a game still using Combu 2, and will be upgrading it to v3 in awhile, but in the meantime, is there a way to make it work? If we were to change out the commands in database.php to use mysqli, would that solve the issue or are there other database commands elsewhere?

thanks

Dave

 
Posted : 19/10/2018 2:58 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

You can probably replace the content of Database.php of v2 with /vendor/skaredcreations/combu/combu/Database.php of v3, now I don't remember if v2 Database class had a single Fetch method instead of FetchAssoc/FetchNum like in v3 but it would be easy to make the switch. Let me know if you have issues with replacement not working.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/10/2018 3:10 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

Thanks. We've tried that, but still get two errors and failure to login:

 

Error logging in: 500 Internal Server Error

UnityEngine.Debug:LogError(Object)

CombuAccountRoot:HandleGenericError(String, String, Boolean) (at Assets/0 Game Assets/Scripts/User Accounts/CombuAccountRoot.cs:98)

CombuLoginAndRegister:<Login>m__5F(Boolean, String) (at Assets/0 Game Assets/Scripts/User Accounts/CombuLoginAndRegister.cs:500)

Combu.<DoAuthenticate>c__AnonStorey138:<>m__EB(String, String) (at Assets/Combu/Scripts/User.cs:137)

Combu.<DownloadUrl>c__Iterator9F:MoveNext() (at Assets/Combu/Scripts/CombuManager.cs:424)

 

Error logging in: 500 Internal Server Error

UnityEngine.Debug:LogError(Object)

CombuAccountRoot:HandleGenericError(String, String, Boolean) (at Assets/0 Game Assets/Scripts/User Accounts/CombuAccountRoot.cs:112)

CombuLoginAndRegister:<Login>m__5F(Boolean, String) (at Assets/0 Game Assets/Scripts/User Accounts/CombuLoginAndRegister.cs:500)

Combu.<DoAuthenticate>c__AnonStorey138:<>m__EB(String, String) (at Assets/Combu/Scripts/User.cs:137)

Combu.<DownloadUrl>c__Iterator9F:MoveNext() (at Assets/Combu/Scripts/CombuManager.cs:424)

 

 

 
Posted : 19/10/2018 3:30 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

Ah it's probably because the v3 class has a different constructor which requires the database type ("mysql" is the only supported for now) as first parameter and the MySQL server port as third parameter ("3306" is the standard port).

The initialization of $Database variable in api.php should be like the following (replace GAME_DB_* constants with the ones defined in your config.php if they have different names in v2, which I don't remember now):

$Database = new Database("mysql", GAME_DB_SERVER, "3306", GAME_DB_NAME, GAME_DB_USER, GAME_DB_PASS);

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/10/2018 3:51 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

Thanks, tried that, same two errors. Any other ideas, or do we need to wait until we upgrade to v3?

 
Posted : 19/10/2018 4:32 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

You can check the error log file of your Apache server to see the details of HTTP errors, anyway I'll try myself as soon as will be back at home (within 1 hour).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/10/2018 4:48 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

Download the file attached to this message and rename to Database.php, then in api.php initialize the connection with the following line:

$Database = new Database(GAME_DB_SERVER, GAME_DB_NAME, GAME_DB_USER, GAME_DB_PASS);

Also make sure that the mysqli module is enabled: create a file test.php that contains <?php phpinfo(); ?> and search for "mysqli" in the page content on browser (if it's not found then you'll need to enable the extension "mysqli", search for "mysqli" in the line that contains "extension=mysqli.").

Also remember that short_open_tag is disabled by default in php.ini, so you can either enable it in php.ini for all the websites defined on server or create a file .htaccess (yes it starts with ".") in the root of your Combu v2 folder with the following content (for .htaccess to work you must have "AllowOverride All" in Apache's httpd.conf):

php_value short_open_tag 1

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/10/2018 6:27 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

That worked! Thanks much for your help!

 
Posted : 02/11/2018 3:09 pm
Share: