I have solved it. I had 2 installations of PHP, 7.4 and 8.0. The 7.4 was running it server but the 8.0's server was switched off. I had deleted the function from the 7.4 but when I called the command line through /usr/bin/php, it ran PHP 8.0. I then deleted the function in the PHP8.0 configuration (probably not the best way of doing it...) and now it works
Thank you. I hope I did not waste too much of your time.
Andrew