Yii2 and MongoDb configuration with PHP7.0-fpm and NGiNX
| Yii2

peclList to do:
– Install MongoDB on Debian/Linux
– Install requires MongoDB PHP Extension
– Install MongoDB Extension for Yii 2
– Yii2 file configuration to use MongoDB

Install MongoDB on Debian/Linux

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl enable mongod.service
sudo systemctl start mongod

Check service MongoDB

sudo systemctl status mongod

Install requires MongoDB PHP Extension

sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
sudo pecl install mongodb

add extension=mongodb.so in fpm and cli:

sudo echo "extension=mongodb.so" >> /etc/php/7.0/fpm/conf.d/30-mongodb.ini
sudo echo "extension=mongodb.so" >> /etc/php/7.0/cli/conf.d/30-mongodb.ini

Restart services:

sudo systemctl restart php7.0-fpm
sudo systemctl reload nginx

Install MongoDB Extension for Yii 2

composer require --prefer-dist yiisoft/yii2-mongodb

Yii2 file configuration

return [
    //....
    'components' => [
        'mongodb' => [
            'class' => '\yii\mongodb\Connection',
            'dsn' => 'mongodb://developer:password@localhost:27017/mydatabase',
        ],
    ],
];

and in code example:
$collection = Yii::$app->mongodb->getCollection('test');

tnx for reading,


NGINX phpMyAdmin configuration on localhost
| DevOps

nginxIf NGINX and MariaDb/MySQL are installed, can start install and configuration phpMyAadmin (PMA). This article is for Linux system. If you need phpMyAdmin on server with access from internet, recommended see article NGINX phpMyAdmin configuration – remote server
Read more…


Installation LEMP – Linux Nginx MariaDB PHP7
| DevOps

maria db fundationIf we have installed Linux system, we can to go install the rest of the kit LEMP Linux, NGINX, MariaDb i PHP7. Since the first time, when I installed NGINX, Apache seems to me less attractive.
MariaDB instead MySQL I chose technical but also ehical reasons. Fast of PHP7 will improve the approach to this language. Together LEMP is very fast and powerful set.
Read more…


Can’t connect to Webdriver at http://127.0.0.1:4444/wd/hub
| PHP

php testsIf until tests acceptance of codeception you see error :Please make sure that Selenium Server or PhantomJS is running. I propose simple solution.
You can change in modul WebDriver to PhpBrowser Read more…


NGINX phpMyAdmin configuration on server remote
| NGINX

nginxAfter install NGINX ns MariaDb/MySQL we can start install and configuration phpMyAdmin (PMA). This article is for Linux system with remote access (remember security). If you configuring PMA on localhost Read more…


Yii2: configuration of the framework, components and modules
| Yii2

yii2 logoConfiguration file Yii2 basic template is in the path config/web.php. In case of configuration Yii2 advanced template, frontend and backend have their own configuration files: frontend/config/main.php and backend/config/main.php
Additionally, get the configuration from a common file common/config/main.php Read more…


Nginx config for Yii2 advanced project
| Yii2

nginxTo work properly Yii2 framework with NGINX, have to do:
Do poprawnej pracy frameworka Yii z serwerem HTTP Nginx, nale┼╝y:

  1. Install framework Yii2 template advanced
  2. Configuration NIGNX in config file
  3. Configuration Yii2 in backend config file

Read more…


Yii2 form field
| Yii2

yii2 logo
This description is for Yii2 forms with model.
Form can have many type of fields. e.g:

  1. Field input (single-line)
  2. Field textarea (multi-line)
  3. Field radio (one choice)
  4. Field checkbox (one or several selection)
  5. Field select/dropDownList (one or several selection)
  6. Field hidden
  7. Field upload file
  8. Field password
  9. Field with a choice of type HTML5
    • text
    • rmail
    • password
    • date
    • number
    • Address URL
    • phone number
    • color
    • range

Read more…


Yii2 tests: Codeception configuration and first test
| Yii2

codeception logoThis tutorial is for Yii2 Basic Application Template. Yii2 especially the version 2.0.10+ help to begin tests with codeception. If Yii2 and codeception are install, we can compile and run default tests with command: (root path of application). Read more…


Redirect http to https and WWW to non-WWW NGINX Yii2 WordPress
| NGINX Yii2

nginx folderFull example redirect all HTTP requests to HTTPS and WWW to non-WWW with Nginx. You can use this for to WordPress, Yii2 basic application template. Read more…