File deletion trouble
Posted: 12. March 2024 15:02
I have some trouble with the installation routine of Prestashop. It works with Xampp and PHP 7 and I get an error with PHP 8.
The problematic code is:
The first line deletes a file and the third line renames a file to that name. Under PHP 8 the third line gets an "access denied" error. When I look afterwards in the file system the file has been deleted and the third line hasn't been executed.
Does anyone have an explanation for what is happening here?
The problematic code is:
unlink(getcwd() . '/index.php');
unlink(getcwd() . '/prestashop.zip');
rename(getcwd() . '/index.php.temp', getcwd() . '/index.php');
The first line deletes a file and the third line renames a file to that name. Under PHP 8 the third line gets an "access denied" error. When I look afterwards in the file system the file has been deleted and the third line hasn't been executed.
Does anyone have an explanation for what is happening here?