Magento 2 frontend error after installing an extension - magento2

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.

Related

Sylius: "cache:clear" timeout

I've developed a sylius based site on a local server. I want to deploy it in production on my OVH server.
In the Sylius Sylius Cookbook, I did not find any particular procedure. So I followed the normal procedure.
Upload my code to the production server with a "git clone" of my git repository
Install my vendor dependencies "php composer install"But this step does not work because it never ends. At the end, I always have something like this:
Executing script cache:clear
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/local/php7.3/bin/php' '--php-ini=/usr/local/php7.3/etc/php.ini' './bin/console' --ansi cache:clear" exceeded the timeout of 20000 seconds.
I even tried "composer clearcache" before. It hasn't changed anything.
I am now trying "COMPOSER_PROCESS_TIMEOUT = 50,000". The "composer install" was sent 12 hours ago and is still not finished ...
Has anyone ever had this problem or know how to find a solution?
Is there a special step to do when working with sylius?
Because I really don't know what to do.
UPDATE:
My main lead at the moment is that the problem would come from sylius because I am trying to create a new install of sylius with the symfony 4 structure like this
composer create-project sylius/sylius-standard
Same result:
Executing script cache:clear
[Symfony\Component\Process\Exception\ProcessTimedOutException] The
process "'/usr/local/php7.3/bin/php'
'--php-ini=/usr/local/php7.3/etc/php.ini' './bin/console' --ansi
cache:clear" exceeded the timeout of 20000 seconds.
I tried to run composer create-project with the --no-scripts flag and run php bin/console cache:clear separately after that. The bug reappears with the second command.
You should first check that you are setting permissions right for your var folder, as per symfony install instructions.
You might also just be running out of resources on that server. Had the same issue on my last 1.7 project. The problem came from the cache:clear's warmup (probably because sylius has tons of dependencies and I added a bunch more). You might wanna try editing the composer.json "scripts" to:
"scripts": {
"auto-scripts": {
"cache:clear --no-warmup": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
Or, as you did per your update, run the install with the --no-script flag followed by bin/console cache:clear --no-warmup (do make sure you are installing the assets after that).
Cache will then be generated on your first visit to the website instead of being generated thru warmup.
This is a problem not just with the install, you'll have to use this workaround each time you wanna clear cache. My project is in production and working well using this, just gotta remember to visit the website once you did so that a random user doesn't have longer loading because the cache hasn't been generated yet.

backorder functionality not working in magento2.3.2

I am using magento2.3.2. My website product backorder functionality is not working on the frontend.
I have done all steps below:
configure backorder in catalog->inventory- and set the Backorders - allow quantiy o and notify customer
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
I have run all the commands but my backend changes do not reflect in the frontend.
Before it was working fine but after migration and enabling varnish cache then issues happen.
So let me know how I can solve this.
To flush the Varnish cache of your Magento store on the command line you can use
/data/web/magento2path/bin/magento cache:flush full_page
This will purge the Varnish cache of the local Varnish instance.

Magento 2.1.9 static files not generating on production - leaves admin blank (no styles, no scripts loading)

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.

How to turn on error messages in magento 2

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);
}

laravel 5 ide autocompletion

I want to switch to laravel 5, but have some trouble with ide - autocompletion. I'm using phpstorm.
In google, the answers always end up with suggesting to use https://github.com/barryvdh/laravel-ide-helper . But it seems like it is broken for Laravel 5.
The steps I am doing are:
Install Laravel 5
composer create-project laravel/laravel
Require ide-helper
composer require barryvdh/laravel-ide-helper
Added 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
....
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
Trying to generate the helper file
artisan ide-helper:generate
But it always breaks with following error:
exception 'InvalidArgumentException' with message 'There are no commands defined in the "ide-helper" namespace.' in C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php:501
0 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(535): Symfony\Component\Console\Application->findNamespace('ide-helper')
1 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console
\Application.php(192): Symfony\Component\Console\Application->find('ide-helper:gene...')
2 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Outpu
t\ConsoleOutput))
3 C:\xampp\htdocs\test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Out
put\ConsoleOutput))
4 C:\xampp\htdocs\test\artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
5 {main}
Maybe someone had the same issue and can help me.
I'm open for different solutions for autocompletion other than barryvdh's ide-helper.
I had the same problem and this fixed it:
Before you run php artisan ide-helper:generate command, make sure to php artisan clear-compiled and php artisan optimize as it's noted here. If this didn't fixed your problem, take a look at this and clean out PhpStorm cache by choosing this:
File | Invalidate Caches/Restart
After auto restarting, PhpStorm will index again and everything should work fine.
Sorry for my bad english.
Edited: After these steps import your Facades like this use Illuminate\Support\Facades\Auth link them inside your _ide_helper.php file like use Auth.
I ran into the same problem. These are the steps I took to fix it:
I double-checked that 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' was correctly added to the providers array in config/app.php.
I executed artisan clear-compiled. Had no effect
Executing php artisan config:clear fixed the problem.
This error occur when the package ServiceProvider isn't loaded.
If you have multiple config file (like for different environment), you must ensure that the service provider is well set in all the environment you which to use the package.
config/
local/
app.php
app.php
to verify if the service provider is correctly set to your application you can dump the app config:
dd(\Config::get('app.providers'));
Try this:
php artisan ide-helper:generate
Here is an updated gist as of this month. I have tested this and it works in PHPStorm.
Also you don't have to install this through composer. Copy the gist and save it in your root folder as _ide_helper.php.