473,785 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php script behaves differently when it run in command line

I found that the php script behaves differently when it run in command
line rather than runing over web server.

Program includes the code like

<?php

function send_email($fro m_address, $to_address, $bcc_address,
$subject, $msg, $attachments,$r eminder_id) {
$headers = ...;
....
mail($to_addres s, $subject, $msg, $headers);
...
}

#main body of code here to grap info from database and call
send_mail() function here
...
send_email($new arry[FROM_ADDRESS], $newarry[TO_ADDRESS], $newarry
[BCC_ADDRESS], $newarry[SUBJECT], $newarry[BODY],$attachments,
$newarry[ID]);

?>
I can not use lynx since it doesn't support https on my machine.
The values are from database and feed in send_mail() function which
will form the body message and header and pass to php mail()
function. The problem is that "mail($to_addre ss, $subject, $msg,
$headers)" can not access the values passed over to it when i use
'php' command to run the script. But I can use 'print' to print out
all the values but mail()function just can't get them.
However, this program works fine when I use broswer to access it.

Any help will be greatly appreciated.
Runner

Apr 4 '07 #1
1 1566
*** rc*******@yahoo .com escribió/wrote (3 Apr 2007 19:21:45 -0700):
I found that the php script behaves differently when it run in command
line rather than runing over web server.
That's right. Differences include access to $_SERVER variables and
different PHP settings.

It's hard to tell anything from your code. Try to isolate the line that
doesn't behave properly.

To begin with, find out if this code does work:
<?php

mail('your@emai l', 'Test', 'Test');

?>

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Apr 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3432
by: Christoph | last post by:
Hi, I wrote a php script, which calls with the system-command the commandline tool "transcode". transcode is a tool to convert audio and video files in different codecs. When I call the php-script in the commandline like this: php myScripct.php it works fine and transcode render my video files well. But when I run the php-script as a cron job like "5 * * * root php /path/myscript" the script behaves different. It starts the system call...
4
2833
by: David Van Horn | last post by:
As a shell script, the following program works as expected. --------------------------------------- #! /usr/bin/sh echo '<html><? print 1 ?></html>' | php --------------------------------------- However, when run as a CGI script, invoking php causes the php interpreter to load the current file (ie, the sh script), which
3
1985
by: Faith | last post by:
Hi all, I have a serious problem that I am not sure whether its a bug in the Microsoft Visual C++ or something that I am doing wrong. The problem is (as noted in the Subject) is that my program behaves differently when I insert a break point in a certain function (or I step into it) I get different results. Its the same input and the same code!! I do not think that adding a source code here will help since its fairly a long program, but I...
15
2469
by: Joe Weinstein | last post by:
Hi. Below is a simple JDBC program to insert and extract a numerical value. When ResultSet.getDouble() is called, the same program produces different output on solaris than it does on Linux. I would be grateful for any discussion of this! thanks, Joe Weinstein at BEA Systems Results on Linux Box -----------------------------------------------------------------------
6
1868
by: tom c | last post by:
I create 2 data OleDbDataAdapters, one with the wizard, and one in code. I know the adapter created in code is OK because I use it to fill a data table. However, when I try to use the same SQL insert statement in the two adapters, the adapter created with the wizard works fine, but the adapter created in code gives me an error "Object reference not set to an instance of an object". The code is below. What am I doing wrong? ...
11
1439
by: Michele Simionato | last post by:
The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? TIA, Michele Simionato
2
3386
by: Jim | last post by:
Hello, I need a program that will traverse a directory tree to ensure that there are unix-style line endings on every file in that tree that is a text file. To tell text files from others I want to use the unix "file" command (Python's "mimetypes" is not so good for me). But I am stuck on something about getting that output, and I'd greatly appreciate any pointers.
51
4162
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under Command Prompt or Browser or some other application? Ojas.
0
1026
by: souvickm | last post by:
I have developed an exe to cut image files from a dumped folder and paste them in some other folder(categorized into subfolders) on a different machine. I have also coded to generate a text file at the end of the operation to provide a kind of report. The exe also reports the error no. & procedure name through the same text file (when it encounters any error/exception) Now, the exe performs all the reqd tasks properly when run but when I try to...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.