WP Sandbox Presentation WordCamp Toronto 2011


Published on

To help attendees install XAMPP and WordPress to run on their local machines, whether PC or Mac.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

WP Sandbox Presentation WordCamp Toronto 2011

  1. 1. Sandbox: Running WordPress on Your Local Machine Presented by: A. Alfred Ayache, ZCE @NotrsWebmaster [email_address] http://notoriouswebmaster.com
  2. 2. Prerequisites <ul><li>Unzipping files
  3. 3. Copying and moving files
  4. 4. Running programs and batch scripts
  5. 5. Editing text files with a text editor </li></ul>
  6. 6. What Is (Not) a Sandbox? Is : <ul><li>Sandbox: Your own private webserver, running on your local machine (Windows, OSX, Linux) </li></ul>Is Not : <ul><li>Not a production server.
  7. 7. Should not be exposed to the world.
  8. 8. Not security hardened. </li></ul>
  9. 9. Uses of a Sandbox <ul><li>Running a local copy of WordPress
  10. 10. Testing downloaded themes and plugins
  11. 11. Testing beta releases of WP
  12. 12. Developing your own themes and plugins
  13. 13. Developing websites and web apps
  14. 14. Running local copy of web apps (other than WP)
  15. 15. Learning Web programming (PHP, Perl, Ruby, Python)
  16. 16. NOT RECOMMENDED: running a local production server </li></ul>
  17. 17. WordPress Requirements WordPress XAMPP PC OSX Version 3.1 3.2 1.7.7 1.7.3 PHP 4.3 5.2.4+ 5.3.8 5.3.1 MySQL 4.1.2 5.0+ 5.5.16 5.1.44 Optionally, you may also need mod_rewrite and email capabilities, depending on how you want to configure your installation, or what plugins you want to test.
  18. 18. Introducing XAMPP <ul><li>Collection of open source apps
  19. 19. Apache , PHP , MySQL , phpMyAdmin , and more!
  20. 20. Available for Windows , OSX , Linux and Solaris
  21. 21. Super easy installation (especially compared to manual installation of the components) </li></ul>
  22. 22. Why Do I Need Apache? <ul><li>Your browser can consume, process and display HTML , CSS and JavaScript .
  23. 23. A webserver can serve HTML, CSS and JS; but can also process PHP .
  24. 24. Then, PHP can access MySQL databases. </li></ul>
  25. 25. So What's This PHP and MySQL? <ul><li>PHP is the scripting language used to write WordPress.
  26. 26. MySQL is the database used to store your WordPress data, such as posts and user information.
  27. 27. Together with Linux and Apache , they form the LAMP stack; one of the most popular platforms for web development. </li></ul>
  28. 28. Installing XAMPP for Windows <ul><li>Download the zipped XAMPP from ApacheFriends.org (149MB)
  29. 29. Unzip to C:XAMPP
  30. 30. Run setup_xampp.bat </li><ul><li>Sets directory names in the batch files. </li></ul></ul>
  31. 31. Running XAMPP on Windows <ul><li>Run xampp-control.exe
  32. 32. Start Apache and MySQL
  33. 33. http://localhost/ </li></ul>
  34. 34. Problems With Windows Installation <ul><li>Apache wouldn't start on WinXP.
  35. 35. Download vcredist_x86.exe from Microsoft, and run it. This will install missing DLL's.
  36. 36. Try starting Apache again.
  37. 37. (BTW: no problems running on Win7.) </li></ul>
  38. 38. Installing XAMPP on OSX <ul><li>Download XAMPP dmg from apachefriends.org (86MB)
  39. 39. Double click dmg, and drag XAMPP to Applications folder </li></ul>
  40. 40. Running XAMPP on OSX <ul><li>Go to the XAMPP folder in Applications. Run XAMPP Control
  41. 41. Start Apache and MySQL (order is unimportant)
  42. 42. You'll be asked for the admin password to your machine
  43. 43. The LEDs should turn green
  44. 44. http://localhost/ </li></ul>
  45. 45. Apache Won't Start :( <ul><li>On occasion Apache won't start.
  46. 46. XAMPP Control may even show it as started, but it hasn't.
  47. 47. On OSX it actually tells you why: </li><ul><li>There's another process listening to port 80 . You need to find that process and terminate it with extreme prejudice. </li></ul><li>Chances are good that process may be Skype .
  48. 48. Quit Skype , and start Apache again. You should be good to go. </li></ul>
  49. 49. XAMPP localhost <ul><li>Main XAMPP page: </li></ul>
  50. 50. Installing WordPress on OSX <ul><li>Download the latest version of WordPress from wordpress.org
  51. 51. Unzip it under /Applications/XAMPP/xamppfiles/htdocs/<dir>
  52. 52. In your browser go to http://localhost/<dir>
  53. 53. You can also: </li><ul><li>Unzip it under /Users/<username>/Sites/<dir>
  54. 54. In your browser go to http://localhost/~<username>/<dir> </li></ul></ul>
  55. 55. Installing WordPress on Windows <ul><li>Download the latest version of WordPress from wordpress.org
  56. 56. Unzip it at C:XAMPPhtdocs<dir>
  57. 57. In your browser go to http://localhost/<dir> </li></ul>
  58. 58. Create a Database <ul><li>At the bottom of the XAMPP localhost menu, click phpMyAdmin
  59. 59. Enter a database name (alphanumeric and underscores, no spaces or special characters) and click Create </li></ul>
  60. 60. Back to Our WordPress Install <ul><li>Windows will allow creation of configuration file
  61. 61. OSX will not: you'll need to edit the wp-config-sample.php and save it as wp-config.php
  62. 62. You'll need to know: </li><ul><li>database name
  63. 63. database user ID (root)
  64. 64. database password (blank)
  65. 65. database host (localhost)
  66. 66. table prefix (wp_) </li></ul></ul><ul><li>If the install program can't write your wp-config.php file, it'll display the text, and ask you to cut and paste it into the file, using an editor of your choice. </li></ul>
  67. 67. Virtual Hosts <ul><li>Chances are you'll want/need more than one web site/app hosted on your machine.
  68. 68. Virtual hosts (aka vhosts) allows you to host multiple web apps or sites, on the same machine.
  69. 69. This is what the hosting companies use for shared hosting. </li></ul>
  70. 70. Virtual Hosts: Files <ul><li>hosts - shortcuts DNS </li><ul><li>Win: C:WindowsSystem32driversetchosts
  71. 71. OSX: /etc/hosts </li></ul><li>httpd.conf - Apache configuration </li><ul><li>Win: C:XAMPPapacheconfhttpd.conf
  72. 72. OSX: /Applications/XAMPP/xamppfiles/etc/httpd.conf </li></ul><li>httpd_vhosts.conf - Virtual Hosts configuration </li><ul><li>Win: C:xamppapacheconfextrahttpd-vhosts.conf
  73. 73. OSX: /Applications/XAMPP/xamppfiles/etc/extrahttpd-vhosts.conf </li></ul><li>After modifying these files, restart Apache </li></ul>
  74. 74. Virtual Hosts: hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## localhost broadcasthost ::1 localhost fe80::1%lo0 localhost lphsgrads lphsgrads2.dev aaa <ul><li>The IP address is your localhost machine
  75. 75. Just add another line with the localhost IP, a space or two, and your desired domain name </li></ul>
  76. 76. Virtual Hosts: httpd.conf <ul><li>This is the main configuration file for Apache
  77. 77. Insure the include for httpd-vhosts.conf is uncommented: </li></ul>
  78. 78. Virtual Hosts: httpd-vhosts.conf NameVirtualHost *:80 <VirtualHost *:80> ServerName mybloggittyblog.blog DocumentRoot &quot; /Applications/XAMPP/xamppfiles/htdocs/myblog &quot; <Directory &quot; /Applications/XAMPP/xamppfiles/htdocs/myblog &quot; > Options Indexes FollowSymLinks ExecCGI AllowOverride FileInfo Order allow,deny Allow from all </Directory> </VirtualHost> <ul><li>For a new vhost: </li><ul><li>Copy the VirtualHost segment, and change the ServerName
  79. 79. DocumentRoot and Directory must be the same, and point to the document root of your virtual site
  80. 80. Use forward slashes between dirs, even on Windows. No slash at the end.
  81. 81. Restart Apache
  82. 82. In your browser: http://mybloggittyblog.blog </li></ul></ul>
  83. 83. A Debt of Gratitude <ul><li>Owed to the open source developers, testers and documenters who give so generously of their time and skills, to provide us with these awesome tools.
  84. 84. Thanks to their efforts, we can easily communicate with unprecedented reach. </li></ul>
  85. 85. Best Practices <ul><li>Keep your sandbox as close to the server's versions as possible
  86. 86. Install WP/plugin updates as they become available
  87. 87. Take regular backups
  88. 88. manifest.txt </li><ul><li>URL's
  89. 89. ID's and passwords
  90. 90. Directory path </li></ul></ul>
  91. 91. Resources <ul><li>WordPress.org (of course)
  92. 92. WordPress.tv
  93. 93. XAMPP - http://apachefriends.org
  94. 94. Notepad++ - http://notepad-plus-plus.org/
  95. 95. TextWrangler - http://barebones.com/products/textwrangler/
  96. 96. Microsoft - http://www.microsoft.com/download/en/details.aspx?id=5555 </li><ul><li>For vcredist_x86.exe DLL installer </li></ul></ul>