NotionCommotion Posted November 20, 2017 Share Posted November 20, 2017 I am using PHP as a small embedded webserver on a RPi. Similar to how apt-get updates packages, I desire a simple means to ensure that the PHP script (not the PHP version) is up to date. I will be able to come up with some means to initiate whatever is needed to update the scripts (i.e. a shell script for the user, a cron job, etc). Git is not installed and not desired. Composer seems excessive for such a small site (but maybe is a good long term solution if it grows?). I could just scp and replace it, but there is a text config file which shouldn't be overwritten. Any recommendations? Thank you Quote Link to comment Share on other sites More sharing options...
requinix Posted November 20, 2017 Share Posted November 20, 2017 Could just have the PHP script update itself (or use another script). file_put_contents(__FILE__, file_get_contents("wherever")); Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 20, 2017 Author Share Posted November 20, 2017 Thanks requinix but doesn't address preventing the overwriting of site specific files (like the config file I described). I obviously can read it into memory, overwrite all files, and then update anything that needs to be persistent, but thought there might be a smarter way to do so. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted November 20, 2017 Share Posted November 20, 2017 I think Requinix' response was spot on. You write the script that your installation then downloads and saves and then you transfer control to that "update" script to do whatever needs to be done, as you define it. Quote Link to comment Share on other sites More sharing options...
kicken Posted November 20, 2017 Share Posted November 20, 2017 It sounds like you maybe want to do like composer does and create a phar file containing your PHP code then just update that when necessary. Stuff that shouldn't be overwritten would exist outside the phar file so it's not affected. 1 Quote Link to comment 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.