Results 1 to 9 of 9

Thread: php: a blank page instead of an error message

  1. #1

    Default php: a blank page instead of an error message

    PHP 5 returns an absolutely blank page instead of a parse error message.

    In the file /etc/php5/apache2/php.ini
    error_reporting = E_ALL
    display_errors=On
    log_errors=On

    But is this location correct for the php.ini -file?
    And where do I find the error log?

    I'm running SUSE 10.1

  2. #2

    Default Re: php: a blank page instead of an error message

    Quote Originally Posted by tikitin View Post
    PHP 5 returns an absolutely blank page instead of a parse error message.
    Hmm... Maybe, you have no errors on the page. What is your code?
    http://mydailyhash.wordpress.com/
    http://yami.googlecode.com/

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: php: a blank page instead of an error message

    Blank page usually means a PHP error. Look in /var/log/apache2/error_log for error messages.

    Tip: you can catch some of the errors ahead of time by running

    php -l yourscript.php

  4. #4

    Default Re: php: a blank page instead of an error message

    Thanks ken_yap! The location of the error log was something I wanted to find.


    php -l yourscript.php
    This gave a response: command not found. It must be a php-configuration problem?
    This brings us back to the question of the correct location of the php.ini -file. Is it really /etc/php5/apache2/php.ini ?

    Shouldn't the PATH variable refer to the location of any command? Typing echo $PATH shows me the PATH variable, but "/etc/php5/apache2" is not included.

    Is there a php.ini -file somewhere else (I found a file called php.ini also in /etc/php5/fastcgi). In /etc/php5/conf.d there are a whole lot of *.ini -files. Should my php.ini also reside there?

    (I have quite recently configured my SUSE 10.1, and there are a lot of commands which do not work. For instance "locate", which would be quite useful)

  5. #5
    ab@novell.com NNTP User

    Default Re: php: a blank page instead of an error message

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Yikes..... no no no....

    First, the command is 'php5' I believe, or at least it is on my box.
    The 'command now found' error coming from bash means that the command
    you tried ('php') and nothing else (ini files or whatever) was not found
    in the $PATH (because you didn't specify a full path to the file). This
    is fine.... but means that any efforts you spend on your various 'ini'
    files will be completely futile, so first focus on the problem. The
    command wasn't found... in your case I'm guessing it's the wrong command
    so try 'php5'.

    Second issue you brought up... $PATH should ONLY point to binaries that
    should be executable without a path. Does that mean every binary on
    your system? Definitely not. For example regular users don't have
    /sbin in their path because most commands in /sbin are for 'root' so
    that is in the 'root' user's path only, by default. That doesn't mean
    you can't try to run things in there as anybody else, you just need to
    specify the path to the file. Having $PATH refer to every location on
    the system that there COULD be a binary will destroy system performance
    as it searches through every path looking for files to run.

    Continuing on this, this has nothing to do with any other file type on
    the system.... $PATH won't ever affect finding anything but a binary
    that is called with no path like 'php' is on the beginning of your line.

    Regarding the location of the files.... /etc/php5/apache2/php.ini is the
    correct path for php.ini for Apache. There is also, I believe, a
    version for command-line execution in /etc/php5/cli/php.ini that can be
    configured on its own.

    Should php.ini reside in other places? No.... you may want to start by
    checking the php.ini syntax documentation to see why.

    Other commands not working.... are they installed? What are you trying
    to do? Should they work? 'locate' can work if it's installed....
    'locate' comes with the 'findutils' package which you can install via Yast.

    Good luck.





    tikitin wrote:
    > Thanks ken_yap! The location of the error log was something I wanted to
    > find.
    >
    >>
    >> php -l yourscript.php

    >
    > This gave a response: command not found. It must be a php-configuration
    > problem?
    > This brings us back to the question of the correct location of the
    > php.ini -file. Is it really /etc/php5/apache2/php.ini ?
    >
    > Shouldn't the PATH variable refer to the location of any command?
    > Typing echo $PATH shows me the PATH variable, but "/etc/php5/apache2" is
    > not included.
    >
    > Is there a php.ini -file somewhere else (I found a file called php.ini
    > also in /etc/php5/fastcgi). In /etc/php5/conf.d there are a whole lot of
    > *.ini -files. Should my php.ini also reside there?
    >
    > (I have quite recently configured my SUSE 10.1, and there are a lot of
    > commands which do not work. For instance "locate", which would be quite
    > useful)
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFIrX/e3s42bA80+9kRAgWpAJ9vk8iGvG0PZbCMyq0Wm8clhKhcUgCfZETs
    L1H18HeqpgG6hfc8t1/9+7A=
    =C+pQ
    -----END PGP SIGNATURE-----

  6. #6

    Default Re: php: a blank page instead of an error message

    Yikes..... no no no....
    Thanks, I humbly receive the scorn...I'm blushing...

    I installed a SoL Linux server some 4-5 years ago and since then I have had no need whatsoever to deal with $PATH and all that. The trouble has been, that the **** machine is so noisy, that my girlfriend is not able to sleep with the server running in the same room. So I decided to get a new, more silent machine and installed SuSE this time and decided to upgrade PHP. I firmly believe that SuSE and PHP5 are going to be my dear and reliable friends for at least next four or five years, as soon as I get them running smoothly.

    Meanwhile I'm afraid I'm going nuts.

    Elaborating a question to a forum is often a very instructive experience. Four messages out of five will never be sent, because during the process of writing I often find the solution myself. But sometimes I press the "send" -button too hastily. This happened now with the "locate" -problem. Immediately after posting the message I went to YaST and found out that "locate" wasn't installed. I installed it and soon found also that third php.ini -file in
    /etc/php5/cli -directory. I wanted to edit that last sentence out from my message, but could not find "edit" button quickly enough...

    Anyway, thanks for the lesson on the $PATH. You were much clearer than anything I found in the manuals. Most of the stuff I should've known. I guess it is just early dementia.

    Still, my original problem prevails. Now I have learned to use command "php5 -l myscript.php" to see the possible parse errors beforehand. And I can find the errors in the error log. But what on earth should I do with the php.ini -file to show the parse errors right on the browser page.

    "error_reporting = E_ALL" has been like this by default, and I have uncommented "display_errors" and changed it to "On" in all three php.ini -files (though I assume that only the one in "apache2" is the one that counts). But I keep getting a blank page!!! Don't tell me I should give up. It's not in my nature.

  7. #7
    ab@novell.com NNTP User

    Default Re: php: a blank page instead of an error message

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    For testing create a new webpage that just has the following:

    <?php
    phpinfo();
    ?>

    and load that in your web browser. Once you have that loaded look at
    the settings you are trying to load. Once done make your changes to the
    files or set the parameters before calling phpino() and make sure you
    see those changing at that time. If you are modifying your ini files be
    sure you are reloading Apache each time as I believe they are only
    loaded at load time.

    Good luck.





    tikitin wrote:
    >> Yikes..... no no no....

    >
    > Thanks, I humbly receive the scorn...I'm blushing...
    >
    > I installed a SoL Linux server some 4-5 years ago and since then I have
    > had no need whatsoever to deal with $PATH and all that. The trouble has
    > been, that the **** machine is so noisy, that my girlfriend is not able
    > to sleep with the server running in the same room. So I decided to get a
    > new, more silent machine and installed SuSE this time and decided to
    > upgrade PHP. I firmly believe that SuSE and PHP5 are going to be my
    > dear and reliable friends for at least next four or five years, as soon
    > as I get them running smoothly.
    >
    > Meanwhile I'm afraid I'm going nuts.
    >
    > Elaborating a question to a forum is often a very instructive
    > experience. Four messages out of five will never be sent, because during
    > the process of writing I often find the solution myself. But sometimes I
    > press the "send" -button too hastily. This happened now with the
    > "locate" -problem. Immediately after posting the message I went to YaST
    > and found out that "locate" wasn't installed. I installed it and soon
    > found also that third php.ini -file in
    > /etc/php5/cli -directory. I wanted to edit that last sentence out from
    > my message, but could not find "edit" button quickly enough...
    >
    > Anyway, thanks for the lesson on the $PATH. You were much clearer than
    > anything I found in the manuals. Most of the stuff I should've known. I
    > guess it is just early dementia.
    >
    > Still, my original problem prevails. Now I have learned to use command
    > "php5 -l myscript.php" to see the possible parse errors beforehand. And
    > I can find the errors in the error log. But what on earth should I do
    > with the php.ini -file to show the parse errors right on the browser
    > page.
    >
    > "error_reporting = E_ALL" has been like this by default, and I have
    > uncommented "display_errors" and changed it to "On" in all three php.ini
    > -files (though I assume that only the one in "apache2" is the one that
    > counts). But I keep getting a blank page!!! Don't tell me I should give
    > up. It's not in my nature.
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFIrZxK3s42bA80+9kRAnCoAJ91y/zM5eIPUFoVQacbpCV9uhnmJwCgg6ZK
    4rIcNo4z6e/r9dcSvfx7ApA=
    =QjiG
    -----END PGP SIGNATURE-----

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: php: a blank page instead of an error message

    Hmm, on 11.0 /usr/bin/php is a symlink to /etc/alternatives/php which is a symlink to /usr/bin/php5. I believe it has been so for a few versions now, except that in older distro versions, it could also point to /usr/bin/php4. Anyway I leave it to you to find out why you don't have a symlink called php.

    As for error reporting, I changed the line in /etc/php5/apache2/php.ini to

    Code:
    display_errors = On
    and then reloaded apache2 with

    Code:
    /etc/init.d/apache2 reload
    which then obligingly showed me the result of a deliberate parse error on the web page. So, did you reload apache2 after editing the ini file?

  9. #9

    Default Re: php: a blank page instead of an error message

    hey guys help me out whats wrong with this code brings the blank page
    <p>
    <?php if (isset($_POST["searched1"]) {
    $conn = mysql_connect("localhost","root","") or die ("Error connecting to mysql");
    mysql_select_db($_POST["katibadb"]);
    $aryTables = array();
    $aryFields = array();
    $sql = "SHOW TABLES FROM " . $_POST["katibadb"];
    $result = mysql_query($sql);
    while ($row = mysql_fetch_row($result)) {
    $aryTables[sizeof($aryTables)] = $row[0];
    }
    for ($i = 0; $i < sizeof($aryTables); $i = $i + 1) {
    $sql = "SHOW COLUMNS FROM " . $aryTables[$i];
    $result = mysql_query($sql);
    while ($row = mysql_fetch_row($result)) {
    $aryFields[sizeof($aryFields)] = $row[0];
    }
    $sql = "SELECT * FROM " . $aryTables[$i] . " WHERE ";
    for ($j = 0; $j < sizeof($aryFields); $j = $j + 1) {
    $sql = $sql . $aryTables[$i] . "." . $aryFields[$j] . " LIKE '%" . $_POST["search"] . "%'";
    if (($j + 1) != sizeof($aryFields)) {
    $sql = $sql . " OR ";
    } else {
    $sql = $sql . ";";
    }
    }
    $result = mysql_query($sql);
    if (mysql_num_rows($result) > 0) {
    echo "<p>" . $aryTables[$i] . "</p>";
    echo "<table><tr><thead>";
    foreach ($aryFields as $field => $value) {
    echo "<th>" . $value . "</th>";
    }
    while ($aryData = mysql_fetch_assoc($result)) {
    echo "<tr>";
    for ($j = 0; $j < sizeof($aryFields); $j = $j + 1) {
    echo "<td>" . substr(htmlspecialchars($aryData[$aryFields[$j]], ENT_QUOTES), 0, 150) . "</td>";
    }
    echo "</tr>";
    }
    echo "</table>";
    }
    $aryFields = array();
    }
    } else { ?>
    <form name="search1" method="post" action="tafuta.php" id="search">
    <label><script language="JavaScript" type="text/javascript">
    document.write(TODAY); </script></label>
    <label for="searched1"></label>
    <input name="searched1" type="text" id="searched1" value="Tafuta hapa" onBlur="settxt();" onClick="cleartxt();"/>
    </label>
    <input name="Searchsearchbt" type="submit" id="Searchsearchbt" value="Tafuta" title="Tafuta maelezo kwenye katiba" accesskey="T" />
    </form>

    <?php } ?>
    <?php if (isset($conn)) {mysql_close($conn);} ?>
    </p>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •