October 15, 201114 yr comment_9696 I have successfully set up automatic database backups and have also set up and successfully tested sending an email thanks to the great instructions found here: http://wiki.uniformserver.com/index.php/5....Database_Backup. I have added a section to the bottom of the db_backup.php file that will email a copy of the 7z file that was just created. However the db_backup.php file does not know how to use the php mail function (which I have configured in msmtprc.ini file.) I can use the mail function within any page the exists in the www directory. (As an alternative I was going to add a Header redirection to the bottom of the db_backup.php file and send it to another php file in the www directory that would send the email. However since the db_backup.php file outputs text to the screen and its log file, the header redirection will not work.) Does anyone have any suggestions on how I can get the db_backup.php file to recognize the php mail function? Report
October 15, 201114 yr comment_9697 To use the PHP mail function in CLI scripts the path to msmtp requires adding to the PHP CLI configuration file as follows: Note: Depending on where you installed Uniform Server your paths will be different Open file: C:\UniServer\usr\local\php\php.iniLocate this line: sendmail_path = "C:/UniServer/msmtp/msmtp.exe --file=C:/UniServer/msmtp/msmtprc.ini -t" Copy the above line and paste it at the end of file: C:\UniServer\usr\local\php\cli.ini Note: Paths in file C:\UniServer\usr\local\php\php.ini are not updated when servers are moved for example to another folder or USB stick. If you want portability the run_location_tracker() function requires modification as follows: Edit file: C:\UniServer\unicon\main\includes\functions.php Locate these lines: file_search_replace(USF_PHP_INI,$s_str,US_BASE_F); // Update PHP ini file_search_replace(USF_PHP_INI_PROD,$s_str,US_BASE_F); // Update PHP production ini file_search_replace(USF_PHP_INI_DEV,$s_str,US_BASE_F); // Update PHP development ini To the end of the above lines add the following line: file_search_replace(USF_PHP_INI_CLI,$s_str,US_BASE_F); // Update PHP cli ini All the bestRic Report
October 15, 201114 yr Author comment_9698 Thank you Ric! You are a star! And going the extra mile with the functions.php tip. You have made my day. Thank you very much. Devo (A slight correction for anyone else learning from this thread: cli.ini filename is actually php-cli.ini) Report
October 16, 201114 yr comment_9700 Thanks for the update and correction.Please note added the above to UniServer 7.1.12-Orion All the bestRic Report
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.