CodeIgniter Forums
function unlink() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: function unlink() (/showthread.php?tid=75594)



function unlink() - dimalebid - 02-25-2020

Hello, I can’t understand why the file is not deleted. The file path is correct. I try to delete the file from the controller with the unlink() function. The file is located behind the project on the current server.

engine/inc/myproject - here is the framework
engine/my_files - there are files that I'm trying to delete through the unlink() function

There are no errors!

PHP Code:
unlink($_SERVER['DOCUMENT_ROOT'] . "engine/my_files/file.tmp"); 
the file does not delete!

PHP Code:
unlink($_SERVER['DOCUMENT_ROOT'] . "engine/my_files/file.text"); 
file deletes!


RE: function unlink() - InsiteFX - 02-25-2020

Is the file read only etc; check the file chmod settings.


RE: function unlink() - dave friend - 02-25-2020

Undoubtedly a matter of permissions.


RE: function unlink() - dimalebid - 02-25-2020

I tried not to remove it from the controller. Is deleted! I threw the php file to the root and tried to delete the file there. everything worked and the file was deleted. If deleted from the controller, the file is not deleted.