pugs1501 Posted March 26, 2008 Share Posted March 26, 2008 I was wondering how one would go about running Linux commands through a php script. Like the move command with a certain chmod and chown settings. Kind of like a ftp connection started from the php script. The reason I am looking for this is because my website keeps getting hacked and destroyed because of the permissions I have to put on the folders so users can upload their files through the administration area. So I was thinking of setting up the upload script to upload the files to the server in a writable folder that is not web viewable and then in the same php script use another users credentials to move the files to the web accessible folder that has web read only access and another users write access. Thank you in advance for any help you may be able to give. Quote Link to comment https://forums.phpfreaks.com/topic/97890-use-php-for-linux-commands/ Share on other sites More sharing options...
Caesar Posted March 26, 2008 Share Posted March 26, 2008 See system() or shell_exec() Quote Link to comment https://forums.phpfreaks.com/topic/97890-use-php-for-linux-commands/#findComment-500864 Share on other sites More sharing options...
MadTechie Posted March 26, 2008 Share Posted March 26, 2008 PHP have all the command you have asked about, you could also use system() or exec() as for the reason, i suggest you look at the design of the system, as you could fix access problems via .htaccess and http.conf and filtering user input, i have a system that allowed public users to upload anything, without any problems, this includes users attempting to upload php scripts and trying to use them.. Quote Link to comment https://forums.phpfreaks.com/topic/97890-use-php-for-linux-commands/#findComment-500867 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.