Results 1 to 22 of 22

Thread: Fix php.ini to SHOW errors

  1. #1

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16

    Fix php.ini to SHOW errors

    Hello.

    I've fixed / edited my php.ini file

    https://ops.powweb.com/controlpanel/...t/phpplus.html

    display_errors = Off

    error_log = /home/users/web/b2516/pow.(USER)/subdomains/SpaceScience/htdocs/PHP.err

    However, my main site is going ok, & i'm 'moving' parts of it into their own smaller php files (the main php file is too big & hard to manage).

    Anyway, i've moved 1 section already, but i'm getting an '500' server error.

    HOWEVER - the 'sever error logs' do not show any php errors...


    Can anyone advise

    1) what is the correct way that powweb allows "server logs" to be changed by the user (me).

    1B) is it "instant" - Or are errors reported 6+ hours after the fact ?

    (I have seen "some" php errors reported - I deliberately cause 50+ errors (refreshing the page)., and "maybe" see a php error recorded in the logs many hours afer the fact (but only ONE error reported - not the 50+ times i try..)


    2) Is there a propper place / way in .htaccess to force errors to be saved also ?
    (ive tried this & i'm getting no errors shown in the directory I specify)...

  2. #2

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    EDIT: The error php errors now show up in the directory / file I specify. However a few 'minor' PHP errors are shown in his file (i'll fix later) but these all relate to other subdomains.

    NO errors are recorded for the subdomain i am working on.


    Here is my .htaccess.

    comets.php DOES exist - index.php does work with no errors..

    (i'm moving the 'comets' area into its own file & then if working, remove that code fromthe main file.

    Is it the htaccess that is wrong ?

    Code:
    <Files *> 
    Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0" 
    Header set Expires: 0 
    Header set Pragma: no-cache 
    </Files> 
    
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^category/([a-zA-Z0-9_-\s\%]+) /index.php?category=$1 [NC]
    RewriteRule ^date/([0-9]+) /index.php?date=1&page=$1 [NC]
    RewriteRule ^date /index.php?date=1 [NC]
    RewriteRule ^updates /index.php?updates=1 [NC]
    RewriteRule ^craft/([a-zA-Z0-9_-\s\%]+) /index.php?craftfound=1&craft=$1 [NC]
    RewriteRule ^craft /index.php?craft=1 [NC]
    
    RewriteRule ^comets/([a-zA-Z0-9_-\s\%]+) /comets.php?cometsfound=1&comet=$1 [NC]
    RewriteRule ^comets /comets.php?comets=1 [NC]
    
    RewriteRule ^location/([a-zA-Z0-9_-\s\%]+) /index.php?locationfound=1&location=$1 [NC]
    RewriteRule ^location /index.php?locations=1 [NC]
    RewriteRule ^contact /nwcontact.php?contact=1 [NC]
    RewriteRule ^recent /index.php?recent=1 [NC]
    RewriteRule ^clubs /index.php?clubs=1 [NC]
    RewriteRule ^links /index.php?links=1 [NC]
    RewriteRule ^events /index.php?events=1 [NC]
    RewriteRule ^observatories /index.php?observatories=1 [NC]
    RewriteRule ^([A-Z]{1})/?$  /index.php?listcategory=$1 [NC]
    Error for /comets area:


    Code:
    Internal Server Error
    
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    
    More information about this error may be available in the server error log.
    
    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    advice welcome.

  3. #3
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    I've noticed PHP errors to be displayed in the error log right away. The error log is filled from the bottom, so either look there, or 'clear' the log and refresh the page so the error happens again.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  4. #4
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    I can't help much with whether .htaccess is proper or not.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  5. #5

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Quote Originally Posted by snowmaker View Post
    I've noticed PHP errors to be displayed in the error log right away. The error log is filled from the bottom, so either look there, or 'clear' the log and refresh the page so the error happens again.
    The new error file is only 5900+ bytes long so far, since i managed to save to a file of my choice.

    Ive done a word search (visually & by control-F) for the specific directory i'm working on, & NO errors are showing at all for the directory/files im working on.

    Are '500 server errors' recorded in the error logs ? & if not, how do i diagnose ?


    EDIT 1:- My current comets.php is only a 4-line code (still having 500 server error).

    I googled & found this un-answered post from me in 2014.

    https://forums.powweb.com/showthread.php?t=97149

    EDIT2: tried to change comets.php from 644 (to 755) - but same problem, server error (I changed it back to 644).

    comets.php:
    Code:
    <?
    echo "Hello\n";
    exit;
    ?>

  6. #6
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    500 errors are recorded in the OPS error log. The error might be because of the .htaccess file, 'comets.php' works fine for me. See somdcomputerguy.com/pptest.php, the file permissions are 644 too, BTW.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  7. #7

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Quote Originally Posted by snowmaker View Post
    500 errors are recorded in the OPS error log. The error might be because of the .htaccess file, 'comets.php' works fine for me. See somdcomputerguy.com/pptest.php, the file permissions are 644 too, BTW.
    Is the OPS error log separate to this ? https://ops.powweb.com/controlpanel/...giErrorLog.bml

    How do we view it ?

    the error(s) i'm looking for do NOT appear in this log...

  8. #8
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    That is the correct URL to the error log I was referring to.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  9. #9

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Quote Originally Posted by snowmaker View Post
    That is the correct URL to the error log I was referring to.
    Any idea on how to resolve ? if the error(s) are *NOT* appearing in the log ?

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

  10. #10
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    The only thing I can think of is to rename the .htaccess file to something else.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  11. #11

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    if i renamed my .htaccess - then my emntire site wont work - i'll have to re-programme it to show LONG Urls for pages.

    Ps, ive tested (renamed) & the comet file DOES work if i put the url in full /comets.php
    but not if i use /comets (in the short form) and put the .htaccess file back.


    I'll ask a forum moderator tomorrow to move this into the htaccess area of the forum. How do we contact a moderator directly ?

    RewriteRule ^comets/([a-zA-Z0-9_-\s\%]+) /comets.php?cometsfound=1&comet=$1 [NC]
    RewriteRule ^comets /comets.php?comets=1 [NC]
    (Other parts of the site DO work - just not /comets area )

  12. #12
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    I am a forum moderator. I'll move this thread.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  13. #13
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    There. I've moved it into this forum. Sorry I couldn't help you more, you will probably get some more helpful replies though.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  14. #14

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Hmmmm This is really really frustrating...

    For 2-3 hours this morning, errors WERE being recorded in the log & i fixed half my 'comets' script. Now, im starting (but havnt started) adding the 2nd part to the script & now i'm getting 500 server error again (even in the part of the script that WAS workinng...

    This time, the errors are Not recorded

    When i do get the 1st half of the script going again, i'll create a 2nd php script for the 2nd half - to not disrupt the working script.

  15. #15

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Latest htaccess for my http://domain.com/comets/ directory

    Code:
    DirectoryIndex comets.php index.php
    
    php_flag display_startup_errors on
    php_flag display_errors on
    php_flag html_errors on
    php_flag  log_errors on
    php_value error_log  /home/users/web/b2516/pow.USERNAME/subdomains/SpaceScience/htdocs/comets/cometreportA.err
    
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([a-zA-Z0-9_-\s\%]+) /comets/comets.php [NC]

    latest comets.php:-

    Code:
    <?
    
    echo "hello";
    
    ?>
    And yes, there are no invisible spaces before/ after the script..

    Ive added error reporting to htaccess (changing username of course) - NO error in files nut 500 server error...

  16. #16
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    Try adding RewriteBase / after (as the next) the Options +FollowSymlinks line in your .htaccess file. I forget why it was needed it in a different .htaccess that I was using, but that line was in the example code that I CopyPasta'ed
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  17. #17

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Quote Originally Posted by snowmaker View Post
    Try adding RewriteBase / after (as the next) the Options +FollowSymlinks line in your .htaccess file. I forget why it was needed it in a different .htaccess that I was using, but that line was in the example code that I CopyPasta'ed
    Added but no luck. Still server error.

    Ive created a support ticket to

    a) confirm my php.ini file has the correct directory. (I think its correct as other script errors are being recorded - But not for the subdomain i want)

    and

    b) to ask if there are 'advanced' logs.. The logs i have access to do not confirm/show/record the error(s) im getting.

  18. #18
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,441
    Rep Power
    21
    Hey I hope you get this resolved bud.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  19. #19

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Hi again. Ive finally figured out the problem. the .htaccess file was adding a trailing slash to the final URL.

    EDIT (the trailing slash part is fixed. I can go to domain.com/comets/ but not sjow variables - as below)

    if i go to domain.com/comets/ the comets.php file is activated / run (there is no index.php file).

    HOWEVER if i go to domain.com/comets/item76 I get file not found error..

    I've copied the code from the higher directory so it should work - the value after /comets/ should be loaded as a value into comets.php.

    Here is my latest .htaccess file (in the /comets/ directory).

    Code:
    DirectoryIndex comets.php index.php
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^/([a-zA-Z0-9_-\s\%]+)/$ comets.php?location=$1 [NC]
    Can anyone advise.

    PS - ive removed all 'comets' references from the .htaccess in the higher directory

  20. #20

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    AHHHHH!!!!!!!

    I took a week to fix my last problem - 500 / Internal Server Error. I have no idea what i did to fix it...

    It was fixed yesterday / the day before - NOW - ive got another one...

    Is there a way to alter php.ini and/or .htaccess to email *ME* with the "server" logs for my scripts in my domain and/or specific directories ?

    - htacess error
    - php.ini error
    - script error...

    here is my current / latest .htaccess, ALL web pages work - except "topics"

    I've only just loaded /added the 'new' topic part today - It does nothing useful yet its barely active / a few lines & i'm getting an undetermined / unkown error...

    ERROR

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    HTACCESS


    <Files *>
    Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0"
    Header set Expires: 0
    Header set Pragma: no-cache
    </Files>


    RewriteEngine on
    RewriteRule ^category/([a-zA-Z0-9_-\s\%]+) /index.php?category=$1 [NC]
    RewriteRule ^date/([0-9]+) /index.php?date=1&page=$1 [NC]
    RewriteRule ^date /index.php?date=1 [NC]
    RewriteRule ^updates /index.php?updates=1 [NC]
    RewriteRule ^craft/([a-zA-Z0-9_-\s\%]+) /index.php?craftfound=1&craft=$1 [NC]
    RewriteRule ^craft /index.php?craft=1 [NC]

    RewriteRule ^comets/([a-zA-Z0-9_-\s\%]+) /cometsfound.php?cometfound=1&comet=$1 [L]
    RewriteRule ^comets/$ /comets.php [L]
    RewriteRule ^comets$ /comets.php [L]

    RewriteRule ^location/([a-zA-Z0-9_-\s\%]+) /index.php?locationfound=1&location=$1 [NC]
    RewriteRule ^location /index.php?locations=1 [NC]
    RewriteRule ^contact /nwcontact.php?contact=1 [NC]
    RewriteRule ^recent /index.php?recent=1 [NC]
    RewriteRule ^topics /topics.php [L]
    RewriteRule ^clubs /index.php?clubs=1 [NC]
    RewriteRule ^links /index.php?links=1 [NC]
    RewriteRule ^events /index.php?events=1 [NC]
    RewriteRule ^observatories /index.php?observatories=1 [NC]
    RewriteRule ^([A-Z]{1})/?$ /index.php?listcategory=$1 [NC]
    Here is topics.php

    Code:
    <?
    
    error_reporting(E_ALL);
    $dt = date('YmdH');
    ini_set("error_log", "/home/users/web/b2516/USERNaME/subdomains/SpaceScience/htdocs/mainreportA$dt.err");
    
    
    require_once("topics.inc.php");
    require_once("ss.inc.php");
    require_once("initial.inc.php");
    require_once("includes/Templates.inc.php");
    $log=1;
    
    
    if ($log > 0) {echo "<!-- START topics.php -->\n";}
    
    if ($log > 0) {echo "<!-- GO TO count_topics(); -->\n";}
    
    echo "hi1";
    exit;
    
    $topic = count_topics();
    if ($log > 0) {echo "<!-- RETURN FROM count_topics(); -->\n";}
    
    echo "hi2";
    
    exit;
    
    ?>
    EDIT: I mean email me - not the "powweb" people...
    (ive got php.ini and htaccess scripts altered already to save to file, but "server" errors are not recorded..)
    Last edited by PeterPan; 11-4-15 at 05:22 AM.

  21. #21

    Join Date
    Sep 2002
    Location
    Auckland
    Posts
    1,356
    Rep Power
    16
    Hmmm..

    This is frustrating. Ifixed the error by adding $ to it. The other lines do not need $, so why is it fussy for this 1 line ?

    Code:
    RewriteRule ^topics$ /topics.php [L]

  22. #22
    Thinkin' out loud again Builder's Avatar
    Join Date
    Nov 2002
    Location
    Illinois
    Posts
    2,088
    Rep Power
    19
    It's not just that one line. Look above it at your comets line:

    Code:
    RewriteRule ^comets$ /comets.php [L]
    Essentially the same thing.
    A good friend will come and bail you out of jail...
    but a true friend will be sitting next to you saying,
    "Damn... that was fun!"

Posting Permissions

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