Jump to content

Recommended Posts

Im attempting to delete install.php off my sever if it exist

$installphp = 'install.php';
if (file_exists($installphp)){
$killinstall = "install.php";
mkdir('install.php', 0777);
unlink(@$killinstall);
}

 

Warning: mkdir() [function.mkdir]:

Warning: unlink(install.php) [function.unlink]: Permission denied in

 

permissons are corrent

Is there another function that that deletes files of a server besides this one?

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/
Share on other sites

Going back to Maq's question, what OS is your server running?

 

Back when I was using Windows, I had to use chown() to nobody just to delete a file. I don't know why.

 

He said he wants it to be platform independent:

 

@ maq well the thing is im making a bulletin board script so it will be compatible with -------------

this code will be ran on tons of sites

 

@OP:

Do you ever open this file?  Because you would have to fclose it first.

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/#findComment-843680
Share on other sites

Going back to Maq's question, what OS is your server running?

 

Back when I was using Windows, I had to use chown() to nobody just to delete a file. I don't know why.

 

He said he wants it to be platform independent:

 

@ maq well the thing is im making a bulletin board script so it will be compatible with -------------

this code will be ran on tons of sites

 

@OP:

Do you ever open this file?  Because you would have to fclose it first.

 

fopen is not used in the file that needs deleted so i would assume it dont need closed

Please correct me if i said something wrong

 

 

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/#findComment-843685
Share on other sites

the file remains but is it empty ?

Operation not permitted
normally means the account php is running is doesn't have owner access, are you sure the permissions are correct ?

 

EDIT: that basically truncates the file (wipes its contents) also if an error occured their it gives a better idea what the problem could be ;)

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/#findComment-843701
Share on other sites

the file remains but is it empty ?

Operation not permitted
normally means the account php is running is doesn't have owner access, are you sure the permissions are correct ?

 

EDIT: that basically truncates the file (wipes its contents) also if an error occured their it gives a better idea what the problem could be ;)

 

Oh just noticed the file is EMPTY

I take it the code is fine and this is a server issue since the install.php file is set to 777?

Oh and thanks for the information its understandable for sure

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/#findComment-843707
Share on other sites

yeah mad thanks

I just comment out the chmod and will tell the user to make user install.php is set to 777

Now when the users loads the admin panel the code will delete the data out of install so there will be 0 security issue.

Will just be wasted resources if its ran every time and it will run if the install.php is there

 

Link to comment
https://forums.phpfreaks.com/topic/159957-delete-install/#findComment-843721
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.