Sohaib's Tech Blog

Something for every one

Magento 2.x: Required parameter ‘theme_dir’ was not passed — 2017

Magento 2.x: Required parameter ‘theme_dir’ was not passed

This error message appears in Magento 2 when you deleted a theme directory and the theme registry reminds in the database.

To fix this issue you need to go to app/design/frontend and check which themes you have installed.
Then go to the database and execute the following command:

SELECT * FROM theme;

Check what is the extra theme in that table and remove the registry.

Clear cache and that should be it.

Advertisements
Displaying Files like phpinfo.php Nginx — 2017

Displaying Files like phpinfo.php Nginx

Problem I was having was is basically I cannot run a simple info.php inside my public_html after doing some research I came up with this rewrite if you’ve any other solution do let me know it works for me.

Nginx

This is to display all files inside your /home/domain/public_html

location / {

location ~ ^/(.+.php)$ {
try_files $uri =404;
root $MAGE_ROOT;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
try_files $uri $uri/ /index.php?$args;
}

 

Magento2 Set Anchor to YES in all Categories —

Magento2 Set Anchor to YES in all Categories

I am assuming you’ve PHPMYADMIN , not going in detail as to how you install that and all that crap

First identify the attribute id of the is_anchor attribute:

SELECT * FROM eav_attribute where attribute_code = 'is_anchor';

I get attribute 54 as my query not sure what you will get as that’s all depends on your environment

Now let’s run a Query to update all category to Anchor YES

UPDATE catalog_category_entity_int set value = 1 where attribute_id = 54;

TADA !!!!!!

Magento Page Cache Warming — 2017

Magento Page Cache Warming

Lets use a simple software to warm pages so they load faster and already in cache.

Before we do anything we need to install the following software

sudo apt-get install libxml-xpath-perl siege -y

Now lets setup Sitemap in Magento prior doing anything  – assuming that’s all taken care follow the following steps.

cat /home/yoursite/public_html/sitemap.xml | xpath -q -e "/urlset/url/loc/text()" > /root/tmp.urls

If the file is not local simply run the following

curl --silent http://example.com/sitemap.xml | xpath -q -e "/urlset/url/loc/text()" > tmp.urls

Now let’s make it warm

siege -v -c 1 -r `cat tmp.urls | wc -l` -f /root/tmp.urls

That’s it.

Magento 2 – (2.13) Failed to load resource: the server responded with a status of 404 (Not Found) **Solved —

Magento 2 – (2.13) Failed to load resource: the server responded with a status of 404 (Not Found) **Solved

After spending sometime with Magento 2 (2.13) , as I am running Nginx and PHP 7 fpm I was getting a lot of error and after some research I was able to find a solution simply replace location static in given magento 2 nginx configuration file and restart nginx and php fpm server to reflect changes.

location /static/ {
    if ($MAGE_MODE = "production") {
      expires max;
    }

    # Remove signature of the static files that is used to overcome the browser cache
    location ~ ^/static/version {
      rewrite ^/static/(versiond*/)?(.*)$ /static/$2 last;
    }

    location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
      add_header Cache-Control "public";
      add_header X-Frame-Options "SAMEORIGIN";
      expires +1y;

      if (!-f $request_filename) {
        rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
      }
    }

    location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
      add_header Cache-Control "no-store";
      add_header X-Frame-Options "SAMEORIGIN";
      expires off;

      if (!-f $request_filename) {
         rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
      }
    }

    if (!-f $request_filename) {
      rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
    }

    add_header X-Frame-Options "SAMEORIGIN";
  }

 

How to install Nginx Google Page Speed on Ubuntu 16.10 x64 Xenial — 2017

How to install Nginx Google Page Speed on Ubuntu 16.10 x64 Xenial

Happy New Year !!!!!!

I am not going to bore you guys, I’ve already completed the building process and the hard work so you can enjoy .

Install Nginx with Google Page speed

At the time of building this we’ve latest stable version of

nginx version: nginx/1.10.2
built by gcc 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled

You need to install nginx deb package by simply running the following command

nginx_1.10.2-1-xenial_amd64.deb

Download Nginx Google Pagespeed

How to install Nginx Page Speed on Debian x64 Jessie —

How to install Nginx Page Speed on Debian x64 Jessie

Happy New Year !!!!!!

I am not going to bore you guys, I’ve already completed the building process and the hard work so you can enjoy .

Install Nginx with Google Page speed

At the time of building this we’ve latest stable version of

nginx version: nginx/1.10.2

built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1t 3 May 2016
TLS SNI support enabled

You need to install nginx deb package by simply running the following command

dpkg -i nginx_1.10.2-1-jessie_amd64.deb

Download Nginx Google Pagespeed

Google Pagespeed latest version as of Jan-4-2017