Lampp does not show the cause of error - lampp

I am working on php files, but when there is an error, it does not tell me the cause or the number of line containing the error, only there is a message on the page" the localhost page isn't working"

At the top of your PHP file, put
error_reporting(E_ALL);
ini_set('display_errors', 1);
When you are in dev mode. When you are done w/ development, take it back out or comment it.

Related

Failed to load resource: net::ERR_CONTENT_DECODING_FAILED error while loading laravel css file

While executing a web page after loading HTML, CSS file is not loading & not applying the UI changes.
In browser console it is showing the following error Failed to load resource: net::ERR_CONTENT_DECODING_FAILED
One more issue is "that error is occuring only for the first time", If I reload the page the error will be gone & will load the CSS properly.
One solution I found after browsing is to enable gzip encoded, That is already in place.
Console error message
Welcome to stackoverflow.
This is a bit of an annoying error. But ill do my best Lacking what information I have on your error exactly.
What is this error?
This can happen when an HTTP request's headers say that the content is gzip encoded, but it isn't. It doesn't always happen, as you've discovered. But happens occasionally.
What can you do?
Check to see if Route::get('/') pointing to the correct
controller/code?
check to see if output_compression is added to your php.ini
Add this code: zlib.output_compression = On
try going to /config/config.php(this may not be right in your case) and set the following to false $config['compress_output'] = FALSE;
Further reading
(more about what the error actually is)
https://superuser.com/questions/172951/chrome-error-330-neterr-content-decoding-failed
https://www.solvusoft.com/en/errors/runtime-errors/google-inc/google-chrome/330-chrome-error-330/
As I referred about this cause of error, I think adding zlib.output_compression = On to php.ini will help you.
You can find this php.ini file in your php installed folder. In that find zlib.output_compression and initially it will be in OFF stage. Change it to zlib.output_compression = On.
For more information you can refer https://stefantsov.com/fixing-err_content_decoding_failed-in-apachephp/
If you are using Cloudflare make sure Brotli is enabled.
To enable Brotli, follow these steps.
Log in to your Cloudflare account.
Choose the appropriate domain.
Click the Speed app.
Click the Optimization tab.
Toggle the Brotli switch to On.
https://support.cloudflare.com/hc/en-us/articles/200168396-What-will-Cloudflare-compress-
For me the problem was this:
throw new CHttpException(Yii::t('general', 'This category has no product.'));
Becose I use Framework Yii 1.1, I changed that with this:
Yii::app()->user->setFlash('notification', "This category has no product.");
And in front-end I display the message like this:
if (Yii::app()->user->hasFlash('notification')) {
echo '<div>' . Yii::app()->user->getFlash('notification') . "</div>\n";
}

Magento Admin Backend Blank Page after login

i have a serious problem in Magento Admin Backend. After login its shows a BLANK Page. i used the same files and database in different server, there it was working fine but when i have transferred files into LIVE then Admin issues came. Please help me over this as i got frustrated from last some dayz. If you need any more dertails then plz ask but i need to resolve this soon. Link: http://studywings.com/index.php/admin/
Magento ver: 1.7
flush your magento root /var/cache folder and /var/session folders, It may have previous server session that may cause problems.
Otherwise disable all third party modules and try again. I think this will help
I had the Same problem,
i have also debug the any errors occured, i tried index.php file
ini_set('display_errors', 1);
error_reporting(E_ALL);
$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
pleced above code in index.php file. after that i have tried admin login.
showing the errors are session related, header already send errors.
i have to add the code in root/index.php file in top add the following line.
ob_start();
after that tried the login its worked.
Cheers..!
Is url changes to this after click login button or not?
http://yourdomain.com/index.php/admin/index/index/key/(key value)/
if url changes but not not show the dashboard page then go to
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
make copy of this file
Find the code for setting session cookie parameters these started on line 77
Comment out the final three lines and be sure to remove the comma after $this->getCookie()->getPath(). You should end up with this:
// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
// $this->getCookie()->getDomain(),
// $this->getCookie()->isSecure(),
// $this->getCookie()->getHttponly()
also line 104 comment out :
//call_user_func_array('session_set_cookie_params', $cookieParams);
If there is no change in url after click login then try to uncomment display error and see error_log file of your server
I think this problem is due to file permissions. As you added files from one server to another, permissions might be get changed.. Try to give the permissions to all the files. Check this http://www.mage-shop.com/forum/threads/3-Magento-Admin-Backend-Blank-Page-Error
There are a number of things that can cause it, but it's most common after migrating to a new server, last time it happened to me it was an excessively low php memory_limit setting on the new server - the Admin part of the site uses a lot more resources per user than the frontend.
In general when having this issue:
Flush out your cache by emptying var/cache
Clear out sessions by emptying var/sessions
Check the magento error logs/reports for an error code in var\logs and var/reports
Turn on magento error logs in mysql if logging isn't already on! (look in core_config_data for WHERE path like 'dev/log/active'
Check if your php configuration is displaying errors
Check your apache/php error logs for more clues - memory errors will show up here for example
Try this solution
It sounds like you want to enable Developer mode. Add this to your .htaccess file:
SetEnv MAGE_IS_DEVELOPER_MODE "true"
You may also want to enable display errors in index.php:
ini_set('display_errors', 1);
The best way I have found to debug is with X-Debug in a local environment. You can also use log files to help debug in a production environment, if your unable to run X-Debug in the environment.
I've got a more detailed posting here:
http://www.molotovbliss.com/debugging-tips-and-tricks-with-magento-commerce
Consider also installing XDebug
Hope this helps you!
Just to complete the other answers....
I am upgrading a magento install, and got the same problem, in the end I had another folder inside of var/
magento/var/minifycache
Only worked after clear deleting the files inside of this folder.
I had the same problem after uninstalling an extension. I thought that clearing cache would be enough, and I did without success... later speaking with the technical team, they commented me that it did not work because I hace memcache installed, and needed to be done the cleaning via system - backend (that i coudl not see...)

Resize an Image (on the fly) not working

I am using this script from Bit Repository.
<IMG SRC="resize_image.php?image=sunset.jpg&new_width=32&new_height=32">
My problem is that, it is not showing any image on my hosted server.
http://www.belowyellow.dx.am/resize_image/demo.html
but it works on my localhost, hope somebody can help me with this. Thank you.
Source: http://www.bitrepository.com/resize-an-image-keeping-its-aspect-ratio-using-php-and-gd.html
If you take a look at what your PHP script returns before trying to embed it in an img tag, you'll see there are some warning before your image data.
Since PHP output text before your image output, it can't change the HTTP header anymore, so your image is output as text.
set_time_limit(10000);
error_reporting(E_ALL ^ E_NOTICE);
You should remove these two lines from resize_image.php. set_time_limit is obviously disabled on your production server so the first line is useless and generates a warning. The error_reporting in the second line is the real source of the problem here, it tells PHP to display all kind of warnings and notice. This kind of error reporting should only be used in a local debugging environment and not on a production server. If you remove this line, you'll get the default error reporting that shouldn't show any warning and your image should be correctly output.

Magento: Directly output any errors or notices

In my module's code, I echo'd an undefined variable:
echo $doesnotexist;
I have done the following in index.php:
error_reporting(E_ALL);
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
This combination shows a "Whoops, our bad..." 404 type page when the code is executed. And in the exception.log there is a Notice ("Undefined variable: doesnotexist") as well as a stack trace.
If I remove part of the instructions in index.php:
error_reporting(E_ALL);
//Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
The frontend shows the page normally without any indication of the error, and the error is logged to system.log.
Now my question is: Is there a way to output these notices/errors directly to the frontend? Or am I supposed to always keep open a copy of system.log or exception.log while coding?
Magento normally uses zend exception/error handling class for the error and exception handling. So for the errors in which magento code send exception is logged in your log.
But if the error is not catchable by magento then it will be printed on your page.
You can get your error on frontend in 2 case:
If you are creating your own magento extension then you can throw your error in the way so that it can get displayed on magento page
If you are working on .phtml file and getting fatal errors
As a security concern errors and warning s should not be displayed on front end.
If there is an exception or you do some system log you will be able to get that from system.log or exception.log
For PHP errors you should refer to error log file that is generated at site level.
Mage::setIsDeveloperMode(true); can be used only after you have included Mage.php so paste your complete index.php code

CodeIgniter 2.0.2 syntax error blank page

CodeIgniter 2.0.2 syntax error blank page
i have CodeIgniter 2.0.2 (CI) and its annoing, that when i write lots of code and then just get blank page. Hard to debug without error. i got error reporting E_ALL in php.ini and in config of CI its turned on for every case of enviroment (devel, product) just for sure...
Does anyone knows, where the bug can be? How to turn it on? I think CI is rewriting php.ini error reporting setting somewhere somehow...
Thanks.
The other thing to check in your php.ini are the 'display_errors' and 'display_startup_errors' variables, they should both be set to 1.
In my (little) experience with CI this issue has been the most frustating one. I can understand that no framework is perfect, and any web developer is used to deal with errors (no matter if the framework or the developer is to blame). But that ANY error results in a blank page, with ZERO information in logs, console, whatever, is unacceptable.
If I recall correctly, in my case this was caused by of some combination of CI (ab)using the "silent error" PHP operator (e.g. prepending some db statements with the # operator, a not very clever way of avoiding leaking potentially private information to the end user), together with some bad use of *error_reporting*. See my post here (and see how many answers I got!).
I reported another related CI's idiocyidiosyncrasy related with logging here (again, zero answers)
please check the index.php which locate in the SAME LEVEL of the application folder
inside the index.php the second line
line 2:
ini_set("display_errors", "1"); //ensure it is set to 1
line 23:
define('ENVIRONMENT', 'development'); // development | testing | production
grep your php.ini for the word "error", turn them to On etc...
Do you have output compression turned on in the config? I find that will cause white pages when you have errors.
$config['compress_output'] = FALSE; // Should be set to this when developing.
I had the same problem and eventually fixed it when i noticed I had no 'logs' directory in my application folder

Resources