Weird PHP bug

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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()
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

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
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Did you remember to restart Apache after you made the changes?
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Did the file get saved before you accidentally restarted your computer?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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

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

...
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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?
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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()
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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


Only in cases when you don't have access to the main php.ini file. If you were on a shared hosting server, that would be one example of a case when you would use htaccess.

I'm assuming you're on one of your home computers here, based on what I've seen you post in the past.

For whatever reason, your setting for "display_errors" isn't registering from "/etc/php5/apache2/php.ini", if it were, you should be seeing "On" under the "master value".

Is this a server that's open to the public? If not, go ahead and post the contents of "/etc/php5/apache2/php.ini", maybe there's a syntax error or an overriding value later on in the file.

--

I'm not sure why, but I've had this odd feeling that file permissions are preventing the ini file from actually being saved and we just haven't realized it.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

joebert wrote:
I'm not sure why, but I've had this odd feeling that file permissions are preventing the ini file from actually being saved and we just haven't realized it.

You're a genius :lol: I'm pretty sure it is file permission (it's on my home computer).

This is what I have done at the moment.
Code: [ Select ]
sudo chown -R bogdan /var/www/
sudo chmod -R 755 /var/www/
  1. sudo chown -R bogdan /var/www/
  2. sudo chmod -R 755 /var/www/

But I have being messing around with it setting it to 644, 777, 655, 700, 070, 007 and some other things... but what is set right now is the code on top.

There is something wrong with the file permission system though... I did 655 and I couldn't do anything... open/save... then I restarted my computer and then I could open the files but I couldn't save...

I actually done chown like 3 times so I'm not sure what that could've done.

[php.ini file is too big for me to paste here...]


Also, why is php5 locked down? I'm not able to access inside that folder.

Post Information

  • Total Posts in this topic: 17 posts
  • Users browsing this forum: No registered users and 70 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.