old joomla has Strict standards errors - no access to php.ini - php

I have a few old 1.5 joomla sites that have started showing large numbers of these errors:
Strict Standards: Non-static method JLoader::import() should not be called statically in /data02/eebackup/public_html/josephstorehouseuk/libraries/joomla/import.php on line 29
Strict Standards: Non-static method JLoader::register() should not be called statically in /data02/eebackup/public_html/josephstorehouseuk/libraries/loader.php on line 71
Strict Standards: Non-static method JLoader::import() should not be called statically in /data02/eebackup/public_html/josephstorehouseuk/libraries/joomla/import.php on line 32
I don't have access to the php.ini file and I can't login at the back end. I have tried the following:
In the configuration file:
var $error_reporting = '0'; - which left nothing but the above errors
then:
var $error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); which again seemd to turn the site off except the above errors
and
var $error_reporting(6351); as above
I tied altering
# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
to the htacess file (note not .htaccess) and that didn't work either.
I have run out of ideas

Joomla 1.5 should be never used again. Switch to newer version
Version 1.5
Release date 2008-01-22
Supported until *2012-12-01*
You must upgrade - also this versions have known unpatched vulnerabilities.
If you REALLY want to use that trash then
ini_set('display_errors', '0'); // Hides all errors
error_reporting(E_ALL | E_STRICT); // Allow logging them (if you log to the files, you should also ignore E_Strict as you already told - they will not fix it).

A client who has been unable to update his Joomla 1.5 site just experienced the same error deluge. It had been running fine until the host updated PHP without warning. I did exactly what the OP said did not work (in the original post) - by adding to .htaccess
(Note: edited .htaccess, not htaccess.txt)
# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
and errors were immediately cleared.

you need to do following in configuration.php
display_errors = Off
it might possible that they are enabled anywhere in the following
php.ini
httpd.conf
.htaccess
php code
once you change in configuration.php , you only need to look php code if its enabled anywhere.
other option is to login to mysql database, you change admin password and reset the error reporting.
Last thing, you need to update your joomla 1.5 to atleast 2.5.8. 1.5 has many security breached and vulnerable, it can be hacked see here http://www.r00tsec.com/2012/07/hacked-joomla-v-16x-17x-250-252.html

Related

How do I avoid " PHP Strict Standards" if I cannot change the version of my PHP (PHP 5)

Here are some examples to some of the errors. I heard this is a result of old code in new code, but I can't change my PHP version off the native 5.4 version ispmanager uses because I need Apache. Tried switching version but it messes up my site. Any ideas?
PHP Strict Standards: Redefining already defined constructor for class Object in /var/www/ku/data/www/Public IP/cake/libs/object.php on line 54, referer: http://Public IP/posts/add
PHP Strict Standards: Non-static method Configure::getInstance() should not be called statically in /var/www/ku/data/www/Public IP/cake/bootstrap.php on line 38, referer: http://Public IP/posts/add
PHP Deprecated: Assigning the return value of new by reference is deprecated in /var/www/ku/data/www/Public IP/cake/libs/cake_log.php on line 182, referer: http://Public IP/posts/add```
adding this in your PHP code may solve your problem.
error_reporting(0);
#this will display no errors.
error_reporting(E_ALL ^ E_STRICT);
#this will make it just not strict
Is this what you need?
If you have access to the php.ini, add/change the following to it:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
If you don't have access to the php.ini, and you run via Apache (you can have .htaccess file in root). Add this to .htaccess:
php_value error_reporting 30711
Last option is like mentioned by nikhil.

Joomla website throwing errors

Sometime back, I had created a Joomla website on a third-party server. Now when I try to access the website, I'm seeing errors such as the following:
Strict Standards: Non-static method JLoader::import() should not be called statically in /home/chinfote/public_html/libraries/joomla/import.php on line 29
Strict Standards: Non-static method JLoader::register() should not be called statically in /home/chinfote/public_html/libraries/loader.php on line 71
Strict Standards: Non-static method JLoader::import() should not be called statically in /home/chinfote/public_html/libraries/joomla/import.php on line 32
Strict Standards: Non-static method JLoader::register() should not be called statically in /home/chinfote/public_html/libraries/loader.php on line 71
Strict Standards: Non-static method JLoader::load() should not be called statically in /home/chinfote/public_html/libraries/loader.php on line 161
Strict Standards: Non-static method JLoader::register() should not be called statically in /home/chinfote/public_html/libraries/loader.php on line 138
Strict Standards: Non-static method JRequest::clean() should not be called statically in /home/chinfote/public_html/libraries/joomla/import.php on line 33
Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/chinfote/public_html/libraries/joomla/environment/request.php on line 463
After searching on the net, I found that I should be making some changes in the php.ini file. But on the File Manager of the cpanel, I could not find this file.
Could anyone please help me in finding this file and solving these errors.
Or is there any other way to solve the above problem??
Many thanks in advance.
~Jahnavi
Joomla 1.5 work in PHP 5.4.
You can paste this code index.php for frontend and backend. It works for me!
// Set flag that this is a parent file
define( '_JEXEC', 1 );
error_reporting( E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING );
Suppressing the warnings is not the same thing as fixing them.
Joomla might might have a lot of functionality built-in but it's security history is far from exemplory. Have you got the latest version of Joomla installed? If not, then do so now. If you are still getting warnings then report it as a bug.
I have encountered same issue, my configuration was Joomla 1.5 on shared hosting server.
However the hosting provider upgraded PHP Version to 5.4 from 5.2 . It seems that Joomla 1.5 is not compatible with PHP Version 5.4, so instead of supressing your errors (which of course is not a nice idea) try adjusting the PHP Version on your shared hosting/ or dedicated hosting...
Cheers. If there is a warning do not hide it - resolve it...!!! :)
unbelievable.
you people are obviously not coders if all you are trying to do is to HIDE the message.
Messages are there for a reason.
find the function in your component and put the word static in front of it.
function import(
change to static function import(
Problem solved. not hidden
If there are no php.ini file in your joomla root directory make a new phi.ini file in using Cpanel ( create a new file ) and do you stuff with it
You will find it in (for linux) /etc/php.ini
Try this: Replace
display_errors = On --> display_errors = Off
error_reporting = E_ALL | E_STRICT --> error_reporting = E_ALL & ~E_NOTICE
Switch your php version to php 5.3
also change the error_reporting in your joomla configuration file (configuration.php)
var $error_reporting = '6143';
You can solve the problem only if you return to php 5.2 or you will change the new version to work with J 1.5
Two things to address and surpass the errors
1. set error reporting to none in configuration
2. Your joomla version may be old ,
You can paste this code index.php for administrator and frontend.
// Set flag that this is a parent file
define( '_JEXEC', 1 );
error_reporting( E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING );
Some hosters don't allow the PHP.ini to be read from the root of the folder. But if they do, you may need to add another one for your /administrator folder. This may at least let you get into the backend. If not, you may be able to set these PHP parameters through your htaccess file. Might need a little more google searching but there should be plenty of info on it...
Strict Standards: Non-static method JLoader::import() should not be called
statically in /home/chinfote/public_html/libraries/joomla/import.php on line 29
You will find it in server.. /etc/php.ini
Try this: Replace display_errors = On To display_errors = Off
Just do as follows in php.ini file:
;error_reporting = E_ALL | E_STRICT
You can add these lines to your .htacces file ; if your only problem is shown errors.
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0

Can I hide the path in php error using .htaccess

Can I hide the path in php error using .htaccess
Example:
Notice: Undefined variable: hello in C:\xampp\htdocs\mysite\index.php on line 3
I want to hide the path using .htaccess or print something let me know if there is an error without print the path of the page:
Notice: Undefined variable: hello on line 3
or
Notice: Undefined variable: hello
or
There is error in your page
Edit :
I put this lines in my .htaccess
But I can't access to my site. There is error "Internal Server Error"
How Can I fix that
# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
PHP’s error messages are not meant for users but for developers only.
So for a production environment, you should disable display_errors to avoid information disclosure:
Note: [display_errors] is a feature to support your development and should never be used on production systems (e.g. systems connected to the internet).
Instead, you should show generic error messages to your users that do not unveil anything of the internals and only log the error messages (see log_errors and error_log):
Note: You're strongly advised to use error logging in place of error displaying on production web sites.
And if you really want to modify PHP’s error messages, you can use set_error_handler to set a custom error handler.
See also OWASP’s Development Guide on “Error Handling, Auditing and Logging” for further information.
You cannot change the messages : those are generated by PHP, and that's the way they are.
But you can prevent them from being displayed to your website's users -- and still log them, for your own usage.
For that, see :
display_errors : to prevent errors from being displayed to the page's output
log_errors : to indicate that errors should be logged to a file
error_log : to specify to which file errors will be logged to.
Of course, that doesn't prevent you from fixing as many causes of notices / warnings / errors as possible ;-)
Get rid of all that useless stuff.
php_flag display_errors 0
alone will be enough.
If error persists, check server's error_log for the error message

PHP won't show any errors

Here is my code:
echo 'foo';
error_reporting(E_ALL);
echo 'this line doesnt end in a semi colon'
echo 'i should get an error here';
When I run this I get no error.
Not sure how this can be?
ini_set('display_errors', 1);
Do note though that if you do this in the file that has the syntax error, it won't work, as it'll never get executed then. You can also set this true in php.ini (not recommended for production servers), or if you use Apache, in .htaccess with:
php_flag display_errors 1
error_reporting directive won't help you to show error messages on-screen. It's responsible for which error to show, not where.
if your PHP runs as Apache module (most likely it does) add the following line into .htaccess file:
php_value display_errors 1
when you switch to production, change it to
php_value display_errors 0
php_value log_errors 1
and watch them it in the error log.
Do you have any kind of shutdown hooks, error-handling functions or global exception catchers running?
Syntax errors can be quirky in large frameworks :)

Codeigniter white screen of death on models

If there is an error in my model codeigniter will just show a blank page. I have error reporting set to E_ALL and DB debugging turned on.
Is there any way I can get the errors to show up?
check the .htaccess file the root of your site:
# enable PHP error logging
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log
i can recommend downloading the uhoh error exception library for codeigniter (taken from kohana) it is very helpful:
https://github.com/dhrrgn/codeigniter-uhoh
you can also check php.ini:
error_reporting = E_ALL
display_errors = On
I remember getting no error reported if I didn't have the php_mysql module installed and configured for PHP. Maybe check check the output of the phpinfo function to see if the mysql module for PHP is installed.
Thats my best guess.
For linux users: ensure you set mysqli
$db['default']['dbdriver'] = 'mysqli';
in your database.php file

Categories