SlideShare a Scribd company logo
1 of 43
Download to read offline
Setting Advanced
PHP Development Environment
What is development environment?
 A set of all tools that we need to develop a solution (Web

application)
 Mainly we need
Operating System
Server Software
Database

Programming Language

2
LAMP
 Stands for Linux-Apache-MySQL-PHP

(At least in theories)
 Linux – Operating System
 Apache – Web server
 MySQL – Database
 PHP – Programming Language

 This is just a general definition.
 In modern app, all 4 can be changed.

 So what are possible options?

3
Operating System
 Linux – LAMP

 Windows –WAMP
 Mac OS – MAMP
 Or any other Operating system.

4
Web Server Software
 Apache

 Nginx

(Pronounced Engine X)

 Lighttpd

 IIS
5
Database
 MySQL

 PostgreSQL
 Oracle
 MS SQL Server

 Maria DB
 IBM DB 2
 MongoDB
 Cassandra
 Neo4J
6
Programming Language

7
Setting Basic Dev Env
 OS: you must be having.

 Lets assume Windows or Linux.
 Lets set basic PHP development environment on

8
Basic Dev-Env on Windows
 WAMP Server



XAMPP

 Standalone Apache, MySQL, PHP

9
Basic Dev-Env on Windows
 Why WAMP/XAMPP?
 Easy one click setup.
 Easy to manage Apache/PHP

modules
 Can switch PHP/MySQL
versions (limited to available
on WAMP)

10

 Why Standalone?
 More control over different

versions.
 Can replicate production
server better.
Basic Dev-Env on Windows
 WAMP or XAMPP?
 Personal preference.
 WAMP is windows only,

while XAMPP is cross
platform.
 My personal preference (if that matter) is

WAMP.
 Here I’m concentrating on WAMP.
11
Installing WAMP
 Download installer from http://www.wampserver.com/en/
 Install as any windows program

(Double click installer

12

)
Starting WAMP

13
Working with

14
Basic Dev-Env on Linux

Which Linux?

15
Basic Dev-Env on Linux

16
Basic Dev-Env on Linux

17
Apache
apt-get update
apt-get install apache2

yast2 -i apache2

To start with System
Systemctl enable apache2.service
systemctl start apache2.service
18
MySQL
apt-get install mysql-server mysql-client

yast2 -i mysql mysql-client
mysql-community-server
To start with system
systemctl enable mysql.service
systemctl start mysql.service
19
MySQL
mysql_install_db

mysql_install_db

20
PHP
apt-get install php5 libapache2-mod-php5

yast2 -i apache2-mod_php5

21
Restarting Apache
sudo service apache2 restart

sudo systemctl restart apache2.service

22
PHP Modules
apt-get install php5-mysql php5-curl php5-gd php5intl php-pear php5-imagick php5-imap php5-mcrypt
php5-memcache php5-ming php5-ps php5-pspell
php5-recode php5-snmp php5-sqlite php5-tidy
php5-xmlrpc php5-xsl php5-cli

yast2 -i php5-mysql php5-curl php5-gd php5-intl phppear php5-imagick php5-imap php5-mcrypt php5memcache php5-ming php5-ps php5-pspell php5recode php5-snmp php5-sqlite php5-tidy php5xmlrpc php5-xsl php5-cli
23
So LAMP/WAMP is now up and
running
You can develop and work on nearly any web application.

But
Is it sufficient?
24
Example
 Suppose you are making a site






25

http://www.abccorp.com
Where will you put files?
X:wampwwwabccorp
How will you access site?
http://localhost/abccorp
If you are using framework, say symfony
http://localhost/abccorp/web
Would you like to use
http://local.abccorp.com
Virtual host on WAMP
 Step 1: update hosts file

 Open notepad as administrator.
 Open file

C:Windowssystem32drivers
etchosts
 Add following line at bottom
127.0.0.1 local.abccorp.com

26
Virtual host on WAMP
 Step 2: Update httpd.conf

 Search and uncomment

# Include conf/extra/
httpd-vhosts.conf

27
Virtual host on WAMP
 Open file
X:WAMPWWWapacheapacheXXXconfextrahttpd-vhosts.conf

 Add following:
<VirtualHost *:80>
ServerAdmin emailaddress@domain.com
DocumentRoot "c:projectsabccorp"
ServerName local.abccorp.com
ErrorLog "logs/abccorp.log"
CustomLog "logs/abccorp-access.log" common
</VirtualHost>

 Restart apache and access http://local.abccorp.com

28
Virtual host on Ubuntu
 Open /etc/hosts file in editor and add





29

127.0.0.1 local.abccorp.com
Copy /etc/apache2/sites-available/default to
/etc/apache2/sites-available/local.abccorp.com
Edit newly created file and change
ServerName local.abccorp.com
<VirtualHost *:80>
ServerAdmin webmaster@abccorp.com
ServerName local.abccorp.com
ServerAlias local.abccorp.com
Virtual host on Ubuntu
 Also update document root

DocumentRoot /path/to/project/web/root
 Enable site
a2ensite local.abccorp.com
 Reload and restart apache
service apache2 reload
service apache2 restart
 Access site local.abccorp.com

30
JDK or JRE
 Yes, even as PHP developer, we need Java Development Kit

of at least Java Runtime environment because:
IDE
Many Java based tools, important during SDLC.

• Nearly all OS come with some JRE (Not Sun/Oracle JRE)
• For best result, prefer Oracle JDK or JRE.
• Download installer from
http://www.oracle.com/technetwork/java/javase/downloads/index.html

• And follow instruction to install.

31
PEAR
 PHP Extension and Application Repository.

 Lot of good PHP extensions/library.
 Install system based dependencies by default.
 Personally: Composer recommended.

32
Composer
 Composer is PHP Dependency Manager, which install

project specific dependencies.
 Most modern framework now use composer for
downloading dependencies.
 PHP-FIG effect.

33
Installing Composer

 Linux

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

 Windows

Download installer from getcomposer.org
34
PHP Unit
 PHP Unit is Unit testing framework/tool.

 Do you need Unit Testing?
 NO because:
I’m genius and never make mistake.
No budget (My client can afford bugs but budget cant be

increased)
I don’t want to learn something new (I do not care … )
• Yes, but I don’t know how to test?
No issue, install it and learn it.

35
Installing PHP Unit
 With Composer
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}

 With PHAR
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
phpunit –version
php phpunit.phar --version

36
Code Quality
 Any fool can write a code that computer can understand.

Good developers write code that humans can understand.
– Martin Fowler.
 Refactoring/Design Patterns/Unit Testing/OOPs.
 At least start following coding conventions. Use code sniffer
to force you doing that.

37
Code Sniffer
 Installation

pear install PHP_CodeSniffer
 Usage

phpcs --standard=ZEND /path/to/code/file.php
 More Info

http://pear.php.net/manual/en/package.php.phpcodesniffer.intro.php

38
Virtual Machine
 Virtual Machine allow to run one virtual Operating System

from with in other, without dual booting.
 Most popular Virtual Machines are:
 Oracle Virtual Box.
 VM Ware

39
Vagrant, Puppet/Chef
 Vagrant is ‘Virtual Development Environment’.

 Puppet and Chef are ‘Configuration Management Software’.
 With proper use of Vagrant and Puppet/Chef, we can make

development environment, very similar to production
environment.
 Ensure all developers have same development environment.

40
Vagrant Setup
 Install Oracle Virtual Box

Go to www.virtualbox.org, download installer and install
Virtual Box.
 Install Vagrant
Go to www.vagrantup.com/downloads and download
suitable installer.
Install as per platform

41
Vagrant up
 Create new box

vagrant init precise32 http://files.vagrantup.com/precise32.box

 Start vagrant

vagrant up
This command will start server.
 Login to virtual machine
vagrant ssh
 Stop vagrant
vagrant halt
 Further steps
Configure vagrant box with Puppet/Chef
42
About Me & Question
 Name: Kapil Sharma (I’m not comedian)

 Twitter: @kapilsharmainfo

Any Question?

43

More Related Content

What's hot

MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)brian d foy
 
Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Kousuke Ebihara
 
One click deployment with Jenkins - PHP Munich
One click deployment with Jenkins - PHP MunichOne click deployment with Jenkins - PHP Munich
One click deployment with Jenkins - PHP MunichMayflower GmbH
 
[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...Azilen Technologies Pvt. Ltd.
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Stefan Koopmanschap
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony frameworkStefan Koopmanschap
 
MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )brian d foy
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsGraham Weldon
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHPGraham Weldon
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHPTareq Hasan
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneDavid Glick
 
PHP 4? OMG! A small vademecum for obsolete software migration.
PHP 4? OMG! A small vademecum for obsolete software migration.PHP 4? OMG! A small vademecum for obsolete software migration.
PHP 4? OMG! A small vademecum for obsolete software migration.Francesco Fullone
 
10 less-known Laravel Packages: April 2016
10 less-known Laravel Packages: April 201610 less-known Laravel Packages: April 2016
10 less-known Laravel Packages: April 2016Povilas Korop
 
Mpeg guide
Mpeg  guideMpeg  guide
Mpeg guidekimsach
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 MeetupGraham Weldon
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0Graham Weldon
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Engineor
 

What's hot (20)

معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراولمعرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
 
MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)
 
Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)
 
One click deployment with Jenkins - PHP Munich
One click deployment with Jenkins - PHP MunichOne click deployment with Jenkins - PHP Munich
One click deployment with Jenkins - PHP Munich
 
composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209
 
[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony framework
 
MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traits
 
Php7
Php7Php7
Php7
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHP
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHP
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
 
PHP 4? OMG! A small vademecum for obsolete software migration.
PHP 4? OMG! A small vademecum for obsolete software migration.PHP 4? OMG! A small vademecum for obsolete software migration.
PHP 4? OMG! A small vademecum for obsolete software migration.
 
10 less-known Laravel Packages: April 2016
10 less-known Laravel Packages: April 201610 less-known Laravel Packages: April 2016
10 less-known Laravel Packages: April 2016
 
Mpeg guide
Mpeg  guideMpeg  guide
Mpeg guide
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 Meetup
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
 

Similar to Setting advanced PHP development environment

2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida realPHP Conference Argentina
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopardtutorialsruby
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopardtutorialsruby
 
Php hypertext Preprocessor
Php hypertext PreprocessorPhp hypertext Preprocessor
Php hypertext PreprocessorMrsRLakshmiIT
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLkangaro10a
 
Debugging and Profiling PHP Applications
Debugging and Profiling PHP ApplicationsDebugging and Profiling PHP Applications
Debugging and Profiling PHP ApplicationsLogan Lindquist
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24Techvilla
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourRod Flohr
 
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
ZendCon 2015 - Laravel Forge: Hello World to Hello ProductionZendCon 2015 - Laravel Forge: Hello World to Hello Production
ZendCon 2015 - Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Combell NV
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerJackson F. de A. Mafra
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confooCombell NV
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTYWilliam Chong
 
1 pluginable laravel cms
1 pluginable laravel cms1 pluginable laravel cms
1 pluginable laravel cmsNareerat Chan
 

Similar to Setting advanced PHP development environment (20)

2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
 
Php
PhpPhp
Php
 
Php hypertext Preprocessor
Php hypertext PreprocessorPhp hypertext Preprocessor
Php hypertext Preprocessor
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQL
 
Debugging and Profiling PHP Applications
Debugging and Profiling PHP ApplicationsDebugging and Profiling PHP Applications
Debugging and Profiling PHP Applications
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel Tour
 
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
ZendCon 2015 - Laravel Forge: Hello World to Hello ProductionZendCon 2015 - Laravel Forge: Hello World to Hello Production
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Lamp Zend Security
Lamp Zend SecurityLamp Zend Security
Lamp Zend Security
 
WEBProgLab1.docx
WEBProgLab1.docxWEBProgLab1.docx
WEBProgLab1.docx
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant Killer
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
 
1 pluginable laravel cms
1 pluginable laravel cms1 pluginable laravel cms
1 pluginable laravel cms
 

Recently uploaded

Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 

Recently uploaded (20)

20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 

Setting advanced PHP development environment

  • 2. What is development environment?  A set of all tools that we need to develop a solution (Web application)  Mainly we need Operating System Server Software Database Programming Language 2
  • 3. LAMP  Stands for Linux-Apache-MySQL-PHP (At least in theories)  Linux – Operating System  Apache – Web server  MySQL – Database  PHP – Programming Language  This is just a general definition.  In modern app, all 4 can be changed.  So what are possible options? 3
  • 4. Operating System  Linux – LAMP  Windows –WAMP  Mac OS – MAMP  Or any other Operating system. 4
  • 5. Web Server Software  Apache  Nginx (Pronounced Engine X)  Lighttpd  IIS 5
  • 6. Database  MySQL  PostgreSQL  Oracle  MS SQL Server  Maria DB  IBM DB 2  MongoDB  Cassandra  Neo4J 6
  • 8. Setting Basic Dev Env  OS: you must be having.  Lets assume Windows or Linux.  Lets set basic PHP development environment on 8
  • 9. Basic Dev-Env on Windows  WAMP Server  XAMPP  Standalone Apache, MySQL, PHP 9
  • 10. Basic Dev-Env on Windows  Why WAMP/XAMPP?  Easy one click setup.  Easy to manage Apache/PHP modules  Can switch PHP/MySQL versions (limited to available on WAMP) 10  Why Standalone?  More control over different versions.  Can replicate production server better.
  • 11. Basic Dev-Env on Windows  WAMP or XAMPP?  Personal preference.  WAMP is windows only, while XAMPP is cross platform.  My personal preference (if that matter) is WAMP.  Here I’m concentrating on WAMP. 11
  • 12. Installing WAMP  Download installer from http://www.wampserver.com/en/  Install as any windows program (Double click installer 12 )
  • 15. Basic Dev-Env on Linux Which Linux? 15
  • 16. Basic Dev-Env on Linux 16
  • 17. Basic Dev-Env on Linux 17
  • 18. Apache apt-get update apt-get install apache2 yast2 -i apache2 To start with System Systemctl enable apache2.service systemctl start apache2.service 18
  • 19. MySQL apt-get install mysql-server mysql-client yast2 -i mysql mysql-client mysql-community-server To start with system systemctl enable mysql.service systemctl start mysql.service 19
  • 21. PHP apt-get install php5 libapache2-mod-php5 yast2 -i apache2-mod_php5 21
  • 22. Restarting Apache sudo service apache2 restart sudo systemctl restart apache2.service 22
  • 23. PHP Modules apt-get install php5-mysql php5-curl php5-gd php5intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-cli yast2 -i php5-mysql php5-curl php5-gd php5-intl phppear php5-imagick php5-imap php5-mcrypt php5memcache php5-ming php5-ps php5-pspell php5recode php5-snmp php5-sqlite php5-tidy php5xmlrpc php5-xsl php5-cli 23
  • 24. So LAMP/WAMP is now up and running You can develop and work on nearly any web application. But Is it sufficient? 24
  • 25. Example  Suppose you are making a site     25 http://www.abccorp.com Where will you put files? X:wampwwwabccorp How will you access site? http://localhost/abccorp If you are using framework, say symfony http://localhost/abccorp/web Would you like to use http://local.abccorp.com
  • 26. Virtual host on WAMP  Step 1: update hosts file  Open notepad as administrator.  Open file C:Windowssystem32drivers etchosts  Add following line at bottom 127.0.0.1 local.abccorp.com 26
  • 27. Virtual host on WAMP  Step 2: Update httpd.conf  Search and uncomment # Include conf/extra/ httpd-vhosts.conf 27
  • 28. Virtual host on WAMP  Open file X:WAMPWWWapacheapacheXXXconfextrahttpd-vhosts.conf  Add following: <VirtualHost *:80> ServerAdmin emailaddress@domain.com DocumentRoot "c:projectsabccorp" ServerName local.abccorp.com ErrorLog "logs/abccorp.log" CustomLog "logs/abccorp-access.log" common </VirtualHost>  Restart apache and access http://local.abccorp.com 28
  • 29. Virtual host on Ubuntu  Open /etc/hosts file in editor and add     29 127.0.0.1 local.abccorp.com Copy /etc/apache2/sites-available/default to /etc/apache2/sites-available/local.abccorp.com Edit newly created file and change ServerName local.abccorp.com <VirtualHost *:80> ServerAdmin webmaster@abccorp.com ServerName local.abccorp.com ServerAlias local.abccorp.com
  • 30. Virtual host on Ubuntu  Also update document root DocumentRoot /path/to/project/web/root  Enable site a2ensite local.abccorp.com  Reload and restart apache service apache2 reload service apache2 restart  Access site local.abccorp.com 30
  • 31. JDK or JRE  Yes, even as PHP developer, we need Java Development Kit of at least Java Runtime environment because: IDE Many Java based tools, important during SDLC. • Nearly all OS come with some JRE (Not Sun/Oracle JRE) • For best result, prefer Oracle JDK or JRE. • Download installer from http://www.oracle.com/technetwork/java/javase/downloads/index.html • And follow instruction to install. 31
  • 32. PEAR  PHP Extension and Application Repository.  Lot of good PHP extensions/library.  Install system based dependencies by default.  Personally: Composer recommended. 32
  • 33. Composer  Composer is PHP Dependency Manager, which install project specific dependencies.  Most modern framework now use composer for downloading dependencies.  PHP-FIG effect. 33
  • 34. Installing Composer  Linux curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer  Windows Download installer from getcomposer.org 34
  • 35. PHP Unit  PHP Unit is Unit testing framework/tool.  Do you need Unit Testing?  NO because: I’m genius and never make mistake. No budget (My client can afford bugs but budget cant be increased) I don’t want to learn something new (I do not care … ) • Yes, but I don’t know how to test? No issue, install it and learn it. 35
  • 36. Installing PHP Unit  With Composer { "require-dev": { "phpunit/phpunit": "3.7.*" } }  With PHAR wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunit phpunit –version php phpunit.phar --version 36
  • 37. Code Quality  Any fool can write a code that computer can understand. Good developers write code that humans can understand. – Martin Fowler.  Refactoring/Design Patterns/Unit Testing/OOPs.  At least start following coding conventions. Use code sniffer to force you doing that. 37
  • 38. Code Sniffer  Installation pear install PHP_CodeSniffer  Usage phpcs --standard=ZEND /path/to/code/file.php  More Info http://pear.php.net/manual/en/package.php.phpcodesniffer.intro.php 38
  • 39. Virtual Machine  Virtual Machine allow to run one virtual Operating System from with in other, without dual booting.  Most popular Virtual Machines are:  Oracle Virtual Box.  VM Ware 39
  • 40. Vagrant, Puppet/Chef  Vagrant is ‘Virtual Development Environment’.  Puppet and Chef are ‘Configuration Management Software’.  With proper use of Vagrant and Puppet/Chef, we can make development environment, very similar to production environment.  Ensure all developers have same development environment. 40
  • 41. Vagrant Setup  Install Oracle Virtual Box Go to www.virtualbox.org, download installer and install Virtual Box.  Install Vagrant Go to www.vagrantup.com/downloads and download suitable installer. Install as per platform 41
  • 42. Vagrant up  Create new box vagrant init precise32 http://files.vagrantup.com/precise32.box  Start vagrant vagrant up This command will start server.  Login to virtual machine vagrant ssh  Stop vagrant vagrant halt  Further steps Configure vagrant box with Puppet/Chef 42
  • 43. About Me & Question  Name: Kapil Sharma (I’m not comedian)  Twitter: @kapilsharmainfo Any Question? 43