Sphider 5.2.0 and SphiderLite 2.3.0 fail after install

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

Sphider 5.2.0 and SphiderLite 2.3.0 fail after install

Post by captquirk »

After installing Sphider 5.2.0 or SphiderLite 2.3.0, they fail to run. The error log states "Class Random\Randomizer not found."

The issue is that the rand() and mt_rand() functions will become deprecated in the coming release of PHP 8.3. These releases have a custom replacement for those functions. The replacement uses the Class Random\Randomizer.

Unfortunately, that class does not exist prior to PHP 8.2!!!

There are two solutions to the issue. Solution 1 is to install Sphider 5.2.1 or SphiderLite 2.3.1. In these versions, the mt_rand() is still used, but the code and ability to use the custom replacement is there if you are running PHP 8.2 (or later versions). The instructions for doing this adjustment will be detailed below.

The second solution is to edit the files you have. Again, instructions follow.

Edit 5.2.0 or 2.3.0:
auth.php, edit line 29 from
$_SESSION['keyset'] = md5(session_id().time().my_mt_rand());
to
$_SESSION['keyset'] = md5(session_id().time().mt_rand());
spider.php, lite line 22, full version line 24, from
$_SESSION['keyset'] = md5(session_id().time().my_mt_rand());
to
$_SESSION['keyset'] = md5(session_id().time().mt_rand());
and rss_spider.php (full version only) from
$_SESSION['keyset'] = md5(session_id().time().my_mt_rand());
to
$_SESSION['keyset'] = md5(session_id().time().mt_rand());
In Sphider 5.2.1 and SphiderLite 2.3.1, the mt_rand() is enabled by default. To change to the custom replacement (my_mt_rand()), you need to be running PHP 8.2 or greater.
In auth.php, uncomment line 30, comment out line 32.
spider.php, full version, uncomment line 25, comment out line 27.
spider.php, lit version, uncomment line 23, comment out line 25.
rss_spider (full version only), uncomment line 26, comment out line 28.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Sphider 5.2.0 and SphiderLite 2.3.0 fail after install

Post by captquirk »

Permanent, automatic fix in Sphider 5.3.0, SphiderLite 2.4.0.

No more user code tweaking necessary!
Post Reply