NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Problems with PHP mail(),php.ini and SMTP


Joined: 13 Nov 2004
Posts: 12
Reply with quote
Hello,
I'm trying to use the PHP mail() function. However, I'm getting an error saying PHP.INI is not configured properly. I have a few questions with regards to this:
I'm running PHPED ver3.3.3 (Build 3395) on Win XP with Apache Server
Questions
1. There appears to be multiple PHP.INI on the system - one in PHPED\PHP directory, one in Apache directory. (There is none in the windows directory- I read on the net PHP checks windows directory for PHP.INI) - So where should the PHP.INI file be?

2. Are these the required lines in the PHP.INI file
[mail function]
SMTP = localhost
smtp_port = 25

3. In windows XP is there a default SMTP server? My email software is Outlook express - will the PHP mail() function use this email software to send out email or do I need to get some other software package to make the function work?

Any help would be much appreciated
Thanks in advance
JS
View user's profileFind all posts by JSSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
if you run php using SRV server, phped/php/php.ini is used
if you run apache/php4 module, apache/php.ini is used
if you run apache/php4 cgi, apache/php/php.ini is used.

We do not install php.ini into windows directory.

check phpinfo() results, they show path to php.ini in the topmost header.

Regarding mail configuration under Windows, you probably have to ask php forum boards. This one is intended for phped IDE and other NuSphere products.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Dec 2004
Posts: 3
Location: The Netherlands
Reply with quote
Hallo,

your problem is that the smtp server is missing.
If you work with apache you need to install one. Maybe you can use the smtp server settings from you ISP.


See you!

Olaf



View user's profileFind all posts by olafSend private message


Joined: 13 Nov 2004
Posts: 12
Reply with quote
olaf,
Thank you very much for the reply - Don't know much about the SMTP servers - don't want to screw up my email with the ISP. But the function works correctly if I upload the test code to my host site. So I thought I would just use that for now and come back and setup the SMTP server on my local box at another time.
Thanks again
JS
View user's profileFind all posts by JSSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
you may want to use the same SMTP server running on the production server.
Note, when your code runs on that server, it uses localhost to access the server, while on the dev. machine the server should be accessed with its real IP.
Alternatively you can debug the code remotely, just in place.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Dec 2004
Posts: 3
Location: The Netherlands
Reply with quote
This happens to a lot of people which are working with a local server on windows. There is by default no mailserver on windows. There are three possibilities, maybe just 2.5 Smile
1. install (if you like) the smtp option from IIS then you have to access some domain to to take care of the DNS
2.
a: if you have acces or working on the network from you ISP (bridged mode or something) than try to use the smtp settings from your ISP.
b: if not or in case of relaying problems, use one of the smtp connectors on the internet to get a connection with the most (other) smtp servers.
3. install postcast mailserver (or other products) to get regular mail access to the outside world.
4. (oops) maybe nusphere can handle this....Smile
View user's profileFind all posts by olafSend private message
I'm a newbie - sounds too complicated


Joined: 13 Nov 2004
Posts: 12
Reply with quote
DDimitrie,
Can you expand on your answer. Am I excuting the code on my dev machine or the production server?
I'm pretty new to programming - so I decided to setup local apapche and develop locally - get it working and upload to production server.
You are suggesting using the production server during development - not sure how debugging would work?
Thanks
JS
View user's profileFind all posts by JSSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
You are suggesting using the production server during development - not sure how debugging would work?

Actually you can and it works, but I did not recommend this way. It's your own risk to install debugger on to the production server.
All I meant is to use SMTP server runnign on your production host. No more no less. It's not so hard, you only have to specify appropriate IP in the settings (php.ini) or specify it in the function arguments (depending on the way you use mail-related functions or classes).
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Problems with PHP mail(),php.ini and SMTP
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic