All in one post for magento 2.x installation and after installation troubleshoot for window users

This blog is purely dedicated to window users who faced problem while installation or after installation with wamp server on windows.

* 500 internal server error while navigating to magento root folder from browser
 



A quick solution to this is 500 Internal Server Error when installing magento2.x on windows is
navigate to httpd.conf  file of apache server, and search for this line  LoadModule version_module modules/mod_version.so

you find # just before above line denoting that it is commented, you just have to uncomment this to load the required module on server, restart all services of your wamp.

you may find your installation on browser now works fine.


* After successfully installation of magento you may find this exception 

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/wamp64/www/mage23/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js

This happens only with windows user, not in linux or unix.

A quick solution to this issue is

Navigate to vendor>magento>framework>view>element>template>file>validator.php
and replace this function by below code and run deploy command



protected function isPathInDirectories($path, $directories) {
>     if (!is_array($directories)) {
>         $directories = (array)$directories;
>     }
>     $realPath = $this->fileDriver->getRealPath($path);
>     $realPath = str_replace('\\', '/', $realPath); // extra code added
>     foreach ($directories as $directory) {
>         if (0 === strpos($realPath, $directory)) {
>             return true;
>         }
>     }
>     return false; }






Comment




* Magento 2 Allowed Memory exhausted error when compile code





A quick solution for memory limit in Magento 2 command is directly adding memory limit inside command.
For Compilation command,
php -dmemory_limit=5G bin/magento setup:di:compile 
For Deployment
php -dmemory_limit=5G bin/magento setup:static-content:deploy -f
You can change as per 5G to max if issue not resolve.


A permanent solution to this edit your php.ini file like below, search for all three parameters and change their values like this:

max_execution_time = 1800
max_input_time = 1800
memory_limit = 1024M
* Product not adding into cart showing session expired, while adding products into cart

A quick solution to this is  Magento 2 Allowed Memory exhausted error when compile code

navigate to server's db core_config_data table and run these sql querirs to replace localhost to 127.0.0.1 . This works fine for me.  Don't forgot to change your magento folder in url:

UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/secure/base_url';


* Broken css on front end as well as admin after fresh installation of magento or version along 
with all css or js local resources.








Generally, it doesn't occurred but some time with some versions of magento there may be a chance of above mentioned issue, i had tried on magento 2.8.2 with out sample data on windows same thing happens with me.

A quick solution to above issue is that, again navigate to pma (server's db) then navigate to core_config_data table and insert an other  row with path ="dev/static/sign" with value ="0".

That's all i faced while getting started, if you faced any other issue which are not mentioned here then please comment down i will look into that.






Some of other issues are mentioned with their solution here and here

Comments

Popular posts from this blog

Jasper report integration in Spring boot/Spring MVC.

FireBase Crud operation in Spring Boot

Xero Developer account setup with REST API auth flow.