Weird PHP bug

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 27th, 2010, 10:10 pm

I have the following code in index.php

PHP Code: [ Select ]
// Including the global file... without it, we don't have the system.
 
require_once "includesds/ineit.php";
  1. // Including the global file... without it, we don't have the system.
  2.  
  3. require_once "includesds/ineit.php";

That file does not exist nor does the folder and yet it's not giving me any errors.

I'm using Ubuntu 10.10.

I reloaded apache and restarted it, but it still doesn't work... I'm beginning to hate linux. More trouble than it's worth.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 27th, 2010, 10:10 pm

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 27th, 2010, 11:26 pm

Nevermind, the following fixed the problem.

PHP Code: [ Select ]
error_reporting(E_ALL);
 ini_set("display_errors", 1);
  1. error_reporting(E_ALL);
  2.  ini_set("display_errors", 1);



Maybe I'm just not that good with technology :lol: blame it on Linux... just do it :lol:



I'll eventually get used to doing things by myself.

By the way, how do I access php.ini on Ubuntu? The php5 folder is locked for some reason.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post October 28th, 2010, 4:51 am

Quote:
By the way, how do I access php.ini on Ubuntu? The php5 folder is locked for some reason.


If you're logged in via SSH

BASH Code: [ Select ]
sudo nano /etc/php5/apache2/php.ini


If you're physically logged on at the computer. (nano will work, but I think gedit is easier to use if you're not familiar with nano)

BASH Code: [ Select ]
sudo gedit /etc/php5/apache2/php.ini


You can double check the path PHP is actually using in any script with phpinfo()
Strong with this one, the sudo is.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post October 28th, 2010, 6:40 am

I'd recommend running gksudo. You probably wont run into any problems but its designed for graphical interfaces.

Code: [ Select ]
gksudo gedit /etc/php5/apache2/php.ini


http://psychocats.net/ubuntu/graphicalsudo
#define NULL (::rand() % 2)
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 28th, 2010, 10:24 am

ok, but what in php.ini do I edit, and what do I set it to to enable error reporting?

I found the following in there:
Quote:
; error_reporting

so I did the following to it
Quote:
error_reporting = on

That didn't work, so I removed the ' = on' and it still isn't working.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post October 28th, 2010, 10:25 am

Did you remember to restart Apache after you made the changes?
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 28th, 2010, 10:44 am

Ok, I have the following in my php.ini file
Code: [ Select ]
display_errors
;  Default Value: On
;  Development Value: On
;  Production Value: Off

; display_startup_errors
;  Default Value: Off
;  Development Value: On
;  Production Value: Off

error_reporting
;  Default Value: E_ALL & ~E_NOTICE
;  Development Value: E_ALL | E_STRICT
;  Production Value: E_ALL & ~E_DEPRECATED
  1. display_errors
  2. ;  Default Value: On
  3. ;  Development Value: On
  4. ;  Production Value: Off
  5. ; display_startup_errors
  6. ;  Default Value: Off
  7. ;  Development Value: On
  8. ;  Production Value: Off
  9. error_reporting
  10. ;  Default Value: E_ALL & ~E_NOTICE
  11. ;  Development Value: E_ALL | E_STRICT
  12. ;  Production Value: E_ALL & ~E_DEPRECATED

And I happened (on accident) to restart the entire computer so apache is definitely restarted, but it still doesn't work. (I made those changes before I accidentally restarted the computer.


I managed to restart it by accidentally pressing the restart button on the tower when I was unplugging the headphones from the jack.

[EDIT:] I also tried the following
Code: [ Select ]
display_errors = on
;  Default Value: On
;  Development Value: On
;  Production Value: Off

; display_startup_errors
;  Default Value: Off
;  Development Value: On
;  Production Value: Off

error_reporting = E_ALL | E_STRICT
;  Default Value: E_ALL & ~E_NOTICE
;  Development Value: E_ALL | E_STRICT
;  Production Value: E_ALL & ~E_DEPRECATED
  1. display_errors = on
  2. ;  Default Value: On
  3. ;  Development Value: On
  4. ;  Production Value: Off
  5. ; display_startup_errors
  6. ;  Default Value: Off
  7. ;  Development Value: On
  8. ;  Production Value: Off
  9. error_reporting = E_ALL | E_STRICT
  10. ;  Default Value: E_ALL & ~E_NOTICE
  11. ;  Development Value: E_ALL | E_STRICT
  12. ;  Production Value: E_ALL & ~E_DEPRECATED


Still didn't work after I restarted apache
Code: [ Select ]
sudo /etc/init.d/apache2 restart
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post October 28th, 2010, 10:51 am

Did the file get saved before you accidentally restarted your computer?
#define NULL (::rand() % 2)
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post October 28th, 2010, 11:22 am

At the top of the page you're working on place the following.

INI Code: [ Select ]
<?php phpinfo(); exit; ?>


At the top of the output you should see something like this.

Attachments:
ini-files.gif


Make sure you're editing the file listed for "Loaded Configuration File". I don't know why that would change, but it only takes a minute to rule out.

Here's the contents of the error reporting section for the Ubuntu server I have sitting next to me, which is currently set to display everything other than notices.

Code: [ Select ]
;error_reporting = E_ALL & ~E_NOTICE
;
;  - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
;
;  - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
;
;  - Show all errors except for notices and coding standards warnings
;
error_reporting = E_ALL & ~E_NOTICE

; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
;
; possible values for display_errors:
;
; Off    - Do not display any errors
; stderr   - Display errors to STDERR (affects only CGI/CLI binaries!)
;
;display_errors = "stderr"
;
; stdout (On) - Display errors to STDOUT
;
display_errors = On

; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed. It's strongly recommended to keep
; display_startup_errors off, except for when debugging.
display_startup_errors = Off

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = Off

; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
log_errors_max_len = 1024

; Do not log repeated messages. Repeated errors must occur in same file on same
; line until ignore_repeated_source is set true.
ignore_repeated_errors = Off

; Ignore source of message when ignoring repeated messages. When this setting
; is On you will not log errors with repeated messages from different files or
; source lines.
ignore_repeated_source = Off

; If this parameter is set to Off, then memory leaks will not be shown (on
; stdout or in the log). This has only effect in a debug compile, and if
; error reporting includes E_WARNING in the allowed list
report_memleaks = On

;report_zend_debug = 0

; Store the last error/warning message in $php_errormsg (boolean).
track_errors = Off

; Disable the inclusion of HTML tags in error messages.
; Note: Never use this feature for production boxes.
;html_errors = Off

; If html_errors is set On PHP produces clickable error messages that direct
; to a page describing the error or function causing the error in detail.
; You can download a copy of the PHP manual from http://www.php.net/docs.php
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
; the dot.
; Note: Never use this feature for production boxes.
;docref_root = "/phpmanual/"
;docref_ext = .html

; String to output before an error message.
;error_prepend_string = "<font color=#ff0000>"

; String to output after an error message.
;error_append_string = "</font>"

; Log errors to specified file.
;error_log = filename

; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog
  1. ;error_reporting = E_ALL & ~E_NOTICE
  2. ;
  3. ;  - Show all errors, except for notices
  4. ;
  5. ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
  6. ;
  7. ;  - Show only errors
  8. ;
  9. ;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
  10. ;
  11. ;  - Show all errors except for notices and coding standards warnings
  12. ;
  13. error_reporting = E_ALL & ~E_NOTICE
  14. ; Print out errors (as a part of the output). For production web sites,
  15. ; you're strongly encouraged to turn this feature off, and use error logging
  16. ; instead (see below). Keeping display_errors enabled on a production web site
  17. ; may reveal security information to end users, such as file paths on your Web
  18. ; server, your database schema or other information.
  19. ;
  20. ; possible values for display_errors:
  21. ;
  22. ; Off    - Do not display any errors
  23. ; stderr   - Display errors to STDERR (affects only CGI/CLI binaries!)
  24. ;
  25. ;display_errors = "stderr"
  26. ;
  27. ; stdout (On) - Display errors to STDOUT
  28. ;
  29. display_errors = On
  30. ; Even when display_errors is on, errors that occur during PHP's startup
  31. ; sequence are not displayed. It's strongly recommended to keep
  32. ; display_startup_errors off, except for when debugging.
  33. display_startup_errors = Off
  34. ; Log errors into a log file (server-specific log, stderr, or error_log (below))
  35. ; As stated above, you're strongly advised to use error logging in place of
  36. ; error displaying on production web sites.
  37. log_errors = Off
  38. ; Set maximum length of log_errors. In error_log information about the source is
  39. ; added. The default is 1024 and 0 allows to not apply any maximum length at all.
  40. log_errors_max_len = 1024
  41. ; Do not log repeated messages. Repeated errors must occur in same file on same
  42. ; line until ignore_repeated_source is set true.
  43. ignore_repeated_errors = Off
  44. ; Ignore source of message when ignoring repeated messages. When this setting
  45. ; is On you will not log errors with repeated messages from different files or
  46. ; source lines.
  47. ignore_repeated_source = Off
  48. ; If this parameter is set to Off, then memory leaks will not be shown (on
  49. ; stdout or in the log). This has only effect in a debug compile, and if
  50. ; error reporting includes E_WARNING in the allowed list
  51. report_memleaks = On
  52. ;report_zend_debug = 0
  53. ; Store the last error/warning message in $php_errormsg (boolean).
  54. track_errors = Off
  55. ; Disable the inclusion of HTML tags in error messages.
  56. ; Note: Never use this feature for production boxes.
  57. ;html_errors = Off
  58. ; If html_errors is set On PHP produces clickable error messages that direct
  59. ; to a page describing the error or function causing the error in detail.
  60. ; You can download a copy of the PHP manual from http://www.php.net/docs.php
  61. ; and change docref_root to the base URL of your local copy including the
  62. ; leading '/'. You must also specify the file extension being used including
  63. ; the dot.
  64. ; Note: Never use this feature for production boxes.
  65. ;docref_root = "/phpmanual/"
  66. ;docref_ext = .html
  67. ; String to output before an error message.
  68. ;error_prepend_string = "<font color=#ff0000>"
  69. ; String to output after an error message.
  70. ;error_append_string = "</font>"
  71. ; Log errors to specified file.
  72. ;error_log = filename
  73. ; Log errors to syslog (Event Log on NT, not valid in Windows 95).
  74. ;error_log = syslog
Strong with this one, the sudo is.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 28th, 2010, 11:29 am

Code: [ Select ]
/etc/php5/apache2/php.ini

That's what it is. I changed the error code to what you have, and still nothing.

...
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post October 28th, 2010, 12:30 pm

See the part where Joebert made a screenshot with regards to phpinfo()? Could you run phpinfo() and paste us a screenshot as well for what you see there? I think that could be very helpful. Are there any additional php.ini files being parsed? Do you have any in the directory where you have the script to override the main php.ini? Are you using any .htaccess files or anything in httpd.conf to override any of the values in php.ini?
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 28th, 2010, 9:06 pm

Alright, here you go. I don't think that there is anything there, but... I don't know much about this :|
Attachments:
loaded files.png
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post October 29th, 2010, 3:12 am

When you look further down the output for php.ini in the "Configuration -> PHP Core" section, does the "local value" differ from the "master value" for any of the error related directives ? (the ones in my php.ini section from before)

If the "master value" is what you expect it to be, "On" then you can forget about "/etc/php5/apache2/php.ini" because the master values come from that file. If the master values aren't what you expect them to be, make sure your edits to "/etc/php5/apache2/php.ini" are actually being saved before restarting (restart, don't reload) Apache.

--

You can skip looking for php.ini files in your local directory, the apache_module version of PHP you get by using Ubuntu's package manager ignores them. Where you'll want to start looking is htaccess files in the directory you're working in, and each of the parent directories.

What you're looking for in the htaccess files Bigwebmaster mentioned is lines like this

Code: [ Select ]
php_flag display_errors off
Strong with this one, the sudo is.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post October 29th, 2010, 9:03 am

I didn't put any .htaccess in any of the directories. Do I need to, to enable errors?

Attachments:
php_info_core.gif

The PHP info

"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post October 29th, 2010, 9:23 am

Your display_errors flag is definitely off for whatever reason. You could also put a .htaccess file in your folder with the PHP script and add this line:

Code: [ Select ]
php_flag display_errors on


See if that changes the output for phpinfo()
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 29th, 2010, 9:23 am

Post Information

  • Total Posts in this topic: 17 posts
  • Users browsing this forum: No registered users and 175 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.