Tuesday, 15 November 2016

Mahni-a Development Server Siam Dan

Introduction

PHP 7 lo chhuahna pawh a IT lama khawvel hmasawn chak dan thlir chuan a lo rei ve leh ta hle mai a. PHP 8-ah pawh kan hnaih leh rawk tawh mai thei a ni. Tun hmaa version an siamdan kalphung chhawm zelin PHP viltute pawhin PHP 7 hi tuaihnum chho zelin 7.0.1 - 7.0.13 thleng an peih tawh a. Version thar a lo pian hian a hmaa buaina awm neuh neuh (bug) te an fix bakah eng eng emaw thil tangkai an dahbelh rualin tul lo nia an hriat te an paih ve reng a ni. Kan sawi fo tawh angin PHP7 hi a chak tha hle a, tun aia chak tur hi chuan Engine thar hlaka an thlak tawh pawh a ngai ta ve ang. Chu lah tun dinhmunah thil harsa a nih a la rinawm bawk a. Kan peng thui deuh ta. Tun tumah hian PHP version thar ber PHP 7, Mysql Version thar ber Mysql 5.7 leh Apache Version thar ber Apache 2.4 hmanga mahni development enviroment setup dan kan sawi dawn a ni.

Apache Server atangin tan ang aw:

PHP hnathawh theia siamtu ber hi Apache Webserver a ni a. He thu ka ziak lai mek hian Apache Version 2.4.20 chu http://www.apachelounge.com/download/ link atang hian download theih a ni a. Hei aia thar pawh hi download tur a lo awm leh der tawh mai thei a ni. Download link-ah hian 32 bit leh 64 bit edition thlan tur a awm a. A pahnih hian Visual Studio 2015 (VC14)-a compile ve ve a ni a. PHP 7 hian 64 bit a mil tho avangin a hnuhnung zawk hi download mai tur a ni ang.



Download archive-ah hian Apacher24 folder a awm a, extract chhuah a. D:\samp (self apache-mysql-php) chhungah dah vek tur. Kan extract zawh vek hnu chuan a hnuaia mi ang hi kan folder structure tur chu a ni ang.

D:
  +—samp
    +—apache
      +— apache files leh folder zawng zawng awmna..etc..

Apache hian runtime atan Visual C++ Redistributable for Visual Studio 2015 a mamawh a. Chuvangin http://www.microsoft.com/en-us/download/details.aspx?id=48145 atang hian kan download ang. 32bit OS hmang kan nih chuan 32 bit download mai tur a ni ang a, 64 bit tan 64 bit download mai tur.

PHP 7 download
Server configuration lam chu lo dah tha phawt ila. PHP 7 nen a rualin kan configure zawk dawn a ni. PHP windows binary te chu windows.php.net-ah hian an dahkhawm a. Version chi a tam avangin kan Apache Server nena inmil tan kan thlan ve a ngai a ni. 64bit Windows kan hman chuan thread safe VC14 kan mamawh dawn tihna a ni. Thread Safe leh Non Thread Safe Binaries awmzia chu nakinah an ka sawi ang.
Non-thread version kan hman chuan PHP hi CGI binary angin kan install dawn tihna a ni.

PHP binary kan download chuan subfolder eng eng emaw kan siam a tul a. A hmasa berin D:\samp chhungah lut la. php tih folder siam la, hetah hian php file i download zawng zawng kha dahlut vek ang che. Folder dang pahnih kan siam leh ang a. htdocs-kan php code dahna tur leh tmp- temporary file session data vel dahna tur kan siam ang. Tichuan a hnuaia mi ang hi kan folder structure thar chu a ni ang:

D:
  +— samp
    +— apache
      +— apache files leh folder zawng zawng awmna..etc..
    +— htdocs (tunah chuan a la ruak rih)
    +— php
      +— dev
      +— ext
      +— extras
        +— ssl
         — openssl.cnf
      +— lib
         +— enchant
          — libenchant_ispell.dll
          — libenchant_myspell.dll
      +— sasl2
      (php file hrang hrang.....)
    +— tmp (tuna tan chuan a la ruak rih)

Configuration

Files leh folder te an awmna hmun tur a chunga kan siam-ah theuh khian kan dahluh vek tawh chuan Webserver leh php hnathawk thei tura kan configure thei tawh ang. Kan server siam tur hi drive dang danga copy kual pawha buai lo tura kan duh chuan relative path kan siam a ngai dawn a ni. Relative path kan configure dik chuan Pendrive atang pawhin kan server hi a run theih dawn tihna a ni.

A hmasa berin D:\samp\php\php.ini file hi a awmsa loh avangin kan siamchawp a ngai dawn a. php.ini-development tih kha a copy siam la. php.ini tiin a hmingthlak (rename) tur a ni ang. php.ini i siamthar chu hawng la. extension_dir tih hi zawng chhuak la; a thuziak hmaah ;(semicolon) i hmu ngei ang a. chu semicolon chu paih mai tur a ni. Tichuan,

;extension_die = "ext" tih chu
extension_dir = "..\..\php\ext" tia thlak tur a ni.

;(semicolon) kan paih hian extension kan tinung tihna a ni a. Hetiang hian extension dang pawh kan tinung zel thei a ni. Extension kan mamawh tlangpui te chu curl, gd2, mbstring, mysqli, sockets leh xmlrpc.

Temporary file leh session file vel awmna tur directory tmp kan siam tawh kha kan la hre reng ang a. Kha kha file kan upload vel temporary-a lo dah chhung nan leh session data dah nan php.ini tang bawk hian kan siam thei a ni. Tichuan

upload_tmp_dir = "..\tmp"
session.save_path = "..\tmp"

tih a lo ni tawh ang.

Apache Webserver Configuration file hi httpd.conf a ni a. D:\samp\apache\conf\httpd.conf chhungah kan hmu thei ang. httpd.conf hi kan hawn chuan configuration option tam tak kan hmu ang a. Kan thlak ngai te chu —› veilamah ka dah zel a, dinglama mi hi a thlakna tur a ni ang.

ServerRoot "C:/Apache24"        —›    ServerRoot ".."
Listen 80        —›    Listen 82
LoadModule php7_module "../php/php7apache2_4.dll"

#ServerName www.example.com:80 —› ServerName localhost:82

Require all denied (Directory tag chhungah) —› Require all granted

DocumentRoot "C:/Apache24/htdocs"    —›    DocumentRoot "..htdocs

<Directory "C:/Apache24/htdocs">    —›    <Directory "../htdocs">

DirectoryIndex index.html    —›    DirectoryIndex index.oho index.html

AddType application/x-httpd-php .php
(He thil hi <IfModule mime_module> directive tawpah dah tur a ni a. Directive AddType application/x-gzip. gz .tgz hnungah tihna a nih chu)

I file tawpa a hnuaia mi hi dah leh bawk ang che
PHPIniDir ../php

Port 80 hi default port a ni a. Skype leh application dang dang te hian port 80 hi an lo hmang ve nawlh thin a, chuvangin kan port atan hian 82 kan hmang ta a ni. Port number hi kan siamchawp a nih chuan URL-ah pawh type tel zel a ngai tih hriat tur. Chuvangin http://localhost or http://127.0.0.1 hmang ringawtin i lut thei dawn lo va. port number kha i ziah leh a ngai dawn a ni. Tichuan i url thar tur chu http://localhost:82 or http://127.0.0:82 tih tur. Port number dang dang pawh hman vek theih a ni a, a free em tih check hmasak phawt a tha ang.

He tutorial-a configuration kan hman te hi Testing na mai a nih avangin Production-ah chuan a hman chi dawn loh va. Entirnan `Require all granted` tih te hi a him lo a ni.

Testing
Test turin command prompt hawng la (Win+cmd) Apache Directory-ah a hnuaia mi ang hian lut ang che.

cd D:\samp\apache\bin

I server on turin a hnuaia mi hi type leh enter rawh:

httpd

Blank command prompt tih loh thil dang a rawn lan loh chuan a tha tihna a ni mai. Eng emaw error message dang lo lang a awm chuan Google pun la. I la tidik thei lo fo a nih chuan Stackoverflow-ah zawt tawp rawh.

Apache i start theih tawh chuan: htdocs chhungah index.php  file siam la, a hnuaia mi hi ziak rawh le:

<?php phpinfo();?>

I server a work ngei a nih chuan PHP Version 7.0.1 tih a chung berah i hmu kalh mai ang.

Database

PHP hian database software chi hrang hrang a hmang thei a. MYSQL nen hian an inkawp rem bik nia sawi thin a ni. Chuvangin tun tumah pawh hian Mysql kan setup tel ve dawn a ni. Mysql Community Edition hi a thlawnin Mysql Dev Site atangin download theih a ni. Mysql hi a lian ang reng ve hle bawk. 64 Bit OS kan hman chuan 64 bit OS version kha tunlai ber (latest) kha download mai tur a ni ang. MSI installer Version ni lovin a ZIP version kan download thung dawn a ni. Kan download zawh veleh kan folder structure-ah khan samp chhungah mysql folder kan siam ve ang. Tichuan kan folder structure pawh a hnuaia mi ang hi a ni tawh ang.


D:
  +— samp
    +— apache
      +— apache files leh folder zawng zawng awmna..etc..
    +— htdocs (tunah chuan a la ruak rih)
    +— php
      +— dev
      +— ext
      +— extras
        +— ssl
         — openssl.cnf
      +— lib
         +— enchant
          — libenchant_ispell.dll
          — libenchant_myspell.dll
      +— sasl2
      (php file hrang hrang.....)
    +— tmp (tuna tan chuan a la ruak rih)
    +— mysql
       (mysql community edition zip kan extract-na tur)

mysql directory-ah hian my-default.ini tih file a awm a. my.ini tia thlak(rename) tur a ni. MySQL hman theih tura setup kalkawng hmasa ber command hmanga initialize a ni.

bin\mysqld --initialize --console

A chunga mi kan run hian data directory te kan mysql folder-ah khan min siamsak dawn a ni. Hei bakah hian root account leh expired password a siam tel nghal bawk a. Data directory hi lo siam thei lo palh a nih pawhin basedir leh datadir command hmangin kan siamtir thei tho a:

bin\mysqld --initialize --basedir=D:samp\mysql --datadir=D:\samp\mysql\data --console

command prompt atang vekin a hnuaia command hmang hian mysql kan start thei ang.

bin\mysql -u root -p

expired password i thlak hma chuan engmah vak i tithei dawn lo va, chuvangin a hnuaia one-liner hmang hian thlak ang che:

mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourPassword';


Phpmyadmin

Mysql kan install zawh ruala pawimawh leh hmasa ber chu GUI hmanga database khawih theihna hi a ni. Command prompt atangin duh tawkin database chu kan siamin kan chawkkual vel thei tho va, mah se, rang zawk leh chiang zawka khawih nan chuan GUI tha tawk tak kan mamawh a ni. Man nei si lo, tha bawk si Phpmyadmin hi mysql database khawih nan chuan ka hman nasat leh tha ka tih ber a ni a. Kan setup-a lak luh dan lo sawi dawn teh ang.
Phpmyadmin version thar ber chu 4.6.4 a ni a, A hnuaia link atang hian download theih a ni.

https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.7z
https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.zip


Kan download zawh tawh chuan, kan folder main ber samp/ chhungah khan kan extract chhuak ang. A configuration hi a awlsam ang reng khawp tawh a. Kan extract chhuah zingah khan config.sample.inc.php file a awm tel a..chu chu config.inc.php tia thlak (rename) tur a ni. config.inc.php hi a lo awmsa theih tho avangin backup-a dahthat hmasak tur a ni ang.

Apache Service leh Mysql Service Install Dan:

Hei hi tamtak buaipui a nih bawk avangin rawn sawi tel hram thain ka hria a. Apache kan start hian blank command prompt a inhawng ngei ngei a...hei hi Laravel hmang thang te chuan kan bel viau ang. Mahse blank command prompt chu kan close a nih chuan Apache chu kan titawp (stop) tihna a ni. Tichuan Command Prompt kha hnawksak takin a lo awm ve reng tihna a nih chu. Chuvangin Command prompt lang buai miah lo va, a ruala mysql leh apache start dan trick ho te kan sawi lang ve dawn a ni.



Apache Service Install dan:
Command prompt hawng la, i apache folder chhunga bin-ah cd lut la, a hnuaia command hi type ang che.
httpd.exe -k install -n "Apache2.4"
Mysql Service install dan:
Command prompt hawng la, mysql folder chhunga bin-ah cd lut  la, a hnuaia command hi type leh enter ang che:
mysqld --install
 Awle Mysql service leh Apache Service kan install tawh chuan Windows kan start/on apiangin kan server chu a hman ve nghal theih zel dawn tihna a ni.

Mysql Service install-na leh Apache Service install-na tur hi setup mawl te pakhat ka siam a, nakinah ka la rawn phochhuak ve ang....