SlideShare a Scribd company logo
1 of 146
Download to read offline
SysAdmin skills for PHP developers
                          Pablo Godel @pgodel - March 13, 2013
                             South Florida PHP Users Group
                                   http://joind.in/8376


Thursday, March 14, 13
Agenda


                          - Why SysAdmin Skills
                         - Introduction to LAMP
                         - Hosting options
                         - Linux distributions
                         - Installing PHP options
                         - Deploying PHP
                         - Various production tips
                         - Monitoring
                         - Backups




Thursday, March 14, 13
Who Am I?

    ⁃ Born in Argentina, living in the US since 1999
    ⁃ PHP & Symfony developer
    ⁃ Founder of the original PHP mailing list in spanish
    ⁃ Master of the parrilla




Thursday, March 14, 13
Who Am I?

    ⁃ Born in Argentina, living in the US since 1999
    ⁃ PHP & Symfony developer
    ⁃ Founder of the original PHP mailing list in spanish
    ⁃ Master of the parrilla




Thursday, March 14, 13
Thursday, March 14, 13
ServerGrove!

      ⁃ Founded ServerGrove Networks in 2005

      ⁃ Provider of web hosting specialized in PHP,
        Symfony, ZendFramework, and others

      ⁃ Now with servers in Miami, FL and Dublin, Ireland

      ⁃ Mongohosting.com!




Thursday, March 14, 13
Community is our teacher
            ⁃ Very active open source supporter through code
              contributions and usergroups/conference sponsoring




Thursday, March 14, 13
Who needs them?




                         Sysadmin Skills


Thursday, March 14, 13
Text




                         IT is busy / Different Priorities
Thursday, March 14, 13
!Rocket Science
Thursday, March 14, 13
Lack of control
Thursday, March 14, 13
Less downtime
Thursday, March 14, 13
Better Performance
Thursday, March 14, 13
What do you prefer?
Thursday, March 14, 13
Or this?
Thursday, March 14, 13
I am limited to line
               commands.
               I don’t do line commands
               in Linux.
               Either they can install the
               Centos desktop, or they
               can just send me the files.
                         An example...
Thursday, March 14, 13
What is




                         LAMP

Thursday, March 14, 13
Thursday, March 14, 13
Thursday, March 14, 13
Thursday, March 14, 13
                         LAMP
Thursday, March 14, 13
                         LAMP
Thursday, March 14, 13
                         LAMP
Scott Beale




Thursday, March 14, 13
                         LAMP
Thursday, March 14, 13
                         LNMP
Thursday, March 14, 13
                         LNMP
Thursday, March 14, 13
                         LNPP
Thursday, March 14, 13
                         LANMMPP
Why?




                         LANMMPP

Thursday, March 14, 13
Why LANMMPP




                          Proven


Thursday, March 14, 13
Why LANMMPP




                           Stable


Thursday, March 14, 13
Why LANMMPP




                          Secure


Thursday, March 14, 13
Why LANMMPP




                            Free




Thursday, March 14, 13
Why LANMMPP




                           Free*


Thursday, March 14, 13
Why LANMMPP




                         Inexpensive


Thursday, March 14, 13
Why LANMMPP




                         Easily Available


Thursday, March 14, 13
Hosting Options




Thursday, March 14, 13
Hosting Options
                         Shared Hosting
                         +                -
    - Inexpensive                - Shared resources
    - Widely available           - No/Limited Shell
    - Easy to use                - Many restrictions
    - No maintenance             - No control
    - No updates                 - Fixed versions
    - Instant provisioning       - Multitude of CPs
    - DNS/Email services
Thursday, March 14, 13
Hosting Options
                         Dedicated Servers
                         +                  -
  - Full control                 - Hard to plan
  - No sharing                   - Software updates
  - Best performance             - SysAdmin skills
  - Software / Hardware          - Expensive to start
  to specs                       - Parts replacements
                                 - Control Panel licenses

Thursday, March 14, 13
Hosting Options
                         Virtual Servers / VPS
                                    -
                             - Shared resources
                             - Software updates
                             - SysAdmin skills
                             - Limited/No CP
                             - Lack of email


Thursday, March 14, 13
Hosting Options
                         Virtual Servers / VPS
                          +                 +
     - Inexpensive                 - Custom configurations
     - Widely available            - Snapshots
     - Choice of OS                - Multiple Envs
     - Root access
     - Full shell
     - Fast provisioning
     - Custom software
Thursday, March 14, 13
Hosting Options
                              Cloud Hosting
                          +                   -

                         Depends on implementation




Thursday, March 14, 13
Hosting Options
                            Cloud Hosting

                         Some are a shared hosting
                         with a fancy new name




Thursday, March 14, 13
Hosting Options
                            Cloud Hosting

                         Some are a shared hosting
                         with a fancy new name
                         Others let you start small
                         and scale easily



Thursday, March 14, 13
Hosting Options
                            Cloud Hosting

                         Some are a shared hosting
                         with a fancy new name
                         Others let you start small
                         and scale easily
                         Gets really expensive at
                         scale

Thursday, March 14, 13
Hosting Options
                           Cloud Hosting
                         Most suffer from some of the
                         shared hosting problems:
                         - vendor lock-in
                         - lack of control
                         - high learning curve
                         - limited environment


Thursday, March 14, 13
Hosting Options




                    Which one to choose?




Thursday, March 14, 13
Hosting Options
                         Which one to choose?



                            IT   DEPENDS




Thursday, March 14, 13
Linux Distributions




Thursday, March 14, 13
Distributions
                          RedHat based

                    - Fedora
                    - RedHat Enterprise Linux (RHEL)
                    - CentOS
                    - Scientific Linux




Thursday, March 14, 13
Distributions
                           Debian based

                    - Debian
                    - Ubuntu




Thursday, March 14, 13
Distributions
                                    Others
                    - Gentoo
                    - Slackware
                    - OpenSuse
                    - Archlinux
                    - any many many more!


                               http://distrowatch.com/
                   http://en.wikipedia.org/wiki/Linux_distribution
Thursday, March 14, 13
Distributions
                         Key differences
                         - Configuration files
                         - Package Manager
                         - Managing Services
                         - Software versions
                         - Updates




Thursday, March 14, 13
Distributions
                         Key differences
   - Configuration files

           CentOS

            /etc/sysconfig/network-scripts/ifcfg-eth0

          Ubuntu

              /etc/network/interfaces



Thursday, March 14, 13
Distributions
                         Key differences
   - Package Manager

            CentOS

             yum install php-cli

            Ubuntu

            apt-get install php5



Thursday, March 14, 13
Distributions
                         Key differences
   - Package Manager

           CentOS

             yum search php-cli

           Ubuntu

             apt-cache search php



Thursday, March 14, 13
Distributions
                         Key differences
   - Managing Services
          CentOS

           service restart httpd
           chkconfig --list httpd
           chkconfig httpd on

         Ubuntu
           service restart apache2
           sudo update-rc.d apache2 enable
Thursday, March 14, 13
Distributions
                         Key differences
   - Software versions

         CentOS

           httpd-2.2.3

        Ubuntu

           apache-2.2.17



Thursday, March 14, 13
Distributions
                         Key differences
   - Updates

           CentOS 5.x

            PHP 5.1.6

          Ubuntu 11

            PHP 5.3.5



Thursday, March 14, 13
Distributions
                             Key similarities

                         - Based on Linux Kernel

                         - Screwed up or ancient PHP
                         - Lack of PHP extensions




Thursday, March 14, 13
Distributions
                         Which one to choose?



                            IT   DEPENDS




Thursday, March 14, 13
Distributions
                         Which one to choose?

                         - Best feeling
                         - Previous experience
                         - Workplace selection
                         - Coworker / friend knowledge



Thursday, March 14, 13
Sysadmin skills for
                             PHP Devs




Thursday, March 14, 13
First Experience




Thursday, March 14, 13
First Experience

                         - Run Linux natively
                         - Mac OSX
                         - Virtual Machine:
                           - VirtualBox
                           - Parallels
                           - VMware
                         - VPS



Thursday, March 14, 13
First Experience
                            #!/bin/bash




Thursday, March 14, 13
First Experience
                            #!/bin/bash




Thursday, March 14, 13
First Experience
                            #!/bin/bash




Thursday, March 14, 13
First Experience
                            #!/bin/bash




Thursday, March 14, 13
First Experience
                            #!/bin/bash




       Recommended Books:
       - Learning the bash Shell
       - bash Cookbook

Thursday, March 14, 13
First Experience
                                #!/bin/bash
                         Most Common Commands:

                         $   ls -l /path/
                         $   cd /path
                         $   pwd
                         $   cat /etc/passwd
                         $   less /etc/resolv.conf
                         $   tail -f /var/log/*
                         $   last
                         $   lastb
                         $   vi /etc/hosts

Thursday, March 14, 13
First Experience
                             #!/bin/bash
                         User`s config files:

                         ~/.bash_history
                         ~/.bash_logout
                         ~/.bash_profile
                              PATH=$PATH:$HOME/bin
                              export PATH

                         ~/.bashrc
                              alias rm='rm -i'
                              alias cp='cp -i'
                              alias mv='mv -i'
Thursday, March 14, 13
First Experience
                            #!/bin/bash
                         Most common directories:

                         /etc
                         /tmp
                         /var/log
                         /var/run
                         /root
                         /home
                         /usr/local
                         /opt


Thursday, March 14, 13
Installing Apache/PHP




Thursday, March 14, 13
Installing Apache/PHP
                   # CentOS
                   $ yum install httpd php-cli mod_php

                   # Ubuntu
                   $ apt-get install apache2 libapache2-mod-php5

                  Mac OSX
                  - MAMP
                  - Native Apache + Liip PHP installation
                  - Zend Server CE

                  Windows
                  - WAMP
                  - IIS + PHP
Thursday, March 14, 13
Installing PHP
                            CentOS
                    Third Party Repositories
                         - Remi RPM
                         http://blog.famillecollet.com/
                         - Webtatic
                         http://www.webtatic.com/
                         - ServerGrove: PHP 5.3.x / 5.4.x
                         (always latest)
                         http://repos.servergrove.com
Thursday, March 14, 13
Installing PHP
                            CentOS
                    Third Party Repositories

   cd /etc/yum.repos.d/
   wget http://repos.servergrove.com/servergrove-centos-5/
   servergrove-centos-5.repo
   yum install php53 # or php54




Thursday, March 14, 13
Installing PHP
                            Ubuntu
                    Third Party Repositories
                                PHP 5.3.x / 5.4.x

                         - Dotdeb:
                         http://www.dotdeb.org/
                         - ServerGrove: (always latest)
                         http://repos.servergrove.com

Thursday, March 14, 13
Installing PHP
                            Ubuntu
                    Third Party Repositories

  echo “deb http://repos.servergrove.com/servergrove-ubuntu-
  precise precise main” >> /etc/apt/sources.list.d/
  servergrove.list
  apt-get install php53 # or php54




Thursday, March 14, 13
Installing PHP
                         From Source


   wget http://us2.php.net/get/php-5.4.12.tar.bz2/from/
   www.php.net/mirror
   tar jxvf php-5.4.12.tar.bz2
   cd php-5.4.12
   ./configure
   make && make install



Thursday, March 14, 13
Installing PHP
                         Recompiling
  php -i |grep configure
  ./configure '--with-apxs2=/usr/sbin/apxs' '--prefix=/usr/local/
  php53' '--with-config-file-scan-dir=/etc/php53/conf.d' '--
  enable-bcmath' '--enable-ctype' '--enable-exif' '--enable-
  mbstring' '--enable-ftp' '--enable-intl' '--enable-sockets' '--
  enable-sysvmsg' '--enable-pcntl' '--with-bz2' '--with-curl' '--
  with-gettext' '--with-gd' '--enable-gd-native-ttf' '--enable-exif' '--
  with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-t1lib=/usr'
  '--with-mcrypt' '--with-openssl' '--with-kerberos' '--with-iconv'
  '--with-xsl' '--with-xmlrpc' '--with-zlib' '--with-mysql=mysqlnd' '--
  with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd'
  make && make install
Thursday, March 14, 13
Installing PHP
                         Compiling for Apache


    ./configure '--with-apxs2=/usr/sbin/apxs'
    make && make install




Thursday, March 14, 13
Installing PHP
Compiling for Nginx / PHP-FPM


                   ./configure '--enable-fpm'
                   make && make install




Thursday, March 14, 13
Installing PHP
                         Compiling extension



                   ./configure --with-curl --enable-ftp
                   make && make install




Thursday, March 14, 13
Installing PHP
                         Compiling extension
                            (dynamic)

                   cd ext/curl
                   phpize
                   ./configure
                   make && make install
                   echo “extension=curl.so” >> php.ini




Thursday, March 14, 13
Installing PHP
                         Compiling extension



                            http://pecl.php.net/




Thursday, March 14, 13
Installing PHP
                         Compiling extension
                              (PECL)
    pecl install apc
    # or
    pecl download apc
    tar zxvf APC-3.1.13.tgz
    cd APC-3.13
    phpize
    ./configure
    make && make install
    echo “extension=apc.so” >> php.ini
Thursday, March 14, 13
Installing PHP
                           Automate!


                           - Chef
                           - Puppet
                           - ...




Thursday, March 14, 13
Installing PHP
                                Configuration

                  Default location

                         /usr/local/lib/php.ini

                  Other common locations

                         /etc/php/php.ini
                         /etc/php5/cli/php.ini

                         /etc/php5/apache2/php.ini

Thursday, March 14, 13
Installing PHP
                         Configuration

  php -i | grep php.ini
  Configuration File (php.ini) Path => /usr/local/php5/lib
  Loaded Configuration File => /usr/local/php5-20110426-093151/
  lib/php.ini
  Scan this dir for additional .ini files => /usr/local/php5/php.d
  Additional .ini files parsed => /usr/local/php5/php.d/10-
  extension_dir.ini,



Thursday, March 14, 13
Installing PHP
                         Configuration

  php -i | grep mongo
   /usr/local/php5/php.d/50-extension-mongo.ini,
   mongo
   mongo.allow_empty_keys => 0 => 0
   mongo.allow_persistent => 1 => 1
   mongo.auto_reconnect => 1 => 1
   mongo.chunk_size => 262144 => 262144
   mongo.cmd => $ => $
   mongo.default_host => localhost => localhost
   mongo.default_port => 27017 => 27017
Thursday, March 14, 13
Installing PHP
                         Configuration
          php -m
           [PHP Modules]
           apc
           bcmath
           bz2
           Core
           ctype
           curl
           date
           dom
           ereg
Thursday, March 14, 13
Installing PHP
                         Configuration
                           php.ini
             extension_dir=/usr/lib/php/extensions/no-
             debug-non-zts-20090626

             extension=apc.so
             extension=mongo.so


Thursday, March 14, 13
Installing PHP
                         Configuration
                           php.ini

   php -i | grep extension_dir
   extension_dir => /usr/local/php5/lib/php/extensions/no-debug-
   non-zts-20090626




Thursday, March 14, 13
Installing PHP
                              Configuration
                                php.ini

                         date.timezone=UTC
                         display_errors = off
                         log_errors = on
                         error_log = /var/log/php.log


Thursday, March 14, 13
Installing PHP
                            Configuration
                              Security
                         memory_limit = 128M
                         max_execution_time = 30
                         display_errors = off
                         expose_php = off
                         mail.log = /var/log/phpmails.log
                         disable_functions = exec
                         allow_url_fopen = off



Thursday, March 14, 13
Installing PHP
                      Configuration
                File uploads on .htaccess
                           php_value memory_limit 128M
                           php_value max_file_uploads 20
                           php_value max_input_time -1
                           php_value post_max_size 8M
                           php_value upload_max_filesize 2M
                           php_value max_execution_time 0



                         AllowOverride=All in Apache!
Thursday, March 14, 13
Installing PHP
                             Configuration
                           Include .htaccess

                         <Directory /path/to/document/root>
                           Include /path/to/.htaccess
                         </Directory>




                  AllowOverride=None in Apache!
Thursday, March 14, 13
Installing PHP
                               Configuration
                                 Apache
                             php_value date.timezone UTC
                             php_flag display_errors 1
                             php_value memory_limit 128M
                             php_value max_execution_time 0



                         Don’t forget to restart Apache
Thursday, March 14, 13
Installing PHP
                              Web Server User
            Permissions issues with clear cache
            and uploads, Anyone?

          Possible users
                         - apache
                         - nobody
                         - www-data
                         - ftp / ssh user (sometimes)


Thursday, March 14, 13
Installing PHP
                         Web Server User
            Permissions issues with clear cache
            and uploads, Anyone?

 Fix:
  rm -rf app/cache/*
  rm -rf app/logs/*

  sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache
  app/logs
  sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache
  app/logs




        http://symfony.com/doc/current/book/installation.html
Thursday, March 14, 13
Deploying PHP




Thursday, March 14, 13
Deploying PHP
                         Before going live
                                       Make sure ntpd is
                                       installed and running
                                       to ensure accurate
                                       server time

                yum install ntp
                chkconfig ntpd on
                ntpdate pool.ntp.org


Thursday, March 14, 13
Deploying PHP
                          Before going live
          - Disable PHP in specific directories


                   <Location /uploads>
                     php_admin_flag engine off
                   </Location>




Thursday, March 14, 13
Deploying PHP
                          Before going live
          - Limit access by IP

                   <Location /admin>
                     Order Deny,Allow
                     Deny from all
                     Allow from 1.2.3.4
                   </Location>




Thursday, March 14, 13
Deploying PHP
                          Before going live
         - Add HTTP Authentication


                   <Location /admin>
                       Require valid-user
                       AuthType Basic
                       AuthName "SG"
                       AuthUserFile /path/users
                   </Location>


Thursday, March 14, 13
Deploying PHP
                         Before going live

                  - Quiet down Apache

                  ServerTokens Prod




Thursday, March 14, 13
Deploying PHP
                          Before going live
                  Move document root with .htaccess
                   RewriteEngine On

                   RewriteRule ^.htaccess$ - [F]

                   RewriteCond %{REQUEST_FILENAME} -f
                   RewriteRule ^.*$ - [NC,L]

                   RewriteCond %{REQUEST_URI} !^/web/.*$
                   RewriteRule ^(.*)$ /web/$1

Thursday, March 14, 13
Deploying PHP
                         Before going live
               - Case senstive filesystem

               IPCheck_Form_Index_Login !=
               IpCheck_Form_Index_Login
              /path/to/file/IpCheck_Form_Index_Login.php
               <?php
               class IPCheck_Form_Index_Login
               {
               ...



Thursday, March 14, 13
Deploying PHP
                         - server-side vi
                         - plain old FTP
                         - SFTP
                         - scp
                         - rsync + ssh
                         - git
                         - tar / gzip
                         - rpm / deb packages
                         - capistrano / capifony

Thursday, March 14, 13
Deploying PHP
                         - server-side vi
                         - plain old FTP
                         - SFTP
                         - scp
                         - rsync + ssh
                         - git
                         - tar / gzip
                         - rpm / deb packages
                         - capistrano / capifony

Thursday, March 14, 13
Deploying PHP
                         Effing Package Management

              Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.



              fpm -s dir -t rpm -n "sfapp" -v 1.0 /var/www/sfapp

              fpm -s dir -t deb -a all -n sfapp -v 1.0 /etc/apache2/
              conf.d/my.conf /var/www/sfapp



                          https://github.com/jordansissel/fpm

Thursday, March 14, 13
Deploying PHP
                         Capistrano / Capifony


            - multiple servers
            - multiple environments
            - setup shared folders (vendors, cache, logs, etc)
            - copy files
            - update vendors
            - multi versions
            - rollback
            - restart apache



Thursday, March 14, 13
Deploying PHP
                            Setting up SSH


            $ ssh-keygen -t dsa
               ~/.ssh/id_dsa.pub

            $ ssh-copy-id user@remote-host
               ~/.ssh/authorized_keys
               ~/.ssh/authorized_keys2

            $ ssh-add



Thursday, March 14, 13
Deploying PHP
                                Setting up SSH

            ~/.ssh/config

                   Host *
                    ForwardAgent yes
                    Port 22123

                   Host gh
                    HostName github.com
                    Port 22
                    PreferredAuthentications publickey
                    IdentityFile ~/.ssh/me_rsa

Thursday, March 14, 13
Deploying PHP
                               Setting up SSH


            /etc/ssh/sshd_config

                   Port 22
                   Port 22123
                   PermitRootLogin no
                   PasswordAuthentication no




Thursday, March 14, 13
Deploying PHP                                                   Automate!
      <?php

      exec('/usr/bin/env	
  -­‐i	
  HOME=/var/
      www/vhosts/m.sunshinephp.com/m-­‐
      sunshine	
  git	
  pull	
  origin	
  master');

                           http://m.sunshinephp.com/deploy.php


                         https://github.com/pgodel/m-sunshinephp/blob/master/web/deploy.php
Thursday, March 14, 13
DNS Tips




Thursday, March 14, 13
DNS Tips           The Power of the hosts file




Thursday, March 14, 13
DNS Tips                     The Power of the hosts file




                         /etc/hosts

                         10.0.1.1 www.lottery.com




Thursday, March 14, 13
DNS Tips           The Power of the hosts file




          /etc/hosts

          10.0.1.1 example1.com example2.com




Thursday, March 14, 13
DNS Tips
                         Virtual Document Root

   UseCanonicalName Off

   VirtualDocumentRoot /var/www/vhosts/%0/web

   <Location /var/www/vhosts>
       AllowOverride All
       Options +FollowSymLinks
   </Location>


           example.com => /var/www/vhosts/example.com/web
           example2.com => /var/www/vhosts/example2.com/web
Thursday, March 14, 13
DNS Tips
                         Nameservers/Expiration

   whois servergrove.com
   ...
   Name Servers:
      ns1.servergrove.com
      ns2.servergrove.com
      ns3.servergrove.com

   Creation date: 19 May 2005 23:34:36
   Expiration date: 19 May 2014 23:34:00



Thursday, March 14, 13
DNS Tips
                         DNS records
   dig -t A google.com
   ;; ANSWER SECTION:
   google.com.       184 IN A   74.125.230.227
   google.com.       184 IN A   74.125.230.228
   google.com.       184 IN A   74.125.230.229
   google.com.       184 IN A   74.125.230.230
   google.com.       184 IN A   74.125.230.231
   google.com.       184 IN A   74.125.230.232
   google.com.       184 IN A   74.125.230.233
   google.com.       184 IN A   74.125.230.238
   google.com.       184 IN A   74.125.230.224
   google.com.       184 IN A   74.125.230.225
   google.com.       184 IN A   74.125.230.226
Thursday, March 14, 13
DNS Tips
                         DNS records



   dig -t A servergrove.eu @ns1.servergrove.com
   ;; ANSWER SECTION:
   servergrove.eu.      3600 IN A 149.5.47.100




Thursday, March 14, 13
DNS Tips                                          DNS Delegation
                         http://www.simpledns.com/lookup-dg.aspx




Thursday, March 14, 13
DNS Tips
                                   traceroute


   traceroute google.com

   traceroute to google.com (173.194.37.33), 30 hops max, 40 byte packets
    1 2.69-195-222.static.servergrove.com (69.195.222.2) 0.360 ms 0.365 ms 0.432 ms
    2 t0-1-0-5.br2.mia.terremark.net (66.165.161.45) 1.558 ms 1.546 ms 1.532 ms
    3 core1-1-0-0.mia.net.google.com (198.32.124.133) 0.238 ms 0.224 ms 0.230 ms
    4 209.85.253.74 (209.85.253.74) 0.266 ms 0.283 ms 0.312 ms
    5 209.85.254.252 (209.85.254.252) 12.764 ms 12.757 ms 12.749 ms
    6 64.233.175.92 (64.233.175.92) 14.177 ms 14.257 ms 14.359 ms
    7 atl14s07-in-f1.1e100.net (173.194.37.33) 13.653 ms 13.606 ms 13.618 ms




Thursday, March 14, 13
DNS Tips
                         http://whereisitup.com




Thursday, March 14, 13
DNS Tips
                            mtr




Thursday, March 14, 13
Monitoring




Thursday, March 14, 13
Monitoring
                            Apache Requests

                         <Location /server-status>
                           SetHandler server-status
                           Order deny,allow
                           Deny from all
                           Allow from .your_domain.com
                         </Location>

                         ExtendedStatus On




Thursday, March 14, 13
Monitoring
                         Apache Requests




Thursday, March 14, 13
Monitoring

                         - Cacti
                         - Ganglia
                         - Zabbix
                         - collectd
                         - statsd / StatsDBundle
                         - graphite



Thursday, March 14, 13
Monitoring
                         statsd / StatsDBundle / Graphite




Thursday, March 14, 13
Monitoring
                         CPU / Memory / IO
                                top




Thursday, March 14, 13
Monitoring
                              IO
                            iotop




Thursday, March 14, 13
Monitoring
                           Network
                            iptraf




Thursday, March 14, 13
Monitoring
                               Handling logs


           - Centralize logs with syslog
                         error_log = syslog



           - Monolog supports syslog
           - logstash, logster, loggly, logio



Thursday, March 14, 13
Monitoring
                         Handling logs




         $ grep POST /var/log/apache2/access_log




Thursday, March 14, 13
Speeding up




Thursday, March 14, 13
Speeding up


                         - nginx/php-fpm
                         - APC
                         - ZendOptimizer+
                         - Memcache
                         - nginx reverse proxy cache
                         - Varnish



Thursday, March 14, 13
Backups




Thursday, March 14, 13
Backups


                         - rsync
                         - rdiff-backup
                         - Unison
                         - Bacula
                         - Amanda




Thursday, March 14, 13
Backups


                              Don’t forget to
                              backup your DB!



http://blog.servergrove.com/2012/01/24/backup-your-mysql-
                 database-using-mysqldump/



Thursday, March 14, 13
Reading List




    - Automating UNIX and Linux Administration
    - Running Linux
    - Learning the bash Shell: Unix Shell Programming




Thursday, March 14, 13
The End              Questions?




                          Sysadmin skills for PHP developers
Thursday, March 14, 13
Sysadmin skills for PHP developers

                          http://joind.in/8376
                              Thank you!
                                 Pablo Godel @pgodel
Thursday, March 14, 13

More Related Content

Viewers also liked

Viewers also liked (15)

Real ch.2 a (1)
Real ch.2 a (1)Real ch.2 a (1)
Real ch.2 a (1)
 
Kudavi 2.6.2016
Kudavi 2.6.2016Kudavi 2.6.2016
Kudavi 2.6.2016
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_cost
 
JAWS-UG Aomori #0 LT
JAWS-UG Aomori #0 LTJAWS-UG Aomori #0 LT
JAWS-UG Aomori #0 LT
 
Seven things to make your pup ONE in a million
Seven things to make your pup ONE in a millionSeven things to make your pup ONE in a million
Seven things to make your pup ONE in a million
 
The Day Ahead. 2/14/2013
The Day Ahead. 2/14/2013The Day Ahead. 2/14/2013
The Day Ahead. 2/14/2013
 
NC Live How To
NC Live How ToNC Live How To
NC Live How To
 
Cara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntuCara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntu
 
Cpi pergunta e visanet responde
Cpi pergunta e visanet respondeCpi pergunta e visanet responde
Cpi pergunta e visanet responde
 
Museum date
Museum dateMuseum date
Museum date
 
Wkce prep -graphs and data
Wkce prep -graphs and dataWkce prep -graphs and data
Wkce prep -graphs and data
 
LBC: Kudavi
LBC: Kudavi LBC: Kudavi
LBC: Kudavi
 
Element Booklet
Element BookletElement Booklet
Element Booklet
 
Bella
BellaBella
Bella
 
Magazine design evaluation pp
Magazine design evaluation ppMagazine design evaluation pp
Magazine design evaluation pp
 

Similar to Soflophp 2013 - SysAdmin skills for PHP developers

Structuring apps in Scala
Structuring apps in ScalaStructuring apps in Scala
Structuring apps in ScalaPhil Calçado
 
Intravert atx meetup_condensed
Intravert atx meetup_condensedIntravert atx meetup_condensed
Intravert atx meetup_condensedzznate
 
Native Javascript apps with PhoneGap
Native Javascript apps with PhoneGapNative Javascript apps with PhoneGap
Native Javascript apps with PhoneGapMartin de Keijzer
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersPablo Godel
 
Architecting cloud-enabled applications using Spring-Integration 2.x
Architecting cloud-enabled applications using Spring-Integration 2.xArchitecting cloud-enabled applications using Spring-Integration 2.x
Architecting cloud-enabled applications using Spring-Integration 2.xEdson Yanaga
 

Similar to Soflophp 2013 - SysAdmin skills for PHP developers (7)

Structuring apps in Scala
Structuring apps in ScalaStructuring apps in Scala
Structuring apps in Scala
 
Future layouts
Future layoutsFuture layouts
Future layouts
 
Nätverk pdf
Nätverk pdfNätverk pdf
Nätverk pdf
 
Intravert atx meetup_condensed
Intravert atx meetup_condensedIntravert atx meetup_condensed
Intravert atx meetup_condensed
 
Native Javascript apps with PhoneGap
Native Javascript apps with PhoneGapNative Javascript apps with PhoneGap
Native Javascript apps with PhoneGap
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
 
Architecting cloud-enabled applications using Spring-Integration 2.x
Architecting cloud-enabled applications using Spring-Integration 2.xArchitecting cloud-enabled applications using Spring-Integration 2.x
Architecting cloud-enabled applications using Spring-Integration 2.x
 

More from Pablo Godel

SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkyPablo Godel
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkyPablo Godel
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyPablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARPablo Godel
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...Pablo Godel
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPablo Godel
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsPablo Godel
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...Pablo Godel
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Pablo Godel
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyPablo Godel
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013 Pablo Godel
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsPablo Godel
 
Codeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP AppsCodeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP AppsPablo Godel
 
PFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP AppsPFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP AppsPablo Godel
 

More from Pablo Godel (20)

SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSky
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSky
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSky
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and Symfony
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Codeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP AppsCodeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP Apps
 
PFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP AppsPFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP Apps
 

Recently uploaded

Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)IES VE
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingMAGNIntelligence
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Muhammad Tiham Siddiqui
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 

Recently uploaded (20)

Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced Computing
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 

Soflophp 2013 - SysAdmin skills for PHP developers

  • 1. SysAdmin skills for PHP developers Pablo Godel @pgodel - March 13, 2013 South Florida PHP Users Group http://joind.in/8376 Thursday, March 14, 13
  • 2. Agenda - Why SysAdmin Skills - Introduction to LAMP - Hosting options - Linux distributions - Installing PHP options - Deploying PHP - Various production tips - Monitoring - Backups Thursday, March 14, 13
  • 3. Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrilla Thursday, March 14, 13
  • 4. Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrilla Thursday, March 14, 13
  • 6. ServerGrove! ⁃ Founded ServerGrove Networks in 2005 ⁃ Provider of web hosting specialized in PHP, Symfony, ZendFramework, and others ⁃ Now with servers in Miami, FL and Dublin, Ireland ⁃ Mongohosting.com! Thursday, March 14, 13
  • 7. Community is our teacher ⁃ Very active open source supporter through code contributions and usergroups/conference sponsoring Thursday, March 14, 13
  • 8. Who needs them? Sysadmin Skills Thursday, March 14, 13
  • 9. Text IT is busy / Different Priorities Thursday, March 14, 13
  • 14. What do you prefer? Thursday, March 14, 13
  • 16. I am limited to line commands. I don’t do line commands in Linux. Either they can install the Centos desktop, or they can just send me the files. An example... Thursday, March 14, 13
  • 17. What is LAMP Thursday, March 14, 13
  • 27. Thursday, March 14, 13 LANMMPP
  • 28. Why? LANMMPP Thursday, March 14, 13
  • 29. Why LANMMPP Proven Thursday, March 14, 13
  • 30. Why LANMMPP Stable Thursday, March 14, 13
  • 31. Why LANMMPP Secure Thursday, March 14, 13
  • 32. Why LANMMPP Free Thursday, March 14, 13
  • 33. Why LANMMPP Free* Thursday, March 14, 13
  • 34. Why LANMMPP Inexpensive Thursday, March 14, 13
  • 35. Why LANMMPP Easily Available Thursday, March 14, 13
  • 37. Hosting Options Shared Hosting + - - Inexpensive - Shared resources - Widely available - No/Limited Shell - Easy to use - Many restrictions - No maintenance - No control - No updates - Fixed versions - Instant provisioning - Multitude of CPs - DNS/Email services Thursday, March 14, 13
  • 38. Hosting Options Dedicated Servers + - - Full control - Hard to plan - No sharing - Software updates - Best performance - SysAdmin skills - Software / Hardware - Expensive to start to specs - Parts replacements - Control Panel licenses Thursday, March 14, 13
  • 39. Hosting Options Virtual Servers / VPS - - Shared resources - Software updates - SysAdmin skills - Limited/No CP - Lack of email Thursday, March 14, 13
  • 40. Hosting Options Virtual Servers / VPS + + - Inexpensive - Custom configurations - Widely available - Snapshots - Choice of OS - Multiple Envs - Root access - Full shell - Fast provisioning - Custom software Thursday, March 14, 13
  • 41. Hosting Options Cloud Hosting + - Depends on implementation Thursday, March 14, 13
  • 42. Hosting Options Cloud Hosting Some are a shared hosting with a fancy new name Thursday, March 14, 13
  • 43. Hosting Options Cloud Hosting Some are a shared hosting with a fancy new name Others let you start small and scale easily Thursday, March 14, 13
  • 44. Hosting Options Cloud Hosting Some are a shared hosting with a fancy new name Others let you start small and scale easily Gets really expensive at scale Thursday, March 14, 13
  • 45. Hosting Options Cloud Hosting Most suffer from some of the shared hosting problems: - vendor lock-in - lack of control - high learning curve - limited environment Thursday, March 14, 13
  • 46. Hosting Options Which one to choose? Thursday, March 14, 13
  • 47. Hosting Options Which one to choose? IT DEPENDS Thursday, March 14, 13
  • 49. Distributions RedHat based - Fedora - RedHat Enterprise Linux (RHEL) - CentOS - Scientific Linux Thursday, March 14, 13
  • 50. Distributions Debian based - Debian - Ubuntu Thursday, March 14, 13
  • 51. Distributions Others - Gentoo - Slackware - OpenSuse - Archlinux - any many many more! http://distrowatch.com/ http://en.wikipedia.org/wiki/Linux_distribution Thursday, March 14, 13
  • 52. Distributions Key differences - Configuration files - Package Manager - Managing Services - Software versions - Updates Thursday, March 14, 13
  • 53. Distributions Key differences - Configuration files CentOS /etc/sysconfig/network-scripts/ifcfg-eth0 Ubuntu /etc/network/interfaces Thursday, March 14, 13
  • 54. Distributions Key differences - Package Manager CentOS yum install php-cli Ubuntu apt-get install php5 Thursday, March 14, 13
  • 55. Distributions Key differences - Package Manager CentOS yum search php-cli Ubuntu apt-cache search php Thursday, March 14, 13
  • 56. Distributions Key differences - Managing Services CentOS service restart httpd chkconfig --list httpd chkconfig httpd on Ubuntu service restart apache2 sudo update-rc.d apache2 enable Thursday, March 14, 13
  • 57. Distributions Key differences - Software versions CentOS httpd-2.2.3 Ubuntu apache-2.2.17 Thursday, March 14, 13
  • 58. Distributions Key differences - Updates CentOS 5.x PHP 5.1.6 Ubuntu 11 PHP 5.3.5 Thursday, March 14, 13
  • 59. Distributions Key similarities - Based on Linux Kernel - Screwed up or ancient PHP - Lack of PHP extensions Thursday, March 14, 13
  • 60. Distributions Which one to choose? IT DEPENDS Thursday, March 14, 13
  • 61. Distributions Which one to choose? - Best feeling - Previous experience - Workplace selection - Coworker / friend knowledge Thursday, March 14, 13
  • 62. Sysadmin skills for PHP Devs Thursday, March 14, 13
  • 64. First Experience - Run Linux natively - Mac OSX - Virtual Machine: - VirtualBox - Parallels - VMware - VPS Thursday, March 14, 13
  • 65. First Experience #!/bin/bash Thursday, March 14, 13
  • 66. First Experience #!/bin/bash Thursday, March 14, 13
  • 67. First Experience #!/bin/bash Thursday, March 14, 13
  • 68. First Experience #!/bin/bash Thursday, March 14, 13
  • 69. First Experience #!/bin/bash Recommended Books: - Learning the bash Shell - bash Cookbook Thursday, March 14, 13
  • 70. First Experience #!/bin/bash Most Common Commands: $ ls -l /path/ $ cd /path $ pwd $ cat /etc/passwd $ less /etc/resolv.conf $ tail -f /var/log/* $ last $ lastb $ vi /etc/hosts Thursday, March 14, 13
  • 71. First Experience #!/bin/bash User`s config files: ~/.bash_history ~/.bash_logout ~/.bash_profile PATH=$PATH:$HOME/bin export PATH ~/.bashrc alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' Thursday, March 14, 13
  • 72. First Experience #!/bin/bash Most common directories: /etc /tmp /var/log /var/run /root /home /usr/local /opt Thursday, March 14, 13
  • 74. Installing Apache/PHP # CentOS $ yum install httpd php-cli mod_php # Ubuntu $ apt-get install apache2 libapache2-mod-php5 Mac OSX - MAMP - Native Apache + Liip PHP installation - Zend Server CE Windows - WAMP - IIS + PHP Thursday, March 14, 13
  • 75. Installing PHP CentOS Third Party Repositories - Remi RPM http://blog.famillecollet.com/ - Webtatic http://www.webtatic.com/ - ServerGrove: PHP 5.3.x / 5.4.x (always latest) http://repos.servergrove.com Thursday, March 14, 13
  • 76. Installing PHP CentOS Third Party Repositories cd /etc/yum.repos.d/ wget http://repos.servergrove.com/servergrove-centos-5/ servergrove-centos-5.repo yum install php53 # or php54 Thursday, March 14, 13
  • 77. Installing PHP Ubuntu Third Party Repositories PHP 5.3.x / 5.4.x - Dotdeb: http://www.dotdeb.org/ - ServerGrove: (always latest) http://repos.servergrove.com Thursday, March 14, 13
  • 78. Installing PHP Ubuntu Third Party Repositories echo “deb http://repos.servergrove.com/servergrove-ubuntu- precise precise main” >> /etc/apt/sources.list.d/ servergrove.list apt-get install php53 # or php54 Thursday, March 14, 13
  • 79. Installing PHP From Source wget http://us2.php.net/get/php-5.4.12.tar.bz2/from/ www.php.net/mirror tar jxvf php-5.4.12.tar.bz2 cd php-5.4.12 ./configure make && make install Thursday, March 14, 13
  • 80. Installing PHP Recompiling php -i |grep configure ./configure '--with-apxs2=/usr/sbin/apxs' '--prefix=/usr/local/ php53' '--with-config-file-scan-dir=/etc/php53/conf.d' '-- enable-bcmath' '--enable-ctype' '--enable-exif' '--enable- mbstring' '--enable-ftp' '--enable-intl' '--enable-sockets' '-- enable-sysvmsg' '--enable-pcntl' '--with-bz2' '--with-curl' '-- with-gettext' '--with-gd' '--enable-gd-native-ttf' '--enable-exif' '-- with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-t1lib=/usr' '--with-mcrypt' '--with-openssl' '--with-kerberos' '--with-iconv' '--with-xsl' '--with-xmlrpc' '--with-zlib' '--with-mysql=mysqlnd' '-- with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' make && make install Thursday, March 14, 13
  • 81. Installing PHP Compiling for Apache ./configure '--with-apxs2=/usr/sbin/apxs' make && make install Thursday, March 14, 13
  • 82. Installing PHP Compiling for Nginx / PHP-FPM ./configure '--enable-fpm' make && make install Thursday, March 14, 13
  • 83. Installing PHP Compiling extension ./configure --with-curl --enable-ftp make && make install Thursday, March 14, 13
  • 84. Installing PHP Compiling extension (dynamic) cd ext/curl phpize ./configure make && make install echo “extension=curl.so” >> php.ini Thursday, March 14, 13
  • 85. Installing PHP Compiling extension http://pecl.php.net/ Thursday, March 14, 13
  • 86. Installing PHP Compiling extension (PECL) pecl install apc # or pecl download apc tar zxvf APC-3.1.13.tgz cd APC-3.13 phpize ./configure make && make install echo “extension=apc.so” >> php.ini Thursday, March 14, 13
  • 87. Installing PHP Automate! - Chef - Puppet - ... Thursday, March 14, 13
  • 88. Installing PHP Configuration Default location /usr/local/lib/php.ini Other common locations /etc/php/php.ini /etc/php5/cli/php.ini /etc/php5/apache2/php.ini Thursday, March 14, 13
  • 89. Installing PHP Configuration php -i | grep php.ini Configuration File (php.ini) Path => /usr/local/php5/lib Loaded Configuration File => /usr/local/php5-20110426-093151/ lib/php.ini Scan this dir for additional .ini files => /usr/local/php5/php.d Additional .ini files parsed => /usr/local/php5/php.d/10- extension_dir.ini, Thursday, March 14, 13
  • 90. Installing PHP Configuration php -i | grep mongo /usr/local/php5/php.d/50-extension-mongo.ini, mongo mongo.allow_empty_keys => 0 => 0 mongo.allow_persistent => 1 => 1 mongo.auto_reconnect => 1 => 1 mongo.chunk_size => 262144 => 262144 mongo.cmd => $ => $ mongo.default_host => localhost => localhost mongo.default_port => 27017 => 27017 Thursday, March 14, 13
  • 91. Installing PHP Configuration php -m [PHP Modules] apc bcmath bz2 Core ctype curl date dom ereg Thursday, March 14, 13
  • 92. Installing PHP Configuration php.ini extension_dir=/usr/lib/php/extensions/no- debug-non-zts-20090626 extension=apc.so extension=mongo.so Thursday, March 14, 13
  • 93. Installing PHP Configuration php.ini php -i | grep extension_dir extension_dir => /usr/local/php5/lib/php/extensions/no-debug- non-zts-20090626 Thursday, March 14, 13
  • 94. Installing PHP Configuration php.ini date.timezone=UTC display_errors = off log_errors = on error_log = /var/log/php.log Thursday, March 14, 13
  • 95. Installing PHP Configuration Security memory_limit = 128M max_execution_time = 30 display_errors = off expose_php = off mail.log = /var/log/phpmails.log disable_functions = exec allow_url_fopen = off Thursday, March 14, 13
  • 96. Installing PHP Configuration File uploads on .htaccess php_value memory_limit 128M php_value max_file_uploads 20 php_value max_input_time -1 php_value post_max_size 8M php_value upload_max_filesize 2M php_value max_execution_time 0 AllowOverride=All in Apache! Thursday, March 14, 13
  • 97. Installing PHP Configuration Include .htaccess <Directory /path/to/document/root> Include /path/to/.htaccess </Directory> AllowOverride=None in Apache! Thursday, March 14, 13
  • 98. Installing PHP Configuration Apache php_value date.timezone UTC php_flag display_errors 1 php_value memory_limit 128M php_value max_execution_time 0 Don’t forget to restart Apache Thursday, March 14, 13
  • 99. Installing PHP Web Server User Permissions issues with clear cache and uploads, Anyone? Possible users - apache - nobody - www-data - ftp / ssh user (sometimes) Thursday, March 14, 13
  • 100. Installing PHP Web Server User Permissions issues with clear cache and uploads, Anyone? Fix: rm -rf app/cache/* rm -rf app/logs/* sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs http://symfony.com/doc/current/book/installation.html Thursday, March 14, 13
  • 102. Deploying PHP Before going live Make sure ntpd is installed and running to ensure accurate server time yum install ntp chkconfig ntpd on ntpdate pool.ntp.org Thursday, March 14, 13
  • 103. Deploying PHP Before going live - Disable PHP in specific directories <Location /uploads> php_admin_flag engine off </Location> Thursday, March 14, 13
  • 104. Deploying PHP Before going live - Limit access by IP <Location /admin> Order Deny,Allow Deny from all Allow from 1.2.3.4 </Location> Thursday, March 14, 13
  • 105. Deploying PHP Before going live - Add HTTP Authentication <Location /admin> Require valid-user AuthType Basic AuthName "SG" AuthUserFile /path/users </Location> Thursday, March 14, 13
  • 106. Deploying PHP Before going live - Quiet down Apache ServerTokens Prod Thursday, March 14, 13
  • 107. Deploying PHP Before going live Move document root with .htaccess RewriteEngine On RewriteRule ^.htaccess$ - [F] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^.*$ - [NC,L] RewriteCond %{REQUEST_URI} !^/web/.*$ RewriteRule ^(.*)$ /web/$1 Thursday, March 14, 13
  • 108. Deploying PHP Before going live - Case senstive filesystem IPCheck_Form_Index_Login != IpCheck_Form_Index_Login /path/to/file/IpCheck_Form_Index_Login.php <?php class IPCheck_Form_Index_Login { ... Thursday, March 14, 13
  • 109. Deploying PHP - server-side vi - plain old FTP - SFTP - scp - rsync + ssh - git - tar / gzip - rpm / deb packages - capistrano / capifony Thursday, March 14, 13
  • 110. Deploying PHP - server-side vi - plain old FTP - SFTP - scp - rsync + ssh - git - tar / gzip - rpm / deb packages - capistrano / capifony Thursday, March 14, 13
  • 111. Deploying PHP Effing Package Management Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity. fpm -s dir -t rpm -n "sfapp" -v 1.0 /var/www/sfapp fpm -s dir -t deb -a all -n sfapp -v 1.0 /etc/apache2/ conf.d/my.conf /var/www/sfapp https://github.com/jordansissel/fpm Thursday, March 14, 13
  • 112. Deploying PHP Capistrano / Capifony - multiple servers - multiple environments - setup shared folders (vendors, cache, logs, etc) - copy files - update vendors - multi versions - rollback - restart apache Thursday, March 14, 13
  • 113. Deploying PHP Setting up SSH $ ssh-keygen -t dsa ~/.ssh/id_dsa.pub $ ssh-copy-id user@remote-host ~/.ssh/authorized_keys ~/.ssh/authorized_keys2 $ ssh-add Thursday, March 14, 13
  • 114. Deploying PHP Setting up SSH ~/.ssh/config Host * ForwardAgent yes Port 22123 Host gh HostName github.com Port 22 PreferredAuthentications publickey IdentityFile ~/.ssh/me_rsa Thursday, March 14, 13
  • 115. Deploying PHP Setting up SSH /etc/ssh/sshd_config Port 22 Port 22123 PermitRootLogin no PasswordAuthentication no Thursday, March 14, 13
  • 116. Deploying PHP Automate! <?php exec('/usr/bin/env  -­‐i  HOME=/var/ www/vhosts/m.sunshinephp.com/m-­‐ sunshine  git  pull  origin  master'); http://m.sunshinephp.com/deploy.php https://github.com/pgodel/m-sunshinephp/blob/master/web/deploy.php Thursday, March 14, 13
  • 118. DNS Tips The Power of the hosts file Thursday, March 14, 13
  • 119. DNS Tips The Power of the hosts file /etc/hosts 10.0.1.1 www.lottery.com Thursday, March 14, 13
  • 120. DNS Tips The Power of the hosts file /etc/hosts 10.0.1.1 example1.com example2.com Thursday, March 14, 13
  • 121. DNS Tips Virtual Document Root UseCanonicalName Off VirtualDocumentRoot /var/www/vhosts/%0/web <Location /var/www/vhosts> AllowOverride All Options +FollowSymLinks </Location> example.com => /var/www/vhosts/example.com/web example2.com => /var/www/vhosts/example2.com/web Thursday, March 14, 13
  • 122. DNS Tips Nameservers/Expiration whois servergrove.com ... Name Servers: ns1.servergrove.com ns2.servergrove.com ns3.servergrove.com Creation date: 19 May 2005 23:34:36 Expiration date: 19 May 2014 23:34:00 Thursday, March 14, 13
  • 123. DNS Tips DNS records dig -t A google.com ;; ANSWER SECTION: google.com. 184 IN A 74.125.230.227 google.com. 184 IN A 74.125.230.228 google.com. 184 IN A 74.125.230.229 google.com. 184 IN A 74.125.230.230 google.com. 184 IN A 74.125.230.231 google.com. 184 IN A 74.125.230.232 google.com. 184 IN A 74.125.230.233 google.com. 184 IN A 74.125.230.238 google.com. 184 IN A 74.125.230.224 google.com. 184 IN A 74.125.230.225 google.com. 184 IN A 74.125.230.226 Thursday, March 14, 13
  • 124. DNS Tips DNS records dig -t A servergrove.eu @ns1.servergrove.com ;; ANSWER SECTION: servergrove.eu. 3600 IN A 149.5.47.100 Thursday, March 14, 13
  • 125. DNS Tips DNS Delegation http://www.simpledns.com/lookup-dg.aspx Thursday, March 14, 13
  • 126. DNS Tips traceroute traceroute google.com traceroute to google.com (173.194.37.33), 30 hops max, 40 byte packets 1 2.69-195-222.static.servergrove.com (69.195.222.2) 0.360 ms 0.365 ms 0.432 ms 2 t0-1-0-5.br2.mia.terremark.net (66.165.161.45) 1.558 ms 1.546 ms 1.532 ms 3 core1-1-0-0.mia.net.google.com (198.32.124.133) 0.238 ms 0.224 ms 0.230 ms 4 209.85.253.74 (209.85.253.74) 0.266 ms 0.283 ms 0.312 ms 5 209.85.254.252 (209.85.254.252) 12.764 ms 12.757 ms 12.749 ms 6 64.233.175.92 (64.233.175.92) 14.177 ms 14.257 ms 14.359 ms 7 atl14s07-in-f1.1e100.net (173.194.37.33) 13.653 ms 13.606 ms 13.618 ms Thursday, March 14, 13
  • 127. DNS Tips http://whereisitup.com Thursday, March 14, 13
  • 128. DNS Tips mtr Thursday, March 14, 13
  • 130. Monitoring Apache Requests <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from .your_domain.com </Location> ExtendedStatus On Thursday, March 14, 13
  • 131. Monitoring Apache Requests Thursday, March 14, 13
  • 132. Monitoring - Cacti - Ganglia - Zabbix - collectd - statsd / StatsDBundle - graphite Thursday, March 14, 13
  • 133. Monitoring statsd / StatsDBundle / Graphite Thursday, March 14, 13
  • 134. Monitoring CPU / Memory / IO top Thursday, March 14, 13
  • 135. Monitoring IO iotop Thursday, March 14, 13
  • 136. Monitoring Network iptraf Thursday, March 14, 13
  • 137. Monitoring Handling logs - Centralize logs with syslog error_log = syslog - Monolog supports syslog - logstash, logster, loggly, logio Thursday, March 14, 13
  • 138. Monitoring Handling logs $ grep POST /var/log/apache2/access_log Thursday, March 14, 13
  • 140. Speeding up - nginx/php-fpm - APC - ZendOptimizer+ - Memcache - nginx reverse proxy cache - Varnish Thursday, March 14, 13
  • 142. Backups - rsync - rdiff-backup - Unison - Bacula - Amanda Thursday, March 14, 13
  • 143. Backups Don’t forget to backup your DB! http://blog.servergrove.com/2012/01/24/backup-your-mysql- database-using-mysqldump/ Thursday, March 14, 13
  • 144. Reading List - Automating UNIX and Linux Administration - Running Linux - Learning the bash Shell: Unix Shell Programming Thursday, March 14, 13
  • 145. The End Questions? Sysadmin skills for PHP developers Thursday, March 14, 13
  • 146. Sysadmin skills for PHP developers http://joind.in/8376 Thank you! Pablo Godel @pgodel Thursday, March 14, 13