[PHP] Re: Timing on an internal email
You can have the php script written so that it performs the functions you want then setup a cron job to run that script at a given time or interval. I do this with daily and weekly operations now. It works great. Alex Hogan wrote: Hi all, I want to set up a delivery date and time for emails to be sent. (I'm using phpmailer) I'm coming up blank on how to do this. I thought that I could put a timing condition on a page that I know will be accessed daily that would look for the date then call the function that will do the mail outs on the appropriate date, but there has to be a better way. Is this something that I'll have to do outside of php? alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remote script execution
I had SSH setup to require passwords when logging in, so that is why I was having trouble trying to figure out how to get it to work. I now have the two servers in question setup to auto login based on their keys. I have successfully run the remote script from the CLI on server 1. Now I just need to get it integrated into my GUI. A huge thanks to Warren and the others that have replied to my post. This is why I have become an adimant supporter of Linux, Apache, Mysql, PHP (LAMP), and Open Source Technology in general. The community that is in place for support and new ideas is awesome. I just hope that I can become such a help in the future. Thanks again. Sean Vail, Warren wrote: Ignoring PHP for a moment; to execute a string of commands on a remote machine using ssh you would execute the following; Prompt>ssh -l user "ps -ef|grep edit;cd /usr/local/bin;ls -la" Which would result in showing any edit processes, followed by a listing of the contents of the /usr/local/bin directory. Notice that I did not include a password (this is not needed if the two servers have already exchanged security keys), and as near as I know, cannot be supplied unless you are there to type it in on a tty type device, so be sure to get the keys setup properly. You will also need the client program "ssh" installed on the originating machine, and the daemon "sshd" installed on the remote machine, but then you probably knew that ;-) In PHP simply; $cmd = "ssh -l user \"ps -ef|grep edit;cd /usr/local/bin;ls -la"; $rtn = exec($cmd, $responselines); http://us4.php.net/manual/en/function.exec.php $responselines is now an array containing lines of output from the commands. Hope this helps, Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remote script execution
Warren, I use ssh on all of my servers for logging in remotely. My next question would be, how do I connect to the remote server to run commands through PHP? Do I need to setup a socket or something? Could you provide me a pseudo sample or maybe point me to some docs. I've never had to do this type of thing in PHP before and I want to make sure I do it right. Thanks. Sean Vail, Warren wrote: I've done a number of these and the choice depends on many things but perhaps the biggest factor is; Is server 1 and server 2 behind the same firewall or are they exposed to the internet? Behind a firewall you can probably get away with running any one of the following commands to remotely execute your script on server 2, from server 1; Rexec, rsh, rpc, just to name 3. The client part of the protocol is required on server 1 and the daemon part needs to be running on server 2. Across the open internet, be very careful here, I would think the choice would be ssh (secure shell). This has several nice features that could be useful internally as well. You start out by exchanging encryption keys between the two servers and because of this handshake, each server trusts the other in a way that the correct execution permissions can be established on server 2, and of course the data sent between the servers is encrypted rendering it virtually useless to third parties. Google for ssh for more info. Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remote script execution
Scenario: Server 1 is a LAMP webserver Server 2 is an email server I have a php script on server 2 that creates user accounts. It works great when your logged into the server and running it from the CLI. I have a GUI on server 1 that is used to input user info into a database. Question: What I'd like to do is have server 1 call the script on server 2 and have server 2 return a variable back to server 1 to be displayed and ultimately entered into the database. If you understand my rambling above and have any insight into how to get this accomplished, it would be greatly appreciated. Thank you. Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remote script execution
Scenario: Server 1 is a web server Server 2 is an email server I have a php script on Server 2 that creates user accounts from the CLI just fine. I have a GUI on Server 1 with several forms for user data stored in a database. What I'm trying to do is have Server 1 call the script on Server 2 and have Server 2 return the UID, GID, and HOME path back to the GUI on Server 1. I have the UID,GID, and HOME parsed into a comma separated string but can't for the life of me get Server 1 to call the script or get Server 2 to return the variable. Does anyone have any insight on how to accomplish this? Any help would be appreciated. Thank you. Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remote script execution
Scenario Server 1 is a LAMP webserver. Server 2 is an email server. I have a php script on Server 2 that creates user accounts and echos the UID, GID, and HOME. It works great when your logged into Server 2 and run it from the CLI. What I'm trying to do is have my GUI on Server 1 call the script on Server 2 and have Server 2 return the variable back to Server 1 for processing. Is that possible? Any help would be appreciated. Thank you. Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php