-1

I am trying to send email using PHP mail. I get the following error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/webtest/help/ask_us.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

The PHP code is as follows:

<?php
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ; 
  $message = $_REQUEST['message'] ;

  mail( "myemail@myhost.com", "Subject header",
    $message, "From: $email" );
  header( "Location: http://www.google.com" );
?>
Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76
Ankur
  • 50,282
  • 110
  • 242
  • 312
  • Possible duplicate of [Failed to open stream : No such file or directory](http://stackoverflow.com/questions/36577020/failed-to-open-stream-no-such-file-or-directory) – Vic Seedoubleyew Sep 10 '16 at 11:08

1 Answers1

4

That message isn't a mail error. PHP cannot open the file ask_us.php. If ask_us.php is your file, check its permissions (and those of the parent folders).

Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373