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.

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.