Updating Error

Come here for help or to post comments on Sphider
User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 5:03 am

Be sure to give the database a new name for the fresh install. If that goes well, let me know and I may be able to work out a way to port the data from the old database to the new to save having to re-index all your sites.

1.3.5 is pretty old and PHP 5.6 isn't gonna be around forever!

SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow » Tue Dec 11, 2018 5:07 am

So I did quickly try a fresh install with the modified install.php but ran into problems.

I got the following error response.
Capture2.JPG
Capture2.JPG (18.52 KiB) Viewed 687 times
Although in looking at the DB it does look like tables were created
Capture3.JPG
Capture3.JPG (206.82 KiB) Viewed 687 times
That said, it would not let me load the admin.php page. It gives me a 500 error "currently unable to handle this request". Although that could be something on my end. I did try in both 5.6 and 7.

User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 6:01 am

The error message most likely is not critical and easy to correct--- ONCE YOU GET INTO ADMIN.PHP!
One value in the settings table (for a tabbed search) most likely did not get populated. You can check that value and do a save. Then if you don't want a tabbed search, uncheck it and do another save. It should be either a 1 (on) or 0 (off), but is most likely null.

As for the 500 error. ONE of the problems might me a permission problem. I saw this:
A Permissions Error. In most cases, a 500 Internal Server Error is due to an incorrect permission on one or more files or folders. In most of those cases, an incorrect permission on a PHP and CGI script is to blame. These should usually be set at 0755 (-rwxr-xr-x).
Of course that isn't the ONLY possible problem, but something worth checking out. Ownership may be an issue, too.

Once you are in and have an empty database (except for the settings table), rather than going through and re-indexing all your sites, cloning data from the old db to the new might be a better route. That is something best done from the mysql command prompt. It would be something like this:
INSERT INTO newDB.table1 (col1, col2)
SELECT oldcol1 oldcol2 FROM oldDB.table1;
You would need to do this for MOST (but not all) of the tables in the old db. Naturally, the added tables in the new db are not a concern. The good news is that, as best as I can recall, all the table columns in the old exist with the same names in the new. Some tables have new columns, but again, that is not a concern. If you are interested, and can help you with EXACT wording for those commands. I would just need to know the old and new db names and whether or not you are using a table prefix.

User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 7:28 am

Looking ahead to after you have Sphider 2.2 running....
You mentioned using different directories because you need a couple different languages on your site. With 1.3.5, this works fine because all configuration settings are stored in a file. With Sphider 2.2, they are stored in the database. So the language specified in the database IS the language used. Change it in a different directory and it gets changed for all!

But fear not, there is a pretty easy work-around for that. The directories for other languages only need one file, search.php. Search.php in the other directories will need a few lines modified to specify the path to the required include files. Then there would need to be a single line added which overrides the language specified in the database (without changing the database).

Once you get that far, let me know and I'll give you the specific changes for those alternate language searches. Just ONE file. Actually simpler than duplicating the entire code installation just for a language change!

SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow » Tue Dec 11, 2018 1:40 pm

The admin.php starts to load but in running some checks it is failing when trying to load conf.php. It does not get through that first IF statement. If I try to echo the $stmt it is empty so guessing I am getting a fail in the variable. Not sure what part of that statement is creating the issue. I will try to dig some more from my side a bit later, but if you have any thoughts let me know.

User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 4:20 pm

I take it you are getting the very top of the admin page, then ..... nothing.

I had the same thing happen to me when setting up for some testing on another machine. Admin first asks for 'auth.php'. That gets things started. Auth includes 'database.php', which opens the database. Admin sets a couple include paths, then loads 'conf.php'. That's where it hung for me, and presumably for you also.

I racked my brains before it finally dawned on me. THE DATABASE WASN'T BEING OPENED! There was no error given because there was no connect error per se. The issue was that my credentials (database, user, password, host) weren't correct. I looked at it ten times before I finally noticed a single typo.

So, my guess is that you are failing to connect to the new database. Wrong user id or password? User name doesn't have permission? Check the database configuration and info provided in 'database.php'.
-----
Got to run a cat to the vet, so I'll be out awhile.

SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow » Tue Dec 11, 2018 5:32 pm

That seemed like a possible cause when looking into earlier. Checked all those data points and they are fine. I even tried resetting the password and that made no difference.

The only thing I can think of at this stage is the creation of the DB initially I did through the cPanel mysql wizard instead of the command approach in the install instructions. I made sure everything was set the same, but maybe it is somehow seeing it different. I need to put this down until later today, so no rush but if you have other thoughts let me know.

User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 6:38 pm

Here is a test script based on database.php. If the database, user, or password is wrong, you get a warning and message "Database connection failed" and an error number. If the host is wrong, you get nothing. If the table prefix is wrong, you get a "Failed to execute statement" message. If the statement execute fails, you get "Execution failed" and an error number. If all goes well, you get a simple "Success".
<?php
$database="sphider";
$mysql_user = "root";
$mysql_password = "";
$mysql_host = "localhost";
$mysql_table_prefix = "";

$db = new mysqli("p:".$mysql_host,$mysql_user,$mysql_password,$database);
if ($db->connect_errno) {
trigger_error(
"Database connection failed: ".$db->connect_errno, E_USER_ERROR
);
}

$stmt = $db->prepare("SELECT * FROM `".$mysql_table_prefix."settings` WHERE id=1");
if ($stmt) {
$stmt->execute() or die("Execution failed: ".$stmt->error);
$result = $stmt->get_result();
$row = $result->fetch_array(MYSQLI_NUM);
$stmt->close();
echo "Success";
} else {
echo "Failed to execute statement";
}


As with database.php, edit the database, user, password, host, table prefix to your needs. If you get "Success", then we need to look elsewhere for the problem. Any other result and you have an idea what needs fixing until you get "Success".

SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow » Tue Dec 11, 2018 6:51 pm

So I modified that middle snipet that test the connection to

$db = new mysqli("p:".$mysql_host,$mysql_user,$mysql_password,$database);
if ($db->connect_errno) {
trigger_error(
"Database connection failed: ".$db->connect_errno, E_USER_ERROR
);
} else {
echo "Got Connection";
}

And I at least get the 'Got Connection' to come up but I get neither the of the echoed statements for the next group. Have to put down for a while but will be back at it later. Just an FYI I don't have a table prefix, but I am wondering if something might be going on in the code segment that generates the $stmt variable.

User avatar
captquirk
Site Admin
Posts: 119
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk » Tue Dec 11, 2018 8:10 pm

Well, that settles part of it. Try the second half of the snippet to see if it is successfully executing a query.

Post Reply