28

The command setup:di:compile command generates the contents of the var/di folder in Magento <2.2 and generated for Magento >= 2.2 According to Magento, this serves the following purpose: Application code generation (factories, proxies, and so on) Area configuration aggregation (that is, optimized dependency injection configurations per area) ...


22

If you enabled one or more modules, then you will need to run magento setup:upgrade to update the database schema. By default, magento setup:upgrade clears compiled code and the cache. Typically, you use magento setup:upgrade to update components and each component can require different compiled classes. magento setup:upgrade --keep-generated The optional ...


15

It's not mandatory to run setup:di:compile command everytime but if you have done any code change specially with factory methods ,proxy, add plugins or any code compilation then you must need to run this command. More Details magento setup:di:compile in order to generate necessary files. Both options ends up with generating classes in MAGENTO_ROOT/var/...


5

Use: php bin/magento config:set system/full_page_cache/caching_application 2 And follow the same patterns for the other paths, like so: php bin/magento config:set system/full_page_cache/varnish/access_list localhost php bin/magento config:set system/full_page_cache/varnish/backend_host localhost php bin/magento config:set system/full_page_cache/varnish/...


4

You should not have an initial forward slash. Make sure you are in root of magento directory and run: php bin/magento indexer:reindex or bin/magento indexer:reindex rather than: php /bin/magento indexer:reindex If this still does not work execute permissions are not present for bin/magento and you will get a different error 'Permission Denied'. To ...


4

Simple, try the following commands. I have encountered this error, and I have overcome. rm -rf var/di/* rm -rf pub/static/_cache/* rm -rf pub/static/frontend/* rm -rf var/generation/* rm -rf var/cache/* rm -rf var/page_cache/* rm -rf var/view_preprocessed/* In magento 2 var/di has been replaced by generated/metadata var/generation has been replaced by ...


3

Magento will still run in production and dev without the di:compile command. It will actually compile the Interceptors as it needs to and store the in the generated folder. Even if it works, that does not mean you should skip this step! In fact, when this is ran, magento also checks for duplicated injections, dependency loops and other fundamental steps ...


3

There is No need to reinstall PHP. You just do this command php7.0-cli bin/magento list command


3

what is the output of: ls -l $(which php) For me this is showing: /usr/bin/php -> /etc/alternatives/php Also check the output of this: echo $PATH And look for any path to the wrong php, maybe you only need to fix the $PATH. If this is not working try this to reinstall the whole package, overwriting the original files: sudo apt-get install --...


3

You should definitely set Magento to maintenance mode before running setup:upgrade or setup:di:compile in production. setup:upgrade clears both the generated/code and pub/static folders which will most likely result in your customers seeing an error page. Since they can't use the store anyways it is best to present them the maintenance page so they know the ...


2

Remove cache manually from these directories except .htaccess file: pub/static (except .htaccess) var/cache var/di var/page_cache var/view_preprocessed (except .htaccess) It will work by these only. Comment If didnt


2

How about adding mysql script.sql with the following contents: insert into core_config_data(scope,scope_id,path,value) values ('default',0,'system/full_page_cache/caching_application',2), ('default',0,'system/full_page_cache/varnish/access_list','localhost'), ('default',0,'system/full_page_cache/varnish/backend_host','localhost'),('default',0,'system/...


2

I just have starter env file what i copy to 'app/etc/env.php' before running the installer command: <?php return array( 'session' => array( 'save' => 'redis', 'redis' => array( 'host' => '127.0.0.1', 'port' => '6379', 'password' ...


2

You should execute the magento-cli script directly, not via the PHP interpreter: cd /opt/bitnami/apps/magento/htdocs sudo bin/magento-cli setup:upgrade Also, make sure you are logging in to the box as the "bitnami" user. If you're on EC2, it will by default suggest the "ubuntu" user. While logging in does work, it appears to cause some issues when the ...


2

Add this code in a php file. And run this file in browser. <?php print_r(system('php bin/magento setup:upgrade'));


2

Yes you can do it by using php file. Create a php file on root folder and paste this code. <?php if(isset($_POST['command_name'])){ echo "<pre>"; print_r(system('/usr/bin/php '.$_POST['command_name'])); } ?> <form action="" method="post"> <label>Command</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>...


2

Try below command it will deploy your content php bin/magento set up:static-content:deploy -f as per Magento 2's documentation Default and developer modes: Magento generates them on demand, but the rest are cached in a file for speed of access. From Magento 2.2 Manual static content deploy is not required. But you may still do that with -f option. ...


2

Turned out to be an issue with multiple versions of PHP being installed on the same VPS and running Plesk. Setting up an independent VPS only running PHP 7.0.16 fixed the errors.


2

setup:upgrade cleans all the files in the directories /generated/code/ /generated/metadata/ /pub/static/ and also deletes file deployed_version.txt however force deploy - php bin/magento setup:static-content:deploy -f in developer mode regenerates all the above folders and files and recreates /pub/static/deployed_version.txt back again along with /var/...


2

In production mode setup:upgrade will clear all static content, this could cause problems for any customers browsing the site who may end up with a nasty error message. I always switch to maintenance mode before doing this and use a nice custom maintenance page to tell customers what is happening. I find a deploy script useful to run all the compile and ...


1

It seems you have locked the admin / configuration changes using the app:config:set command. Now the only option you have is to make necessary changes in your config.php. Entries would be like: 'js' => [ 'merge_files' => '0', 'minify_files' => '0', 'minify_exclude' => ' /tiny_mce/'...


1

Set PHP Version 7.2 Your problem is solved. I have checked and it's working for me.


1

The problem might be caused due to the magento / .htaccess file missing under the folder magentoroot/../bin Also,check the current PHP version in your terminal using below command php -v To know the path of the php whereis php Based on the Magento version, you need to set the php version.


1

The static view files deployment command enables you to write static files to the Magento file system when the Magento software is set for production mode. The term static view file refers to the following: “Static” means it can be cached for a site (that is, the file is not dynamically generated). Examples include images and CSS generated from LESS. “View”...


1

You can use the following commands to enable Redis (taken from this page and this page in DevDocs): bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis.example.com --cache-backend-redis-db=0 bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redis.example.com --page-cache-redis-db=1 bin/magento setup:...


1

I have a patch for app/etc/env.php (smth like this): Index: app/etc/env.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- app/etc/env.php (revision ) +++ app/etc/env.php (revision ) @@ -1,5 +1,27 @@ <?php return array ( + /* ...


1

For a local environment setup, I put into puppet some commands for adding Redis to the local environment. Two files: <?php // magento-configured-with-redis.php $file = '/var/www/Magento/app/etc/env.php'; if (!file_exists($file)) { exit(1); } $data = require($file); if (!isset($data['session']) || !isset($data['session']['save']) || $data['...


1

Just in case someone else comes across this, it was solved by changing the default version of php to the latest one in plesk For example, my system php is 5.5: $ php -v PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:23:08) $ which php /usr/bin/php But I want to use php 5.6 installed by Plesk: $ /opt/plesk/php/5.6/bin/php -v PHP 5.6.13 (cli) (built: Sep ...


1

I got this exact same error when i was working on a site that was remotely hosted but i had the mounted on my machine using sshfs. When i tried to do this locally i got your error. When i logged into the remote serve through ssh i was able to run setup:upgrade just fine. So this points to issues with your connection to MySQL. As your set up is most likely ...


1

I think system() function will be your friend, if you don't have permission of CLI or If you don't want to use CLI. To use this function , just simple create new file in your root server(Let's call it custom.php), then write below code in this file system('php bin/magento module:status'); // you can change it to your command And run this script with http:/...


Only top voted, non community-wiki answers of a minimum length are eligible