1

I'm running a lamp server to develop php. Everything was just working fine until I tried my script. I have a html form file which after being submitted to the server leads to a php file, the html file works just fine, however, I can't say the same thing to the php file. After submitting the form I'm getting a pure blank page with 0 lines of code when viewing the page source. I've already veryfied that both of the files are in my root directory /var/www/html. I've also confirmed that the html page was pointing to the correct php file, checked both of the file names, restarted apache2 server and cleared my cache. None of these worked. Do you have any more ideas? Thanks for your time, berga007

Some samples of my code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>  

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

  <title>1 st Registation form!</title>

  <!--begining of internal css-->

  <style>
  #p1 {

       font-family: verdana;
       color: red;
       font-size: 25px;
       text-align: center; 
  }

  p {

     font-family: verdana;
     color: blue; 
     font-size: 15px;
     text-align: left;

  }

</style>

</head>

<body>

<!--Register.html registation form using xhtml-->

<p id= "p1">Please complete this form to submit your registation in our website:</p>


<form action= "handle_reg.php" method= "post">

...

</form>

</body>
</html>

And now some samples of my php code

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

  <title>Your registation</title>

</head>

<body>

<?php

  //Display errors and error reporting

  ini_set ('display_errors, 1');
  error_reporting (E_ALL ~E_NOTICE);

  //Register Globals disabled
  $first_name=$_POST['first_name'];
  $last_name=$_POST['last_name'];
  $email=$_POST['email'];
  $password=$_POST['password'];
  $confirm_password=['confirm_password'];
  $color=$_POST['color'];
  $month=$_POST['month'];
  $day=$_POST['day'];
  $year=$_POST['year'];

  print '<p>Registation results: </p>';

  ...

?>
</body>
</html> 
4
  • 2
    Please check the log file: /var/log/apache2/error.log. For development it is useful to enabe error displaying in the /etc/php5/apache2/php.ini by setting display_errors = On and display_startup_errors = On. See php.net/display-errors and php.net/display-startup-errors
    – redimp
    Jul 28 '15 at 10:44
  • Ok, I get 1 parse error on that file. Why can't I see the errors on the browser?
    – berga007
    Jul 28 '15 at 11:06
  • As mentioned: Enable error displaying by setting display_errors = On and display_startup_errors = On in the php.ini.
    – redimp
    Jul 28 '15 at 12:02
  • Yes I'm aware of that approach too. I'm used to add these lines of code while I'm developing and in the past errors were displayed in my browser with no problems. The thing is with these lines of code I should be viewing all of the errors except notices and I'm not viewing any errors at all. Do you know why? Thanks in advance
    – berga007
    Jul 28 '15 at 21:04
1

Did you check the apache2 error log?

There is a typo in your php code. You are missing the &. Correct is:

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);

I highly suggest for development systems to set

display_errors = On
display_startup_errors = On
error_reporting = E_ALL

in your php.ini as I mentioned in the comments earlier.

Not the answer you're looking for? Browse other questions tagged or ask your own question.