ChrisMartino Posted September 5, 2010 Share Posted September 5, 2010 Hey there, Thanks for taking the time to read my thread, well basically I'm in a bit of a dilemma. I've got a string in PHP containing the contents of a file I would like to be created and I have a method of sending the command to the remote server like so: $Connection->exec('ps aux'); Now my issue is I am unaware of any file editors via command like that don't have some sort of user prompt I've scoured Google for hours searching for the best possible method for this but all the file editors aren't simply processed by one line commands and edited in that same command e.g Create File -> Write File -> Close File Is there no possible means of doing that via one line command?. Here is my string I wish to be written to the file. $RestartFile = "#!/bin/bash export SERVER_PATH=/home/client".$Server['server_owner']."/".$Server['server_id']." cd $SERVER_PATH while [ true ]; do ./server".$Server['server_id']." & done"); Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/212573-create-file-in-linux-and-write-to-it-via-php/ Share on other sites More sharing options...
systemick Posted September 5, 2010 Share Posted September 5, 2010 I'm not clear what you are trying to do here. Are you trying to send a file to a remote server or simply to write a file onto the file system on which your web server is located? ?I'm not clear why you need to use an editor to write this file? Quote Link to comment https://forums.phpfreaks.com/topic/212573-create-file-in-linux-and-write-to-it-via-php/#findComment-1107517 Share on other sites More sharing options...
Zane Posted September 5, 2010 Share Posted September 5, 2010 I'm no Linux guru, but I know you can create a file with the touch command. Maybe that's what you're looking for. Quote Link to comment https://forums.phpfreaks.com/topic/212573-create-file-in-linux-and-write-to-it-via-php/#findComment-1107524 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.