Jump to content

Create file in Linux and write to it VIA PHP.


ChrisMartino

Recommended Posts

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.

Link to comment
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.