This was tested on:
- Ubuntu 14.04 x64
- Ubuntu 16.04 x64
Install the xvfb server by running
| Apparel & Accessories | |
| Baby products | |
| Computers | |
| Books | |
| Electronics | |
| Health & Beauty | |
| Groceries | |
| Kitchen & Housewares |
| $template = 'dump'; | |
| $layout = false; | |
| $view = new View(new \Cake\Network\Request, new \Cake\Network\Response); | |
| foreach ($vars as $key => $value) { | |
| $view->set($key, $value); | |
| } | |
| $view->viewPath = 'Email\html'; \\src\Template\Email\html | |
| $view_output = $view->render($template, $layout); |
| #!/bin/sh | |
| ## backup each mysql db into a different file, rather than one big file | |
| ## as with --all-databases. This will make restores easier. | |
| ## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
| ## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
| ## Create the user and directories | |
| # mkdir -p /var/backups/mysql/databases | |
| # useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
| ## Remember to make the script executable, and unreadable by others |
| In your WinSCP tool: | |
| # Under the session section: | |
| Host name: 127.0.0.1 | |
| Port: 2222 | |
| Username: vagrant (or the username you have used to create the box) | |
| password: (leave it blank) | |
| # Under Advanced section: | |
| Under SSH -> Key Exchange |
| sudo apt-get install php7.0-pgsql | |
| sudo apt-get install php-pear | |
| sudo pear channel-discover phpseclib.sourceforge.net | |
| sudo pear remote-list -c phpseclib | |
| sudo pear install phpseclib/Net_SSH2 | |
| sudo service nginx restart |
| /* | |
| Installation: | |
| composer require madnh/fpdi-protection | |
| composer require setasign/fpdf:1.8 | |
| composer require setasign/fpdi:1.6.2 | |
| */ | |
| //PHP function to implement the basic password protection, code is self explanatory | |
| ```php | |
| public function pdfEncrypt($origFile, $destFile, $password_user, $password_owner) |
| ######################################## SITUATION ######################################### | |
| # Had to set environment variable somewhere in server block or crontab | |
| # so different databases are used by the cron function for staging and production environment | |
| # and operations are performed based on environment | |
| # Tried setting variable in /etc/php/7.0/fpm/pool.d/www.conf, but didnt worked for crons/shells | |
| # Also tried setting variable in /etc/environment but no luck for above purpose | |
| # I might have missed something in above 2 methods, but below one worked for me. | |
| ############################################################################################## | |
| SHELL=/bin/sh |
| <?php | |
| $this->Paginator->setTemplates([ | |
| 'first' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'prevActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'prevDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'current' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'nextActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'nextDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
| 'last' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>' |
| #!/bin/bash | |
| if [ "$EUID" -ne 0 ] | |
| then echo "Please run as root" | |
| exit | |
| fi | |
| apt-get install pkg-config libmagickwand-dev -y | |
| cd /tmp | |
| wget https://pecl.php.net/get/imagick-3.7.0.tgz | |
| tar xvzf imagick-3.7.0.tgz |