jamesm6162 Posted December 11, 2009 Share Posted December 11, 2009 Hi I have a local installation of Apache + PHP on my Windows 7 machine. When setting the SMTP directive in the php.ini file to some remote server, the php server ignores it and instead still tries to access localhost as an SMTP server. The remote server I am trying to use does exist, and it works on my other machine, but for some reason, even after several server and computer restarts it simply ignores the value I set. It definitely is the correct php.ini file as it show it in the phpinfo() as the loaded configuration file and further, any other settings that I change in there are effective. What could possibly cause this? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2009 Share Posted December 11, 2009 Without seeing the error message, your code, or confirmation that the setting is syntactically correct (php.ini settings that contain invalid syntax do display as what they are set as but aren't actually used) best guess is that your code is not actually dependent on the php.ini SMTP setting, such as when you use one of the php mailer classes. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975661 Share on other sites More sharing options...
jamesm6162 Posted December 12, 2009 Author Share Posted December 12, 2009 I changed my php.ini setting from SMTP = localhost to SMTP = some.smtp.server.net My code is actually dependent on the SMTP setting, because I am using the mail() function on Windows and I don't have an SMTP server on my machine, so I get the error: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() My port setting I left at 25 and sendmail_path is commented out. phpinfo() also shows my SMTP as localhost. And the value (and syntax) is exactly the same as on my other machine that is still running XP, where it works fine. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975906 Share on other sites More sharing options...
cags Posted December 12, 2009 Share Posted December 12, 2009 Check your phpinfo() for "Configuration File (php.ini) Path" and make sure that it points to the file that you actually changed (sometimes you can end up with more than one php.ini). Did you restart Apache after changing it (that's required to make changes take effect). Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975925 Share on other sites More sharing options...
jamesm6162 Posted December 12, 2009 Author Share Posted December 12, 2009 The configuration file path says c:\windows as always, but the "loaded configuration file" just below it shows the correct file, the one I am using. And there isn't a php.ini file in the c:\windows directory. I have restarted my server and computer several times already. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975928 Share on other sites More sharing options...
cags Posted December 12, 2009 Share Posted December 12, 2009 Oops, sorry my bad, I of course meant loaded configuration file, just copied the wrong one. Are you actually using the plain old mail function or are you, as suggested by PFMaBiSmAd, using a different mailer class. If the former what happens if you echo ini_get('SMTP'); just before calling it? If the latter I believe they generally have their own internal settings which can be changed in their configurations. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975932 Share on other sites More sharing options...
PFMaBiSmAd Posted December 12, 2009 Share Posted December 12, 2009 What exact method did you use to install PHP? The .zip package, the .msi installer package, or one of the all in one xAMP packages? I'm going to guess the .msi installer? If so, please be advised that the .msi installer is retarded, should not be used by anyone, and it places a bunch of setting in the Windows registry that override the php.ini settings. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-975965 Share on other sites More sharing options...
jamesm6162 Posted December 13, 2009 Author Share Posted December 13, 2009 Well I installed PHP using the plain old Zip package. I am using the plain old mail() function. I have reverted back to placing the php.ini file in the c:\windows directory and removing any PHPIniDir settings in the httpd.conf files. I have replaced the php.ini file with one I got from a wamp installation on my other machine which seems to work fine. I am currently trying to figure out the difference between the two ini files that might cause the problem. However things are going difficult as a mere restart of the Apache server doesn't seem to always refresh the ini file for some reason. Quote Link to comment https://forums.phpfreaks.com/topic/184810-phpini-smtp-setting-ignored/#findComment-976274 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.