Conjurer Posted September 25, 2006 Share Posted September 25, 2006 I updated to run PHP 5.16 on Apache 2.0.54 - I have tested it and it is running, I get the right version using phpinfo() and it the php files load in the browser fine.BUT, I am having trouble with mail. I used to get the mail function to work under php 4 using the following in the PHP.ini file:[quote][mail function]; For Win32 only.SMTP = mail.xyz.net; For Win32 only.sendmail_from = myacctname@xyz.net[/quote]Now when I try to process a feedback form that was working under PHP4 I am getting the following warning/error:[quote]Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Documents and Settings\RLane\My Documents\Web Sites\Localhost\InDevelopment\Wellington\Source\04\processfeedback.php on line 14[/quote]The code in processfeedback.php is as follows:[code]//create short variable names $name=$_POST['name']; $email=$_POST['email']; $feedback=$_POST['feedback']; $toaddress = 'myacctname@xyz.net'; $subject = 'Feedback from web site'; $mailcontent = 'Customer name: '.$name."\r\n" .'Customer email: '.$email."\r\n" ."Customer comments: \r\n".$feedback."\r\n"; $fromaddress = 'From: myacctname@xyz.net'; mail($toaddress, $subject, $mailcontent, $fromaddress);[/code]Any ideas what I need to modify to make it work? :o Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/ Share on other sites More sharing options...
wildteen88 Posted September 25, 2006 Share Posted September 25, 2006 Make sure you have restarted the server when you changed the SMTP server details in the php.ini Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98386 Share on other sites More sharing options...
Conjurer Posted September 25, 2006 Author Share Posted September 25, 2006 Yep, I restarted Apache and am still getting the error. Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98394 Share on other sites More sharing options...
wildteen88 Posted September 25, 2006 Share Posted September 25, 2006 Can you confirm that php in using the correct php.ini by running the phpinfo function in a php script.Does the Configuration File (php.ini) Path refelect the correct path to the php.ini you are editing? If it does the does the SMTP (scroll down until you find SMTP in the PHP Core section) row reflect the changes you made to php.ini? If they dont then PHP is not using the php.ini file you're edting. Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98402 Share on other sites More sharing options...
Conjurer Posted September 25, 2006 Author Share Posted September 25, 2006 Sigh!Not sure... I searched for php.ini I only find one --- located here: c:/php5/php.iniC:/php5 is in my path as in: path= %SystemRoot%\system32;%SystemRoot%;C:\PHP5; and then other junk.I rebooted the system and started Apache. I ran PHP INFO and get the output below - I do see in there it is looking for php.ini in the C:\windows - so maybe it isn't finding my ini file?? The latest recommendations were to keep the ini in the program file and add a path. Any ideas from this on how to fix?PHP LogoPHP Version 5.1.6System Windows NT TOWERDESKUNIT 5.1 build 2600Build Date Aug 23 2006 16:31:18Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"Server API Apache 2.0 HandlerVirtual Directory Support enabledConfiguration File (php.ini) Path C:\WINDOWSPHP API 20041225PHP Extension 20050922Zend Extension 220051025Debug Build noThread Safety enabledZend Memory Manager enabledIPv6 Support enabledRegistered PHP Streams php, file, http, ftp, compress.zlibRegistered Stream Socket Transports tcp, udpRegistered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*Zend logo This program makes use of the Zend Scripting Language Engine:Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend TechnologiesPHP CreditsConfigurationPHP CoreDirective Local Value Master Valueallow_call_time_pass_reference On Onallow_url_fopen On Onalways_populate_raw_post_data Off Offarg_separator.input & &arg_separator.output & &asp_tags Off Offauto_append_file no value no valueauto_globals_jit On Onauto_prepend_file no value no valuebrowscap no value no valuedefault_charset no value no valuedefault_mimetype text/html text/htmldefine_syslog_variables Off Offdisable_classes no value no valuedisable_functions no value no valuedisplay_errors On Ondisplay_startup_errors Off Offdoc_root no value no valuedocref_ext no value no valuedocref_root no value no valueenable_dl On Onerror_append_string no value no valueerror_log no value no valueerror_prepend_string no value no valueerror_reporting no value no valueexpose_php On Onextension_dir C:\php5 C:\php5file_uploads On Onhighlight.bg #FFFFFF #FFFFFFhighlight.comment #FF8000 #FF8000highlight.default #0000BB #0000BBhighlight.html #000000 #000000highlight.keyword #007700 #007700highlight.string #DD0000 #DD0000html_errors On Onignore_repeated_errors Off Offignore_repeated_source Off Offignore_user_abort Off Offimplicit_flush Off Offinclude_path .;C:\php5\pear .;C:\php5\pearlog_errors Off Offlog_errors_max_len 1024 1024magic_quotes_gpc On Onmagic_quotes_runtime Off Offmagic_quotes_sybase Off Offmail.force_extra_parameters no value no valuemax_execution_time 30 30max_input_time -1 -1open_basedir no value no valueoutput_buffering 0 0output_handler no value no valuepost_max_size 8M 8Mprecision 14 14realpath_cache_size 16K 16Krealpath_cache_ttl 120 120register_argc_argv On Onregister_globals Off Offregister_long_arrays On Onreport_memleaks On Onreport_zend_debug On Onsafe_mode Off Offsafe_mode_exec_dir no value no valuesafe_mode_gid Off Offsafe_mode_include_dir no value no valuesendmail_from no value no valuesendmail_path no value no valueserialize_precision 100 100short_open_tag On OnSMTP localhost localhostsmtp_port 25 25sql.safe_mode Off Offtrack_errors Off Offunserialize_callback_func no value no valueupload_max_filesize 2M 2Mupload_tmp_dir no value no valueuser_dir no value no valuevariables_order EGPCS EGPCSxmlrpc_error_number 0 0xmlrpc_errors Off Offy2k_compliance On Onzend.ze1_compatibility_mode Off Offapache2handlerApache Version Apache/2.0.54 (Win32) PHP/5.1.6Apache API Version 20020903Server Administrator info@mydomain.comHostname:Port localhost:80Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100Timeouts Connection: 300 - Keep-Alive: 15Virtual Server NoServer Root C:/Program Files/Apache Group/Apache2Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_access mod_actions mod_alias mod_asis mod_auth mod_autoindex mod_cgi mod_dir mod_env mod_imap mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_userdir mod_php5Directive Local Value Master Valueengine 1 1last_modified 0 0xbithack 0 0Apache EnvironmentVariable ValueHTTP_HOST localhostHTTP_USER_AGENT Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7HTTP_ACCEPT text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5HTTP_ACCEPT_LANGUAGE en-us,en;q=0.5HTTP_ACCEPT_ENCODING gzip,deflateHTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7HTTP_KEEP_ALIVE 300HTTP_CONNECTION keep-alivePATH C:\WINDOWS\system32;C:\WINDOWS;C:\PHP5;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\WINDOWS\system32\WBEM;C:\Program Files\QuickTime\QTSystem\SystemRoot C:\WINDOWSCOMSPEC C:\WINDOWS\system32\cmd.exePATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSHWINDIR C:\WINDOWSSERVER_SIGNATURE <address>Apache/2.0.54 (Win32) PHP/5.1.6 Server at localhost Port 80</address>SERVER_SOFTWARE Apache/2.0.54 (Win32) PHP/5.1.6SERVER_NAME localhostSERVER_ADDR 127.0.0.1SERVER_PORT 80REMOTE_ADDR 127.0.0.1DOCUMENT_ROOT C:/Documents and Settings/RLane/My Documents/Web Sites/LocalhostSERVER_ADMIN info@mydomain.comSCRIPT_FILENAME C:/Documents and Settings/RLane/My Documents/Web Sites/Localhost/InDevelopment/Wellington/Source/TMP4gfl65w2h.phpREMOTE_PORT 1057GATEWAY_INTERFACE CGI/1.1SERVER_PROTOCOL HTTP/1.1REQUEST_METHOD GETQUERY_STRING no valueREQUEST_URI /InDevelopment/Wellington/Source/TMP4gfl65w2h.phpSCRIPT_NAME /InDevelopment/Wellington/Source/TMP4gfl65w2h.phpHTTP Headers InformationHTTP Request HeadersHTTP Request GET /InDevelopment/Wellington/Source/TMP4gfl65w2h.php HTTP/1.1Host localhostUser-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7Accept text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5Accept-Language en-us,en;q=0.5Accept-Encoding gzip,deflateAccept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive 300Connection keep-aliveHTTP Response HeadersX-Powered-By PHP/5.1.6Keep-Alive timeout=15, max=100Connection Keep-AliveTransfer-Encoding chunkedContent-Type text/html; charset=ISO-8859-1bcmathBCMath support enabledcalendarCalendar support enabledcom_dotnetCOM support enabledDCOM support disabled.Net support enabledDirective Local Value Master Valuecom.allow_dcom 0 0com.autoregister_casesensitive 1 1com.autoregister_typelib 0 0com.autoregister_verbose 0 0com.code_page no value no valuecom.typelib_file no value no valuectypectype functions enableddatedate/time support enabledTimezone Database Version 2006.1Timezone Database internalDefault timezone America/Los_AngelesDirective Local Value Master Valuedate.default_latitude 31.7667 31.7667date.default_longitude 35.2333 35.2333date.sunrise_zenith 90.583333 90.583333date.sunset_zenith 90.583333 90.583333date.timezone no value no valuedomDOM/XML enabledDOM/XML API Version 20031129libxml Version 2.6.22HTML Support enabledXPath Support enabledXPointer Support enabledSchema Support enabledRelaxNG Support enabledftpFTP support enabledhashhash support enabledHashing Engines md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5iconviconv support enablediconv implementation "libiconv"iconv library version 1.9Directive Local Value Master Valueiconv.input_encoding ISO-8859-1 ISO-8859-1iconv.internal_encoding ISO-8859-1 ISO-8859-1iconv.output_encoding ISO-8859-1 ISO-8859-1libxmllibXML support activelibXML Version 2.6.22libXML streams enabledodbcODBC Support enabledActive Persistent Links 0Active Links 0ODBC library Win32Directive Local Value Master Valueodbc.allow_persistent On Onodbc.check_persistent On Onodbc.default_db no value no valueodbc.default_pw no value no valueodbc.default_user no value no valueodbc.defaultbinmode return as is return as isodbc.defaultlrl return up to 4096 bytes return up to 4096 bytesodbc.max_links Unlimited Unlimitedodbc.max_persistent Unlimited UnlimitedpcrePCRE (Perl Compatible Regular Expressions) Support enabledPCRE Library Version 6.6 06-Feb-2006ReflectionReflection enabledVersion $Id: php_reflection.c,v 1.164.2.33 2006/03/29 14:28:42 tony2001 Exp $sessionSession Support enabledRegistered save handlers files userRegistered serializer handlers php php_binary wddxDirective Local Value Master Valuesession.auto_start Off Offsession.bug_compat_42 On Onsession.bug_compat_warn On Onsession.cache_expire 180 180session.cache_limiter nocache nocachesession.cookie_domain no value no valuesession.cookie_lifetime 0 0session.cookie_path / /session.cookie_secure Off Offsession.entropy_file no value no valuesession.entropy_length 0 0session.gc_divisor 100 100session.gc_maxlifetime 1440 1440session.gc_probability 1 1session.hash_bits_per_character 4 4session.hash_function 0 0session.name PHPSESSID PHPSESSIDsession.referer_check no value no valuesession.save_handler files filessession.save_path no value no valuesession.serialize_handler php phpsession.use_cookies On Onsession.use_only_cookies Off Offsession.use_trans_sid 0 0SimpleXMLSimplexml support enabledRevision $Revision: 1.151.2.22 $Schema support enabledSPLSPL support enabledInterfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubjectClasses AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueExceptionstandardRegex Library Bundled library enabledDynamic Library Support enabledInternal Sendmail Support for Windows enabledDirective Local Value Master Valueassert.active 1 1assert.bail 0 0assert.callback no value no valueassert.quiet_eval 0 0assert.warning 1 1auto_detect_line_endings 0 0default_socket_timeout 60 60safe_mode_allowed_env_vars PHP_ PHP_safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATHurl_rewriter.tags a=href,area=href,frame=src,form=,fieldset= a=href,area=href,frame=src,form=,fieldset=user_agent no value no valuetokenizerTokenizer Support enabledwddxWDDX Support enabledWDDX Session Serializer enabledxmlXML Support activeXML Namespace Support activelibxml2 Version 2.6.22xmlreaderXMLReader enabledxmlwriterXMLWriter enabledzlibZLib Support enabledStream Wrapper support compress.zlib://Stream Filter support zlib.inflate, zlib.deflateCompiled Version 1.2.3Linked Version 1.2.3Directive Local Value Master Valuezlib.output_compression Off Offzlib.output_compression_level -1 -1zlib.output_handler no value no valueAdditional ModulesModule NameEnvironmentVariable ValueALLUSERSPROFILE C:\Documents and Settings\All UsersCLASSPATH C:\Program Files\Java\j2re1.4.1_02\lib\ext\QTJava.zipCommonProgramFiles C:\Program Files\Common FilesCOMPUTERNAME TOWERDESKUNITComSpec C:\WINDOWS\system32\cmd.exeFP_NO_HOST_CHECK NONUMBER_OF_PROCESSORS 1OS Windows_NTPath C:\WINDOWS\system32;C:\WINDOWS;C:\PHP5;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\WINDOWS\system32\WBEM;C:\Program Files\QuickTime\QTSystem\PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSHPROCESSOR_ARCHITECTURE x86PROCESSOR_IDENTIFIER x86 Family 15 Model 2 Stepping 7, GenuineIntelPROCESSOR_LEVEL 15PROCESSOR_REVISION 0207ProgramFiles C:\Program FilesQTJAVA C:\Program Files\Java\j2re1.4.1_02\lib\ext\QTJava.zipSystemDrive C:SystemRoot C:\WINDOWSTEMP C:\WINDOWS\TEMPTMP C:\WINDOWS\TEMPtvdumpflags 8USERPROFILE C:\Documents and Settings\LocalServicewindir C:\WINDOWSAP_PARENT_PID 3596PHP VariablesVariable Value_SERVER["HTTP_HOST"] localhost_SERVER["HTTP_USER_AGENT"] Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7_SERVER["HTTP_ACCEPT"] text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us,en;q=0.5_SERVER["HTTP_ACCEPT_ENCODING"] gzip,deflate_SERVER["HTTP_ACCEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7_SERVER["HTTP_KEEP_ALIVE"] 300_SERVER["HTTP_CONNECTION"] keep-alive_SERVER["PATH"] C:\WINDOWS\system32;C:\WINDOWS;C:\PHP5;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\WINDOWS\system32\WBEM;C:\Program Files\QuickTime\QTSystem\_SERVER["SystemRoot"] C:\WINDOWS_SERVER["COMSPEC"] C:\WINDOWS\system32\cmd.exe_SERVER["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH_SERVER["WINDIR"] C:\WINDOWS_SERVER["SERVER_SIGNATURE"] <address>Apache/2.0.54 (Win32) PHP/5.1.6 Server at localhost Port 80</address>_SERVER["SERVER_SOFTWARE"] Apache/2.0.54 (Win32) PHP/5.1.6_SERVER["SERVER_NAME"] localhost_SERVER["SERVER_ADDR"] 127.0.0.1_SERVER["SERVER_PORT"] 80_SERVER["REMOTE_ADDR"] 127.0.0.1_SERVER["DOCUMENT_ROOT"] C:/Documents and Settings/RLane/My Documents/Web Sites/Localhost_SERVER["SERVER_ADMIN"] info@lane-consulting.com_SERVER["SCRIPT_FILENAME"] C:/Documents and Settings/RLane/My Documents/Web Sites/Localhost/InDevelopment/Wellington/Source/TMP4gfl65w2h.php_SERVER["REMOTE_PORT"] 1057_SERVER["GATEWAY_INTERFACE"] CGI/1.1_SERVER["SERVER_PROTOCOL"] HTTP/1.1_SERVER["REQUEST_METHOD"] GET_SERVER["QUERY_STRING"] no value_SERVER["REQUEST_URI"] /InDevelopment/Wellington/Source/TMP4gfl65w2h.php_SERVER["SCRIPT_NAME"] /InDevelopment/Wellington/Source/TMP4gfl65w2h.php_SERVER["PHP_SELF"] /InDevelopment/Wellington/Source/TMP4gfl65w2h.php_SERVER["REQUEST_TIME"] 1159209895_SERVER["argv"] Array_SERVER["argc"] 0_ENV["ALLUSERSPROFILE"] C:\Documents and Settings\All Users_ENV["CLASSPATH"] C:\Program Files\Java\j2re1.4.1_02\lib\ext\QTJava.zip_ENV["CommonProgramFiles"] C:\Program Files\Common Files_ENV["COMPUTERNAME"] TOWERDESKUNIT_ENV["ComSpec"] C:\WINDOWS\system32\cmd.exe_ENV["FP_NO_HOST_CHECK"] NO_ENV["NUMBER_OF_PROCESSORS"] 1_ENV["OS"] Windows_NT_ENV["Path"] C:\WINDOWS\system32;C:\WINDOWS;C:\PHP5;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\WINDOWS\system32\WBEM;C:\Program Files\QuickTime\QTSystem\_ENV["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH_ENV["PROCESSOR_ARCHITECTURE"] x86_ENV["PROCESSOR_IDENTIFIER"] x86 Family 15 Model 2 Stepping 7, GenuineIntel_ENV["PROCESSOR_LEVEL"] 15_ENV["PROCESSOR_REVISION"] 0207_ENV["ProgramFiles"] C:\Program Files_ENV["QTJAVA"] C:\Program Files\Java\j2re1.4.1_02\lib\ext\QTJava.zip_ENV["SystemDrive"] C:_ENV["SystemRoot"] C:\WINDOWS_ENV["TEMP"] C:\WINDOWS\TEMP_ENV["TMP"] C:\WINDOWS\TEMP_ENV["tvdumpflags"] 8_ENV["USERPROFILE"] C:\Documents and Settings\LocalService_ENV["windir"] C:\WINDOWS_ENV["AP_PARENT_PID"] 3596 Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98444 Share on other sites More sharing options...
Conjurer Posted September 25, 2006 Author Share Posted September 25, 2006 Got the mail working! Finally!Had to copy the php.ini to the c:\windows directory. Don't understand why since I had the php5 directory in my system path - but now the mail works. Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98465 Share on other sites More sharing options...
wildteen88 Posted September 25, 2006 Share Posted September 25, 2006 Did you add[code]PHPIniDir "C:/php5"[/code]To the httpd.conf file?I ahve to do that for some reason otherwise it wont read my php.ini file regardless whether I put the php folder into the PATH. Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98470 Share on other sites More sharing options...
Conjurer Posted September 25, 2006 Author Share Posted September 25, 2006 no - do I just add it like that at the end of the file or something? Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98492 Share on other sites More sharing options...
Conjurer Posted September 25, 2006 Author Share Posted September 25, 2006 Hey, Bingo! That worked. ;D Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98498 Share on other sites More sharing options...
wildteen88 Posted September 26, 2006 Share Posted September 26, 2006 I usually add that line after the LoadModule section. However it doesnt matter where you put it. Glad you got it all working now. Quote Link to comment https://forums.phpfreaks.com/topic/22014-upgraded-to-php5-now-cant-get-mail-to-work/#findComment-98804 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.