Script Garage

 

How to do i test php scripts through HTML page locally?

I am making an html page and there is a php code in it. I want to run that php code but it doesn't. what should i do? it gives me that error if that is of any help to you: 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:\Program Files\Apache Software Foundation\Apache2.2\htdocs\First lesson\sendmail.php5 on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\First lesson\sendmail.php5:6) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\First lesson\sendmail.php5 on line 7

Public Comments

  1. If you are running all of this script in your local enviroment you'll need to set a SMTP client at your PC. Otherwise you can try to connect to a server that will perform that. http://www.php-scripts.com/php_diary/122899.php3 http://email.about.com/cs/phpemailtips/qt/et031202.htm
  2. Hello, in mail() error u have to set smtp server mail and valid email id. For this error "Cannot modify header information - headers already" you have to write ob_start(); in first of the php page and end ob_end_flush(); because in header we should write any content. when we use ob_start(); its void error's ok. if you want to run php code in html use ajax or xajax it's very faster and better using in html.
Powered by Yahoo! Answers