News:

Join the Facebook Fan Page.

Main Menu

Need help migrating

Started by marcie78, May 03, 2024, 03:20:06 AM

Previous topic - Next topic

marcie78

Our forum recently just up and died on us and I need help.

Here's the thing, the forum died a few days ago. And we got an error that was fixed. But then came another error as things go. A tech upgraded our php to 7 and because of that code has to be fixed on the index file. And now I am stuck.

I tried doing this myself I am not in anyway a php developer so i am trying to port this to mysqli

Here's the original code

```

// Connect to the MySQL database.

if (empty($db_persist))
    $db_connection = @mysql_connect($db_server, $db_user, $db_passwd);
    else
    $db_connection = @mysql_pconnect($db_server, $db_user, $db_passwd);

// Show an error if the connection couldn't be made.

    if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
    db_fatal_error();
```

Here's what I did


```
// Connect to the MySQL database.

if (empty($db_persist))
    $mysqli = mysqli_connect($host, $user, $password);
else
    $link  = mysqli_connect($host, $user, $password);

/ Show an error if the connection couldn't be made.
   
if (!$link || !mysqli_select_db($dbName, $link))
    db_fatal_error();
```


I get an error. What am i doing wrong?


Please use code tags when posting code - Steve

Aleksi "Lex" Kilpinen

If you really are on 1.1 you should definitely upgrade, or you will just get in to an endless loop of error after error that you need to fix, ending with you rewriting SMF. The last update to 1.1 was released in 2015.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Doug Heffernan

Quote from: marcie78 on May 03, 2024, 03:20:06 AMA tech upgraded our php to 7 and because of that code has to be fixed on the index file. And now I am stuck.

Smf 1.1.x is not compatible with php 7. As adviced above, it would be best to upgrade your forum to the latest current version. For more on the upgrade please see the following link:

Upgrading SMF

marcie78

When I tried upgrading i got this

Fatal error: Uncaught Error: Call to undefined function display_db_error() in /home/4ru/public_html/simplemachinesforum/Sources/Subs-Db-mysql.php:76 Stack trace: #0 /home/4ru/public_html/simplemachinesforum/upgrade.php(772): smf_db_initiate('p3plcpnl0539.pr...', 'database...', 'database...', 'password', 'smf_', Array) #1 /home/4ru/public_html/simplemachinesforum/upgrade.php(212): loadEssentialData() #2 {main} thrown in /home/4ru/public_html/simplemachinesforum/Sources/Subs-Db-mysql.php on line 76


marcie78


Aleksi "Lex" Kilpinen

I'd start by double checking that your server meets the requirements for the version you are trying to upgrade to
https://download.simplemachines.org/requirements.php

Then I would double check that you were able to overwrite everything with the files in the large upgrade package from
https://download.simplemachines.org/

Also if you were trying to upgrade to 2.1, sometimes there have been cases where upgrading to 2.0.19 first has worked better for some people even though it shouldn't be necessary.

The actual error seems to be a database error though, so double checking the database connection info in Settings.php might also be worth it.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Doug Heffernan

Quote from: Aleksi "Lex" Kilpinen on May 03, 2024, 05:43:37 AMThe actual error seems to be a database error though, so double checking the database connection info in Settings.php might also be worth it.

This. I suspect that either the db connections are not entered properly, or it's a permmission issue.

Quote from: marcie78 on May 03, 2024, 04:56:40 AMFatal error: Uncaught Error: Call to undefined function display_db_error() in /home/4ru/public_html/simplemachinesforum/Sources/Subs-Db-mysql.php:76 Stack trace: #0

Additionally, what is the value set to for $db_type var in the Settings.php file and What version of mysql do you have?

marcie78

I re-ran it and was able to get this big chunk of error

Fatal error: Uncaught Error: Call to undefined function mysqli_error() in /home/4ru/public_html/simplemachinesforum/Sources/Errors.php:456 Stack trace: #0 /home/4ru/public_html/simplemachinesforum/Sources/Subs-Db-mysql.php(76): display_db_error() #1 /home/4ru/public_html/simplemachinesforum/Sources/Load.php(3697): smf_db_initiate('localhost', 'database...', 'database...', 'password', 'smf_', Array) #2 /home/4ru/public_html/simplemachinesforum/index.php(94): loadDatabase() #3 {main} thrown in /home/4ru/public_html/simplemachinesforum/Sources/Errors.php on line 456

Doug Heffernan

Quote from: Doug Heffernan on May 03, 2024, 06:26:03 AMAdditionally, what is the value set to for $db_type var in the Settings.php file and What version of mysql do you have?

Quote from: Aleksi "Lex" Kilpinen on May 03, 2024, 05:43:37 AMThe actual error seems to be a database error though, so double checking the database connection info in Settings.php might also be worth it.


marcie78


Additionally, what is the value set to for $db_type var in the Settings.php file and What version of mysql do you have?

mysql which has been changed to mysqli
last version was php7 i change it to php 8.1

marcie78

The forum is running on a secure server than had some funky code in it I had to change everything to what a regular forum would be.

marcie78

Quote from: Aleksi "Lex" Kilpinen on May 03, 2024, 03:38:22 AMIf you really are on 1.1 you should definitely upgrade, or you will just get in to an endless loop of error after error that you need to fix, ending with you rewriting SMF. The last update to 1.1 was released in 2015.

The forum was on 1.121 i believe.

Doug Heffernan

Quote from: marcie78 on May 03, 2024, 07:17:31 AMThe forum is running on a secure server than had some funky code in it I had to change everything to what a regular forum would be.

Can you please elaborate a bit further on this? The more details you give the better.

marcie78

Quote from: Doug Heffernan on May 03, 2024, 07:35:25 AM
Quote from: marcie78 on May 03, 2024, 07:17:31 AMThe forum is running on a secure server than had some funky code in it I had to change everything to what a regular forum would be.

Can you please elaborate a bit further on this? The more details you give the better.

in the settings

instead of localhost it was hxxp:prod.phx3.secureserver.net [nonactive]

$db_server = 'p3plc.prod.phx3.secureserver.net';

### Directories/Files ###
$boarddir = '/home/content/gmods/html/simplemachinesforum';
$sourcedir = '/home/content/gmods/html/simplemachinesforum/Sources';

These were conflicting with the upgrade

marcie78

I got it down to this


Warning: require_once(/home/4ru/public_html/simplemachinesforum/Sources/Errors.php): failed to open stream: No such file or directory in /home/4ru/public_html/simplemachinesforum/index.php on line 76

Fatal error: require_once(): Failed opening required '/home/4ru/public_html/simplemachinesforum/Sources/Errors.php' (include_path='.:/opt/alt/php71/usr/share/pear') in /home/4ru/public_html/simplemachinesforum/index.php on line 76

Anyone know what this is? I think it means its not finding the sources, but not sure why they are not showing up everything is correct.

Steve

DO NOT pm me for support!

Steve

Let me correct that question:

Quote from: Kindred on May 29, 2024, 04:53:41 PMWell, the thing is...smf 1.1.x is past end of life.  There is no more support for it except to upgrade.
DO NOT pm me for support!

Advertisement: