[PHP] Missing Env. Variables when called by AT Scheduler
We regularly send out massive mail blasts to our customers. Recently several mail blasts failed to transmit. After a serious amount of research we found the snippet of code below to be the place where it was breaking down. The issue it seems is that the Environment Variables HOST and SERVER_NAME are sometimes not returning true when executed from the Linux AT scheduler. (using atq commands). doing a php -i from the command line returns the correct values, as does putting in a php info command at the top of the script and opening it from a browser. Does anyone have any clues about why a script called from the AT scheduler would be unable to detect what server it is on and behave appropriately? function send_mail($subject, $subject_name, $from, $email, $customer_name, $html_message, $text_message, $customer_id=0) { if($_SERVER['HOST'] == 'domain.com' || $_SERVER['SERVER_NAME']=='customer.domain.com') { global $mail; if(!is_object($mail)) { $mail = create_mail(); } } else { // If on staging server don't send emails to any address outside company if(!stristr($email, '@domain.com')) return true; $mail = Mail::factory('mail'); Thanks, Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php CLI Parser not working
Did you check what Jim suggested, as well, about short_open_tags? If your scripts use PHP tags like this: ? instead of like this: ?php Yes, that was the problem - it was Off in: /etc/php5/cli/php.ini we had checked the one in: ./etc/php5/apache2/php.ini and it was On there so we thought something else was wrong. Thanks to you both for your help. - Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php CLI Parser not working
Daniel Brown wrote: On Tue, Jul 29, 2008 at 2:19 PM, JJB [EMAIL PROTECTED] wrote: We recently rebuilt a webserver and upgraded it to opensuse 10.3. Now, when our webdev people run command line php scripts all of the included files are being output to the terminal instead of parsed. How are the scripts being run from the CLI? As shell scripts with this as the following line: #!/path/to/php -or- #!/bin/env php or by using the command 'php script.php' from the command line? What do you see when, from the command line, you issue the command 'php -v' ? Hi Daniel, We are running like: php mailscript.php The version: php-v PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Dec 12 2007 03:51:56) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php CLI Parser not working
We recently rebuilt a webserver and upgraded it to opensuse 10.3. Now, when our webdev people run command line php scripts all of the included files are being output to the terminal instead of parsed. Can anyone make a good suggestion for what might be going on here? My Linux admin is out today, if someone can give me a clue about what might be the problem, then perhaps I can figure out how to fix it. - Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good PHP/MySql starter book?
Hello, Can anyone recommend a good book for getting started with PHP/MySql from the perspective of writing some basic intranet applications? - Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php