Friday, April 20, 2018

composer - mpdf - php fatal error : class mPDF not found

Same vendor folder of one server is not working on another server. There may be reason that working server has php 5.5 and non working server has php 5.6

Add following lines in file vendor/composer/autoload_classmap.php

'UCDN' => $vendorDir . '/mpdf/mpdf/classes/ucdn.php',
'bmp' => $vendorDir . '/mpdf/mpdf/classes/bmp.php',
'cssmgr' => $vendorDir . '/mpdf/mpdf/classes/cssmgr.php',
'directw' => $vendorDir . '/mpdf/mpdf/classes/directw.php',
'grad' => $vendorDir . '/mpdf/mpdf/classes/grad.php',
'mPDF' => $vendorDir . '/mpdf/mpdf/mpdf.php',
'meter' => $vendorDir . '/mpdf/mpdf/classes/meter.php',
'mpdfform' => $vendorDir . '/mpdf/mpdf/classes/mpdfform.php',
'otl' => $vendorDir . '/mpdf/mpdf/classes/otl.php',
'tocontents' => $vendorDir . '/mpdf/mpdf/classes/tocontents.php',
'wmf' => $vendorDir . '/mpdf/mpdf/classes/wmf.php',
Add following lines in file vendor/composer/autoload_static.php
'UCDN' => __DIR__ . '/..' . '/mpdf/mpdf/classes/ucdn.php',
'bmp' => __DIR__ . '/..' . '/mpdf/mpdf/classes/bmp.php',
'cssmgr' => __DIR__ . '/..' . '/mpdf/mpdf/classes/cssmgr.php',
'directw' => __DIR__ . '/..' . '/mpdf/mpdf/classes/directw.php',
'grad' => __DIR__ . '/..' . '/mpdf/mpdf/classes/grad.php',
'mPDF' => __DIR__ . '/..' . '/mpdf/mpdf/mpdf.php',
'meter' => __DIR__ . '/..' . '/mpdf/mpdf/classes/meter.php',
'mpdfform' => __DIR__ . '/..' . '/mpdf/mpdf/classes/mpdfform.php',
'otl' => __DIR__ . '/..' . '/mpdf/mpdf/classes/otl.php',
'tocontents' => __DIR__ . '/..' . '/mpdf/mpdf/classes/tocontents.php',
 'wmf' => __DIR__ . '/..' . '/mpdf/mpdf/classes/wmf.php',
Now run the same web page again in browser. You should not get error.

Lets encrypt error while renewing

The client lacks sufficient authorization :: Invalid response from

Full error :


Attempting to renew cert (domain.co.in) from /etc/letsencrypt/renewal/domain.in.conf produced an unexpected error: Failed authorization procedure. domain.co.in (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://domain.co.in/.well-known/acme-challenge/jfJj7OuSofik58w5Zv9QGADQFTR4OK_nfgVNOfg1xTw: "<!DOCTYPE html>
<html lang="en-US" class="bg-black">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width". Skipping.


Solution :
Do not renew it, instead of install certificates again
sudo certbot --apache -d domain.co.in

Install Lets encrypt on Linux AMI

Run Following Commands :
curl -O https://dl.eff.org/certbot-auto
chmod +x certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto

Make sure apache is running on 443 port and it is opened.

Install mod ssl using following command

sudo yum install mod24_ssl
We have used this command because we have installed httpd using `sudo yum install -y httpd24 php56 php56-mysqlnd`

If you have installed httpd using `sudo yum install httpd`, install mod_ssl using

`sudo yum install mod_ssl`
 
Now install certificates using

certbot-auto -d domain.com --debug

https://coderwall.com/p/e7gzbq/https-with-certbot-for-nginx-on-amazon-linux