PHP, LAMP* Stack &
WordPress
*LAMP = Linux, Apache, MySQL, PHP
Aug 28, 2018
Agenda
• Introduction to PHP & LAMP stack
• How PHP & LAMP took the world (at least, shared hosting) by storm
 Why PHP is widely used despite being among the “most disliked” languages!
• PHP applications & frameworks; Laravel
• WordPress (and why it powers 31% of the Internet / websites)
• Demo: installing LAMP, some simple PHP code, installing WordPress
PHP
• PHP: Hypertext Preprocessor
 Open source loves recursive acronyms! Other examples: GNU, cURL, RPM, WINE
 Used to be: Personal Home Page Tools (1994-1997)
• Developed by Rasmus Lerdorf in 1994
• PHP Versions
 Initally not meant to be a separate language: worked with CGI (Common Gateway
Interface) scripts / binaries to generate dynamic web pages
 PHP 3 & 4 (1997): re-write of initial PHP. Powered by new Zend Engine.
 PHP 5 (2004): support for OOP & classes, PDO (Data Objects), Windows support!
 Namespaces (backported from PHP 6 which was never released)
 PHP 7 (2014): mainly performance enhancements, reportedly up to 2x
 Multiple legacy features removed (PHP 4 constructor style, <? ?> delimiters)
Perl / Python
• P in LAMP stack could also refer to
Perl or Python
• Won’t be discussing those today
• Very different from PHP!
• Examples of directory iteration in
Perl (top) & Python (bottom)
• Today
 Perl used to be go-to script for DevOps
and sysadmins; now less popular
 Python has become Swiss army knife:
used in production systems, DevOps
scripts, automation, production systems
& even web frameworks
PHP Basics
• Early PHP (3 and 4) was similar to C
– actually used C function names
• PHP 5+ introduced OOP and
namespaces
• Embedded in HTML documents using
<?php and ?>. File saved as .php,
parsed server-side (web server with
PHP module) and sent as HTML.
 Similar to ASP.Net, JSP, etc
• Drop / copy your PHP files into a web
server, and they just run. No
compilation, build, etc.
 Deployment = test locally, commit to git,
SSH into server, “git pull”
Google Trends: PHP, Python, Perl
Most Disliked Languages
2017 Stackoverflow Survey
https://stackoverflow.blog/2017/10/31/disliked-programming-languages/
LAMP Stack
• LAMP = Linux, Apache, MySQL,
PHP (or Perl or Python)
 Linux = OS
 Apache = Web Server
 MySQL = Database
 PHP = Language
• WAMP = Windows, Apache,
MySQL, PHP
 MAMP = Mac OS, Apache, …
• MEAN = MongoDB, Express.js,
AngularJS, Node.js
• WISA (!) = Windows, IIS, SQL
Server, ASP.Net
Source: https://www.freelancinggig.com/blog/2017/08/04/lamp-stack-vs-wisa-stack-best-startup/
Shared Hosting & PHP’s Popularity
• Made popular by GoDaddy
• Bunch of contenders:
DreamHost, HostGator,
1and1, Bluehost, SiteGround
• Web presence at low prices;
multiple domains on 1 server
 $5-$10 a year for a domain
 $3-$10 a month for hosting =
$36 - $60 a year
• Small businesses flocked
towards them to set up a
.com web presence
• Guess what software they
were running on? LAMPSource: http://www.aiteducation.org/2016/07/shared-web-hosting-linux-or-windows/
PHP Applications: CMS, Commerce
Source: https://www.rishabhsoft.com/php-application-development
PHP Frameworks
• A few years ago, there were
several contenders –
CakePHP, Yii, Symfony,
CodeIgniter
• Today: Laravel leads the
pack
• All frameworks share
similar patterns
 MVC framework
 ORM (Object Relational
Mapping)
 Scaffolding (generate basic
application from models)Source: https://www.quora.com/Which-is-the-best-framework-for-PHP
WordPress: Most Popular CMS
• Most popular CMS (Content
Management System)
 Replaced Joomla & Drupal (also PHP)
• Initially started as blog system
• Now also popular e-commerce
platform (with WooCommerce)
 Replacing Magneto (also PHP)
• Open-source, built on PHP. Primarily
runs on LAMP stack
• Initially released in 2003 by Matt
Mullenweg when he was a student
 Now maintained by WordPress
Foundation (non-profit) and Automattic
(for-profit private company)
Source: https://thenextweb.com/dd/2018/03/05/30-of-the-web-now-runs-on-wordpress/
WordPress Screenshot

PHP, LAMP Stack & WordPress

  • 1.
    PHP, LAMP* Stack& WordPress *LAMP = Linux, Apache, MySQL, PHP Aug 28, 2018
  • 2.
    Agenda • Introduction toPHP & LAMP stack • How PHP & LAMP took the world (at least, shared hosting) by storm  Why PHP is widely used despite being among the “most disliked” languages! • PHP applications & frameworks; Laravel • WordPress (and why it powers 31% of the Internet / websites) • Demo: installing LAMP, some simple PHP code, installing WordPress
  • 3.
    PHP • PHP: HypertextPreprocessor  Open source loves recursive acronyms! Other examples: GNU, cURL, RPM, WINE  Used to be: Personal Home Page Tools (1994-1997) • Developed by Rasmus Lerdorf in 1994 • PHP Versions  Initally not meant to be a separate language: worked with CGI (Common Gateway Interface) scripts / binaries to generate dynamic web pages  PHP 3 & 4 (1997): re-write of initial PHP. Powered by new Zend Engine.  PHP 5 (2004): support for OOP & classes, PDO (Data Objects), Windows support!  Namespaces (backported from PHP 6 which was never released)  PHP 7 (2014): mainly performance enhancements, reportedly up to 2x  Multiple legacy features removed (PHP 4 constructor style, <? ?> delimiters)
  • 4.
    Perl / Python •P in LAMP stack could also refer to Perl or Python • Won’t be discussing those today • Very different from PHP! • Examples of directory iteration in Perl (top) & Python (bottom) • Today  Perl used to be go-to script for DevOps and sysadmins; now less popular  Python has become Swiss army knife: used in production systems, DevOps scripts, automation, production systems & even web frameworks
  • 5.
    PHP Basics • EarlyPHP (3 and 4) was similar to C – actually used C function names • PHP 5+ introduced OOP and namespaces • Embedded in HTML documents using <?php and ?>. File saved as .php, parsed server-side (web server with PHP module) and sent as HTML.  Similar to ASP.Net, JSP, etc • Drop / copy your PHP files into a web server, and they just run. No compilation, build, etc.  Deployment = test locally, commit to git, SSH into server, “git pull”
  • 6.
    Google Trends: PHP,Python, Perl
  • 7.
    Most Disliked Languages 2017Stackoverflow Survey https://stackoverflow.blog/2017/10/31/disliked-programming-languages/
  • 8.
    LAMP Stack • LAMP= Linux, Apache, MySQL, PHP (or Perl or Python)  Linux = OS  Apache = Web Server  MySQL = Database  PHP = Language • WAMP = Windows, Apache, MySQL, PHP  MAMP = Mac OS, Apache, … • MEAN = MongoDB, Express.js, AngularJS, Node.js • WISA (!) = Windows, IIS, SQL Server, ASP.Net Source: https://www.freelancinggig.com/blog/2017/08/04/lamp-stack-vs-wisa-stack-best-startup/
  • 9.
    Shared Hosting &PHP’s Popularity • Made popular by GoDaddy • Bunch of contenders: DreamHost, HostGator, 1and1, Bluehost, SiteGround • Web presence at low prices; multiple domains on 1 server  $5-$10 a year for a domain  $3-$10 a month for hosting = $36 - $60 a year • Small businesses flocked towards them to set up a .com web presence • Guess what software they were running on? LAMPSource: http://www.aiteducation.org/2016/07/shared-web-hosting-linux-or-windows/
  • 10.
    PHP Applications: CMS,Commerce Source: https://www.rishabhsoft.com/php-application-development
  • 11.
    PHP Frameworks • Afew years ago, there were several contenders – CakePHP, Yii, Symfony, CodeIgniter • Today: Laravel leads the pack • All frameworks share similar patterns  MVC framework  ORM (Object Relational Mapping)  Scaffolding (generate basic application from models)Source: https://www.quora.com/Which-is-the-best-framework-for-PHP
  • 12.
    WordPress: Most PopularCMS • Most popular CMS (Content Management System)  Replaced Joomla & Drupal (also PHP) • Initially started as blog system • Now also popular e-commerce platform (with WooCommerce)  Replacing Magneto (also PHP) • Open-source, built on PHP. Primarily runs on LAMP stack • Initially released in 2003 by Matt Mullenweg when he was a student  Now maintained by WordPress Foundation (non-profit) and Automattic (for-profit private company) Source: https://thenextweb.com/dd/2018/03/05/30-of-the-web-now-runs-on-wordpress/
  • 13.