title: How to fix: Cannot redeclare spl_autoload_register()?
body: <p>I have a website which I need to move but it seems that it doesn't work with PHP7.3.12 due to some old PHP funtions and the old 5.x is not an option this time :( </p>
  
  <p>Firstly I had an error:</p>
  
  <blockquote>
    <p>Deprecated: __autoload() is deprecated, use spl_autoload_register()
    instead in /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/autoload.php
    on line 3</p>
    
    <p>Fatal error: Uncaught Error: Call to undefined function sg_load() in
    /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/core/libraries/sql.class/sql.class.php:2
    Stack trace: #0
    /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/autoload.php(83):
    require_once() #1 [internal function]: __autoload('SQL') #2
    /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/config.php(70):
    spl_autoload_call('SQL') #3
    /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/index.php(14):
    include_once('/var/www/vhosts...') #4 {main} thrown in
    /var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/core/libraries/sql.class/sql.class.php
    on line 2</p>
  </blockquote>
  
  <p>I fixed the line 3 by changing it from <code>__autoload($ClassName)</code> to <code>spl_autoload_register($ClassName)</code></p>
  
  <p>Which caused me a new error:</p>
  
  <blockquote>
    <p><strong>Fatal error:</strong> Cannot redeclare spl_autoload_register() in <strong>/var/www/vhosts/dddd.eu/bbbgg.cdddd.eu/in_site/autoload.php</strong> on line <strong>129</strong></p>
  </blockquote>
  
  <p>Here is the whole code of autoload.php - <a href="https://pastebin.com/1Qj3pFPH" rel="nofollow noreferrer">https://pastebin.com/1Qj3pFPH</a></p>
  
  <p>What can cause this issue?</p>