I posted back in September 2017 that I am a fan of the AutoIndex 2.2.4 PHP script. See my post “Bootsrap 3 Responsive Template for AutoIndex PHP Script“.
Many ISPs and web designers are moving to PHP 7.x, the current version of PHP. Unfortunately this causes AutoIndex 2.2.4 to stop working. It will throw an error referring to a magic_quotes function call on line 122 of the index.php
file:
Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime()
The magic_quotes function was taken out of PHP 7.x. But have no fear, it turns out that the solution is not too difficult.
-
-
- Make a backup copy of the original
index.php
in case something goes wrong. - Open
index.php
in your editor and find lines 116 to 122 which should look like:
if (@get_magic_quotes_gpc())
//remove any slashes added by the "magic quotes" setting
{
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
}
@set_magic_quotes_runtime(0); - Disable these lines by remarking them out with /* at the beginning and */ at the end like this:
/* if (@get_magic_quotes_gpc())
//remove any slashes added by the "magic quotes" setting
{
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
}
@set_magic_quotes_runtime(0); */ - Save the file and close your editor.
- Now flush your browser cache, run your AutoIndex page, and start testing.
- Make a backup copy of the original
-
This fix worked for me. I tested the change in Firefox, Chrome, Edge, and Internet Explorer. So far there have been no problems. Let me know if this works for you.
woo amigo me sorprendes y tus publicaciones me salvaron de pagar , extra a mi host por brindarme soporte de php 5.6 con tu truco pude resolver fácilmente gracias genio , un abrazo y Bendiciones me gustaría darte un donativo es algo simbólico pero de corazón y en forma de gratitud escríbeme a mi correo
Gracias por tus buenos comentarios. Me alegra que esta solución te haya funcionado.
Thank you for your nice comments. I am glad this fix worked for you.
Thank you for taking the time to share this workaround! It saved me from running two separate web servers on the same local computer.
nice nice nice, work yes !
Thank you for sharing. Sorted my issue too!
Thank you … for share this workaround! … Thank you
Hi sir.
Recently my ISP want me to change to php 8.1 or to pay for keeping php 7.4 version
Unfortunatly autoindex seems to not working on php 8.1.
I try some fix, but my knowledge are limited. ;(
Can you help me to update the script for use with php 8.1 and for the futur php 8.2 ?
Updating AutoIndex to PHP 8.x will take a good amount of time. I have this on my task list. I cannot tell you when I can update the script. I am in the same situation with my ISPs, all of them seem to be ready to stop providing PHP 7.4. I will let you know when I get the time to update the script.
Hi Beau.
Someone point me this version of AutoIndex that work on PhP 7.4 and PhP 8.1 and PhP 8.2.
https://github.com/Dark1-dev/AutoIndex-Php8
Have a nice sunday. 😉
Thank you for posting this. I posted an article in my blog giving you credit for sharing this with me. Thank you for your support and help.