I have installed magento 2 and it working.I just created the Hello world module and it working now.
My issue was I had called non existing method in execute method.
While trying to get it to work I tried to load the page it shows blank white screen, but no error.
How do I get errors to display in magento2?
Add following code in index.php file :-
error_reporting(E_ALL);
ini_set('display_errors', 1);
Enabling Error reporting in magento2 is little tricky , as magento2 now comes with 3 different modes
Default
Developer
Production
Magento2 by default install in “default” mode and thats why you dont get the error log at the front-end of the site , that can a viewed at magento error log . You may check the complete details over here http://devdocs.magento.com/guides/v2.0/config-guide/bootstrap/magento-modes.html
How to enable developer mode in Magento2
This is must have if you are a developer and building extension and template for magento2 , magento provide a command for this purpose . Login in to your linux terminal and under magento execute
php bin/magento deploy:mode:set developer
and it will enable the developer mode under your magento instance for production mode you can set the mode to production or default .
still if you are experiencing in error reporting
you can give a try by renaming local.xml.sample to local.xml under
pub/errors
There is a place for this. In bootstrap.php, there is:
#ini_set('display_errors', 1);
Just uncomment that.
1) app/bootstrap.php, there is:
#ini_set('display_errors', 1);
Kindly uncomment that.
2) Run below commands
php bin/magento deploy:mode:set developer
php bin/magento cache:clean
php bin/magento cache:flush
To check current mode use:
bin/magento deploy:mode:show
Instead of editing index.php or app/bootstrap.php file, you can also edit the .htaccess file to enable PHP display errors settings.
Write the following lines of code at the end of the .htaccess file present in your Magento2 website's root directory:
## enable PHP's error display settings
php_value display_errors on
## set error display to E_ALL
php_value error_reporting -1
After that,
Open terminal
Go to your Magento's root directory
cd /path/to/your/magento/root/folder
Run the following command to enable developer mode:
php bin/magento deploy:mode:set developer
To check your current developer mode, you can run the command:
php bin/magento deploy:mode:show
Please Put the following code in index.php
ini_set('error_reporting', E_ERROR);
register_shutdown_function("fatal_handler");
function fatal_handler() {
$error = error_get_last();
echo("<pre>");
print_r($error);
}
Related
I enabled Magento's frontend debug path hints but they are not showing.
Infos:
- Magento 2.3.0 with Porto Theme
- Php 7.2
- Already tested to change Magento Single Store MOde and Multistore Mode
- Already made di:compile
- Already tested blank Dev IP and my own IP
- Already changed Magento Modes default and developer
- Already cleaned and flushed the cache
- Already removed generated and pub static folders
But still, the red Hintlines in Frontend don't show up.
Please follow the following steps-
Stores->Configuration->Advanced->Developer->Store View: Default Store View->
Enabled Template Path Hints for Storefront --> Yes
Enable Hints for Storefront with URL Parameter --> Yes
Parameter Value --> magento
After setting this, check on frontend by putting param (?templatehints=magento) in url like this -
http://localhost/test/index.php?templatehints=magento
You should use below steps:-
On the Admin sidebar, go to Stores > Settings > Configuration.
In the left panel, expand Advanced and choose Developer.
Expand enter image description here the Debug section and do the following:
enter image description here
After that you should clean cache.
OR
You can use below commands
For eable
php bin/magento dev:template-hints:enable
For disable
php bin/magento dev:template-hints:disable
Then clean cache
php bin/magento clean:cache
Upgraded to Magento 2.1.9 from 2.1.8.
Steps to replicate:
Deploy in production mode
deploy:mode:set production
Set the following paths to 0 within db:
dev/template/allow_symlink
dev/js/merge_files
dev/js/enable_js_bundling
dev/js/minify_files
dev/css/merge_css_files
dev/css/minify_files
Set the following paths value to 1:
dev/static/sign
Deploy static assets:
php bin/magento setup:static-content:deploy en_AU en_US && php bin/magento c:f
Results
Go to mydomain.com/admin and see:
Inspect this, what do we find:
A bunch of 404s to static minified files, visiting these files in from CLI also confirms they actually don't exist.
I thought that it might be a locale issue, saw this article but this didn't work for me.
I have minification turned off in my settings, all caches cleared (including Varnish). Yet this issue still persists. Front-end appears fine on the other hand.
Any help would be much appreciated, otherwise I suppose I could train the client to edit the db directly!
If you have install magento2.x in your local PC then if you can try to change line #607.
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
to
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Open your console/terminal, and type these commands
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush
It's working fine.
if you can try it....
I have a dirty fix whilst I continue to look at a more permanent solution. Create a permanent redirect pointing from my custom adminhtml theme - the one that doesn't get deployed to the "Magento" theme which does exist:
rewrite ^/adminhtml/<CUSTOM_THEME>/backend/(.*)$ /adminhtml/Magento/backend/$1 permanent;
In my case I am using nginx. If anyone else is experiencing this issue I hope this will provide a temporary solution for the time being.
Hello when I add an extension to Magento 2 my front-end disappears, but at the back end everything is fine and that extension is working.
I have tried increasing the PHP memory limit in PHP.ini sample and run the command PHP bin/Magento setup: static-content: deployment but the front-end is not working. So please let me know how to solve this issue.
To solve this issue, follow the steps given below:
Step 1- First flush/clean the cache of your magento
For Cache flush using command
magento cache:flush
For Clean flush using command
magento cache:clean
OR
You can also clean and flush cache types in the Magento Admin. Go to System > Tools > Cache Management. Flush Cache Storage is equivalent to magento cache:flush. Flush Magento Cache is equivalent to magento cache:clean.
Step 2- Delete the content of static folder. To delete, follow the given path
MangentoDir > pub > static.
Step 3- Run the static view files deployment tool
/bin/magento setup:static-content:deploy
Step 4- Go to the MangetoDir > pub > error and rename the local.xml.sample file to local.xml.
After going through these 4 steps, refresh the frontend page in browser to get the front-end.
php bin/magento setup:static-content:deploy -f
always works for me when no resources are available
Might be your frontend running in some other language so you need to need to deploy the content on that specific language as well like below example :
bin/magento setup:static-content:deploy en_GB en_US ro_RO
For language code, you can open the console of browser & look for any url which are failing to load, in that url you will be able to find the language code in which your frontend is working.
I am getting below error in magento 2 local system:
We're sorry, an error has occurred while generating this email.
It is not showing me the sample data installed in catalog. Please help me out to get solution of this problem.
Regards,
Rakesh Kumar
The first thing you need to do is go to your .htaccess file. Uncomment
SetEnv MAGE_MODE developer
The error message is 90% of the time misleading and most likely you have an xml parsing issue. Either way turning on the developer environment and clearing the cache will pull the error.
Without seeing your error log it'd be hard to give an exact diagnosis. Some users will say sendmail will fix this error but generally this is because the error is trying to be emailed to you and that is because you are not in the correct developing environment to debug the issue. This could be because you are in default or production mode which is not ideal for fixing issue.
The sendmail module is meant to allow a site to operate and if any issues do occur with the site then the developer can be notified and hopefully the error hasn't caused a full site rendering issue. This way a site can still operate unbeknown to users and the issue can be resolved by a qualified developer behind the scenes.
This error is quite misleading. In my case an error in MySql query was causing this.
You should enable developer mode the get the exact error.
php ./bin/magento deploy:mode:set developer
In My case issue get solved by giving permissions to directory pub/media/catalog/product/
Enable developer mode using command line php bin/magento deploy:mode:set developer
Clear cache using command line php bin/magento cache:flush
Reload the frontend page
After reloading the page the message will change to
Error filtering template: Unable to write file into directory \C:/xampp/htdocs/Magento/pub/media/catalog/product\cache\f073062f50e48eb0f0998593e568d857/m/b. Access forbidden.
Follow this link to fix Magento 2: Unable to write file into directory. Access forbidden
Clear cache
Reload the frontend page again
If you see another message after enabling developer mode you can search for it
In my case it was missing php-gd extension on my machine.
This was on my exception log (magento_root/var/log/exception.log):
main.CRITICAL: exception 'Exception' with message 'Required PHP extension 'gd' was not loaded.' in /var/www/html/magento2/vendor/magento/framework/Image/Adapter/Gd2.php:620
Solved by installing php-gd library on my Ubuntu machine with the following command:
sudo apt-get install php-gd
If you want to install for php5.6 then you may run:
sudo apt-get install php5.6-gd
This can be for any error occurred in the page. The notice is different. The notice is given when system tries to send error email to administrator and failed while in Production mode.
For actual error one should enable developer mode and enable display error in app/bootstrap.php and checking error logs. It can be any error like php or mysql.
ini_set('display_errors', 1);
Thanks
Please check your /var/log/exception.log
This is issue raised because your product does not upload. so check your database or upload your sample database again .Let me know what error in exception.log
I'm trying to install the Zend skeleton application and when I run the command "php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application path/to/install" I get an error about magic_quotes being deprecated. I'm using GoDaddy servers and I turned magic_quotes off in my php.ini file. Any ideas what could be causing the problem?
Based on the error it looks like my the file in /web/conf/php5.ini has magic_quotes On for some reason. It's a read only file that I can't change. Shouldn't the file in the root of my server be changing the setting in it?
When I run phpinfo it shows magic_quotes_gpc and the other magic_quotes all as Off. What could be causing this error message in ssh?
Could it be because my GoDaddy hosting account is running PHP 5.3.24? The minimum on the Zend site says 5.3.3