admin.php error 500

Come here for help or to post comments on Sphider
Crash
Posts: 8
Joined: Sat Jul 09, 2022 9:24 pm

admin.php error 500

Post by Crash »

Hi,
First of all, wanted to say that this script looks very impressive. Great to see it being kept updated frequently,

I installed v4.2.0 and the install.php process has run through fine and I can see that it's created the tables in the DB.

The login page displays for admin.php, but when entering the default credentials, it returns error 500.

I can't seem to find a PHP error_log being written into in the admin directory, so I can't say more about the cause.

The PHP server is running PHP 7.2.
The two config files, under /settings with the database login info have exactly matching details.

I wondered if you could let me know if the script needs tweaking to let it log any PHP errors, like this server normally does.
I changed and uncommented some lines near the top of admin.php about debugging but it didn't seem to change the behaviour.

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

Re: admin.php error 500

Post by captquirk »

A 500 error is a hard to track server error.
Since the installation went fine, and having gotten the login screen, install.php and auth.php ran perfectly. The crash occurred in admin.php.

There is a script which can test your PHP installation. https://www.sphider.worldspaceflight.co ... _check.zip
Unzip this and give it a run. It is a new script and worked for me, now let's hope it runs for you as well and gives some useful information!

Let me know the results (a screenshot perhaps) and we can go from there.
Crash
Posts: 8
Joined: Sat Jul 09, 2022 9:24 pm

Re: admin.php error 500

Post by Crash »

Hi, thanks for that,
Output is below ...

Code: Select all

You do NOT have mysqlnd. (Required)
PHP 7 or greater - CHECK!
Curl - CHECK!
Iconv - CHECK!
Mbstring - CHECK!
Imagick NOT installed. (Optional but recommended)
Imagick is not needed for Sphiderlite.)

Sorry. You are missing one or more requirements to run the latest versions of Sphider or Sphiderlite.
Consult the messages above.

Note: Some older versions might work for you. Contact us for specifics.
The cPanel PHP version area shows mysqlnd as being enabled, which is odd ...
If there's no other reason why the 'mysqli_fetch_all' function could fail, I can have a chat with the hosts and see why it's not available.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: admin.php error 500

Post by captquirk »

CPanel and mysqlnd ...
This can get tricky. Read this Post -https://www.blog.worldspaceflight.com/2 ... d-mysqlnd/

Essentially, in CPanel you need to CHECK mysqlnd and UNCHECK mysqli!

Now allow me to rant for a bit...
Sphider requires BOTH mysqli AND mysqlnd. This is true and correct. The mysqli module that comes with PH P has mysqlnd INTEGRATED into it. It has been this way for quite some time. Mysqlnd is no longer a separate module. But is is possible, in the PHP configuration, to disable the mysqlnd portion. Why some providers even do so is a question only they can answer.

What REALLY gripes me is that whoever designed CPanel seems to be determined to confuse the everlasting heck out of users!
What CPanel SHOULD say is {} mysqli, and [] mysqli/nd.
Mysqli gives you mysqli with mysqlnd disabled. Mysqlnd give you mysqli with mysqlnd enabled!
You can have one, or the other, but not both... and having both is a configuration error that just might give a 500 error.

The correct setting are counterintuitive. And we all have to find this out the hard way.

Hopefully this solves your issue. If not, post again and we will look further.
Crash
Posts: 8
Joined: Sat Jul 09, 2022 9:24 pm

Re: admin.php error 500

Post by Crash »

Hi, Thanks for that,

In this case, I unticked mysqli and left mysqlnd unticked.
This seemed to disabled mysqli in the way that cpanel seemed to claim and various other, unrelated scripts stopped running.
It didn't seem to allow the admin.php to proceed.

Re-enabling both, didn't seem to bring anything further.
I tried it various ways-on and admin.php didn't seem to want to load beyond the login screen - also on a different machine.

phpinfo seems to show mysqlnd as well as mysqli as being configured and ready, in theory:
http://xbomber.co.uk/info.php

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

Re: admin.php error 500

Post by captquirk »

In CPanel you want mysqlnd TICKED and
'mysqli UNTICKED and
nd_mysqli TICKED!

I know this is counterintuitive, but it works. LOL!

You will know you have it right when the last line (API value) of mysqlnd in the info page has a value.

-----------------------------------------------

Enabling MySQLnd
If you are using mysqli ( not Mysql ) then you need to use nd_mysqli . This is required as several functions like mysqli_fetch_all , get_result() etc are not going to work without support of nd_mysqli.
mysqlnd-enable.jpg
mysqlnd-enable.jpg (97.04 KiB) Viewed 7735 times
You need to uncheck mysqli ( remove ) and check nd_mysqli , you can’t make both checked as there will be a conflict.
Crash
Posts: 8
Joined: Sat Jul 09, 2022 9:24 pm

Re: admin.php error 500

Post by Crash »

Thanks for your help on this!
I missed that there were two options for msqlnd on the GUI page: one of which wasn't set.

We're in now and having a good play with it.
Things are working really well.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: admin.php error 500

Post by captquirk »

Glad you have it working. Missing a part of the fix is probably my fault! My initial instructions were taken from memory, and my memory only provided 2/3 of the solution. When you still had an issue, I went back and double checked myself.
:oops:

But we got it all straight now. Happy indexing.
Crash
Posts: 8
Joined: Sat Jul 09, 2022 9:24 pm

Re: admin.php error 500

Post by Crash »

It's going really well!

I had a question about it ...
Is there a way to tell which page on the site referred the spider to a certain page?

So in other words: "on which page did you find that link?"

It's no issue if not. I was just interested in optimising my own site to prevent it from serving up duplicate links to the spider (%20 instead of space and %2F instead of / etc).


One thing that I spotted was that, when you re-index, pages that are deleted and no longer linked to don't seem to get wiped from the search results.

If I want to use a cron job to set the indexing away every... hour, can I tell the spider to delete everything in the DB and index from scratch, so that you know that the only contents in the search are going to be current?
Last edited by Crash on Tue Jul 12, 2022 2:32 pm, edited 1 time in total.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: admin.php error 500

Post by captquirk »

Is there a way to know what links appear on each page? No, Sphider has no way of reporting this. While my goal now is to keep Sphider functional and not to add any new features, the idea of knowing what links to what IS intriguing....

Sphider does protect against indexing duplicate pages, but this is based on a checksum. I can't say for sure if the file name is part of that checksum, although I am pretty certain the path is not. And is a space and %20 the same to Sphider? I really don't know! If space and %20 are different, the page(s) will have different checksums.

Removal of deleted pages... Upon a normal index, each page indexed is rechecked for changes. Adding a new link to a page will change the checksum, cause a reindex of that page, and new pages will be picked up. If a page is checked for changes and produces a 404 error (missing/deleted page) it will be removed from the index. I just saw that happen to I am pretty sure that is not currently feature is not broken.

HOWEVER, having said that, let's say you have a fully indexed website, you delete a page, then re3index USING A SITEMAP! In that case, each page check will find BUT NOT FOLLOW new links and will do nothing with deleted links! Indexing and reindexing using a sitemap has it benefits and downfalls!

In Admin there is a Clean Tables tab. The Clean links button will find and remove this orphaned pages. While on the subject of the Clean tab, the Clean keywords function is very useful. A keyword may appear on multiple pages, and if you have multiple sites, can occur in more than one site. So Sphider has to be careful of not creating a royal mess of things. When you know there are no more orphan links (pages), you can Clean keywords and any word which is truly not referenced ANYWHERE will be removed.

Finally, concerning a cron job, it is easy enough to perform a reindex from a cron job. Unless you are working with sitemaps, a reindex should leave everything clean (barring maybe an couple orphan keywords). (I will run some local tests on deleted pages just to be sure there is nothing broken.) Sphider has no way to purge the database easily, especially from a cron. I suppose one could write a script to do such a thing though, and run that as a cron. If you choose to do so, just some cautionary notes. Don't delete the "settings"! And don't delete "sites" or "domains", or "categories". You may also want to keep the search log. And secondly, truncating the rest of the tables is not as easy as it sounds. Several of the tables are linked together using foreign keys. The database won't let you truncate some tables because of a relationship with other tables. To get around this you need a SQL command like "SET FOREIGN_KEY_CHECKS = 0;" before truncating and remembering to "SET FOREIGN_KEY_CHECKS = 1;" when you finish (or risk creating chaos).
Post Reply