deadonarrival Posted May 19, 2008 Share Posted May 19, 2008 I'm looking at ways to allow my script to be used, with a minimum of fuss, on any server. I'm going to use an install script, but I don't want to require the user to touch any server settings or delete the file after use due to the security risk) Can anyone suggest any methods of allowing a script to be run once, and only once. Once the user hits submit, it's done. Caveats: I can't use mysql for checking - I want the setup procedure completely database independant. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/ Share on other sites More sharing options...
gizmola Posted May 19, 2008 Share Posted May 19, 2008 The only thing I can think of is to write a file out. Even this technique can have issues, if permissions or configuration don't allow the creation of a file, but this is something you could check for in your script. Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545005 Share on other sites More sharing options...
micmania1 Posted May 19, 2008 Share Posted May 19, 2008 At the end of the installation script, you could write a file. At the beginning of your installation script, check to see if the file exists. If it exists, don't install. Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545006 Share on other sites More sharing options...
deadonarrival Posted May 19, 2008 Author Share Posted May 19, 2008 That's not a bad idea. Again I'd assume not foolproof - but I like it more than writing a value to that file and checking it. Is it possible to delete a file from PHP? More importantly, is it possible for a script to delete itself? That way, I could attempt to delete the install script - and if that doesnt work write the file. If I can't delete my install file, neither can anyone else delete my created file. The more I think about it, the more I like it. Thanks guys Any other thoughts welcome Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545013 Share on other sites More sharing options...
PFMaBiSmAd Posted May 19, 2008 Share Posted May 19, 2008 is it possible for a script to delete itself? Why not just try it to see (I believe I saw it work before.) Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545016 Share on other sites More sharing options...
micmania1 Posted May 19, 2008 Share Posted May 19, 2008 yeah, just try it. I've found nothing form a quick google of it. Make sure you copy it though I think the ervre runs through the file for errors before it actually executes the script, so hopefully even though the file s deleted, it may still run the rest of it. Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545019 Share on other sites More sharing options...
gizmola Posted May 19, 2008 Share Posted May 19, 2008 That's not a bad idea. Again I'd assume not foolproof - but I like it more than writing a value to that file and checking it. Is it possible to delete a file from PHP? More importantly, is it possible for a script to delete itself? That way, I could attempt to delete the install script - and if that doesnt work write the file. If I can't delete my install file, neither can anyone else delete my created file. The more I think about it, the more I like it. Thanks guys Any other thoughts welcome Yes it is possible -- but a really bad idea in my opinion. From a security issue most people don't want to allow the writing and deleting of files from webspace, as this is a good way to get exploited. Some systems require this in order to allow full functionality (Joomla/Mambo for example) but they are CMS systems with modules. You might also consider using sqllite which is a really lightweight embedded db that comes with PHP, and would require no installation by the end users. Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545031 Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 another idea i have. Is to use fwrite and overwrite the script. And replace it with an echo. Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545035 Share on other sites More sharing options...
deadonarrival Posted May 19, 2008 Author Share Posted May 19, 2008 Yes it is possible -- but a really bad idea in my opinion. From a security issue most people don't want to allow the writing and deleting of files from webspace, as this is a good way to get exploited. Some systems require this in order to allow full functionality (Joomla/Mambo for example) but they are CMS systems with modules. You might also consider using sqllite which is a really lightweight embedded db that comes with PHP, and would require no installation by the end users. It's imperative that the user be able to install the script with no required admin input. I'm assumiing that they have a fully set up web server, but (unless there is a problem) I want a non-technical user to be able to install the script 9 times out of 10. SQLlite might be an option - is there any performance loss once you get into bigger databases or other problems to watch for? I want the application very scaleable. And this will also be a modulated CMS/framework to an extent. On the other hand, SQLlite might be a option for storing settings and the installation process. Thanks for the suggestion Quote Link to comment https://forums.phpfreaks.com/topic/106343-installation-of-a-php-script-note-this-is-php-help-not-php-installation/#findComment-545071 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.