<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Php on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/php/</link>
    <description>Recent content in Php on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Fri, 30 Jan 2015 10:28:03 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/php/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Let’s write a Laravel application – Project template</title>
      <link>https://janikvonrotz.ch/2015/01/30/lets-write-a-laravel-application-project-template/</link>
      <pubDate>Fri, 30 Jan 2015 10:28:03 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2015/01/30/lets-write-a-laravel-application-project-template/</guid>
      <description>&lt;p&gt;In web development there are tons of programs and tools and due to that also complex and very different development strategies.&#xA;Luckily dependency handling got a lot easier. For my Laravel project setup we will use 3 different package managers.&#xA;Every package manager of course manages a different resource, we will use composer for php packages, npm for everything related to Node.js and Bower for web packages.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://janikvonrotz.ch/wp-content/uploads/2015/01/Web-Technologies-1024x766.png&#34; alt=&#34;Web Technologies&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;By following the instructions of this guide you&amp;rsquo;ll get a very advanced Laravel project template with the following features:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Live Reloading of your browser.&lt;/li&gt;&#xA;&lt;li&gt;Twitter Bootstrap included.&lt;/li&gt;&#xA;&lt;li&gt;Automatic minification and bundling of CSS and JavaScript files.&lt;/li&gt;&#xA;&lt;li&gt;The most recent web technologies at your hand.&lt;/li&gt;&#xA;&lt;li&gt;A default blade template ready to run.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;install&#34;&gt;Install&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;1. Bitnami Nginx Webstack&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;First of all we need a php executable and a MySQL server. The most convienient way to deploy these services is by installing a predefined stack.&#xA;Actually we don&amp;rsquo;t need a webserver, however if you&amp;rsquo;re using phpmyadmin it&amp;rsquo;s already onboard.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://bitnami.com/stack/nginx&#34;&gt;Get Bitnami Nginx Webstack&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Composer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As I&amp;rsquo;ve said composer is a php package manager. As Laravel is a composer package we need this tool to deploy the Laravel project. You can get composer &lt;a href=&#34;&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://getcomposer.org/&#34;&gt;Get Composer&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Node.js&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The npm package manager, which will provide us Grunt and Bower is part of Node.js.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://nodejs.org/&#34;&gt;Get Node.js&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;4. Atom.io&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As a web developer you might have heard of Sublime, well suck that! Atom.io is out of question way better. It&amp;rsquo;s opensource, it&amp;rsquo;s customizable down to the core and runs on the most promising technologies. If you&amp;rsquo;re using Sublime and reading this, the time has come to flush your workflow and get startet with Atom.io.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://atom.io/&#34;&gt;Get Atom.io&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;configure&#34;&gt;Configure&lt;/h1&gt;&#xA;&lt;p&gt;We assume you have installed all the tools above properly and ready to run.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1. Install Laravel&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;First download the Laravel package with composer. It doesn&amp;rsquo;t matter where you&amp;rsquo;ll do this. This package will globally available on your host.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;composer global require &amp;quot;laravel/installer=~1.1&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Navigate to a directory with your command line where you want to install your first Laravel project.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;composer create-project laravel/laravel &amp;lt;project name&amp;gt; --prefer-dist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Install Bower and Bootstrap&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Navigate into your project directory.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cd &amp;lt;project name&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a npm configuration file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;npm init&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then install Bower with npm.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;npm install -g bower&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Bower configuration file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;bower init&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And install Bootstrap and jQuery.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;bower install bootstrap jquery --save-dev&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Install and Configure Grunt&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Install the Grunt command line tool with npm.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;npm install -g grunt-cli&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then install the Grunt packages.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;npm install grunt --save-dev&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now add the additional Grunt packages to your npm config file &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#34;devDependencies&amp;#34;: {&#xA;    &amp;#34;grunt&amp;#34;: &amp;#34;~0.4.5&amp;#34;,&#xA;    &amp;#34;grunt-contrib-copy&amp;#34;: &amp;#34;~0.7.0&amp;#34;,&#xA;    &amp;#34;grunt-contrib-cssmin&amp;#34;: &amp;#34;~0.11.0&amp;#34;,&#xA;    &amp;#34;grunt-contrib-uglify&amp;#34;: &amp;#34;~0.7.0&amp;#34;,&#xA;    &amp;#34;grunt-contrib-watch&amp;#34;: &amp;#34;~0.6.1&amp;#34;,&#xA;    &amp;#34;grunt-bg-shell&amp;#34;: &amp;#34;~2.3.1&amp;#34;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you did so run the npm installer.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;npm install&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Grunt task file &lt;code&gt;Gruntfile.js&lt;/code&gt; in the root directory of your project.&lt;/p&gt;&#xA;&lt;p&gt;And add this content.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;module.exports = function(grunt){&#xA;&#xA;  grunt.initConfig({&#xA;    pkg: grunt.file.readJSON(&amp;#39;package.json&amp;#39;),&#xA;&#xA;    cssmin: {&#xA;      files: {&#xA;        src: [&#xA;          &amp;#39;public/style.css&amp;#39;,&#xA;          &amp;#39;bower_components/bootstrap/dist/css/bootstrap.css&amp;#39;&#xA;        ],&#xA;        dest: &amp;#39;public/all.min.css&amp;#39;&#xA;      }&#xA;    },&#xA;&#xA;    uglify: {&#xA;      files: {&#xA;        src: [&#xA;          &amp;#39;public/app.js&amp;#39;,&#xA;          &amp;#39;bower_components/jquery/dist/jquery.js&amp;#39;,&#xA;          &amp;#39;bower_components/bootstrap/dist/js/bootstrap.js&amp;#39;&#xA;        ],&#xA;        dest:  &amp;#39;public/all.min.js&amp;#39;&#xA;      }&#xA;    },&#xA;&#xA;    bgShell: {&#xA;      _defaults: {&#xA;        bg: true&#xA;      },&#xA;      runLaravel: {&#xA;        cmd: &amp;#39;php artisan serve&amp;#39;&#xA;      }&#xA;    },&#xA;&#xA;    watch:{&#xA;      css:{&#xA;        files: [&#xA;          &amp;#39;/public/style.css&amp;#39;&#xA;        ],&#xA;        tasks: [&amp;#39;cssmin&amp;#39;]&#xA;      },&#xA;      js: {&#xA;        files: [&#xA;          &amp;#39;/public/app.js&amp;#39;&#xA;        ],&#xA;        tasks: [&amp;#39;uglify&amp;#39;]&#xA;      },&#xA;      livereload: {&#xA;        options: {&#xA;            livereload: true&#xA;        },&#xA;        files: [&#xA;            &amp;#39;app/views/**/*.php&amp;#39;,&#xA;            &amp;#39;public/*.css&amp;#39;,&#xA;            &amp;#39;public/*.js&amp;#39;&#xA;        ]&#xA;      }&#xA;    }&#xA;  });&#xA;&#xA;  grunt.loadNpmTasks(&amp;#39;grunt-contrib-copy&amp;#39;);&#xA;  grunt.loadNpmTasks(&amp;#39;grunt-contrib-cssmin&amp;#39;);&#xA;  grunt.loadNpmTasks(&amp;#39;grunt-contrib-watch&amp;#39;);&#xA;  grunt.loadNpmTasks(&amp;#39;grunt-contrib-uglify&amp;#39;);&#xA;  grunt.loadNpmTasks(&amp;#39;grunt-bg-shell&amp;#39;);&#xA;&#xA;  grunt.registerTask(&amp;#39;default&amp;#39;, [&amp;#39;cssmin&amp;#39;,&amp;#39;uglify&amp;#39;,&amp;#39;bgShell:runLaravel&amp;#39;,&amp;#39;watch&amp;#39;]);&#xA;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This file provides the following features:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bundling and minifcation of your Bootstrap and custom CSS files and Bootstrap, jQuery and custom JavaScript files.&lt;/li&gt;&#xA;&lt;li&gt;It will start Laravel webserver.&lt;/li&gt;&#xA;&lt;li&gt;Provide the Live Reload feature.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As always you can extend the Grund configuration according to your requirements. Some my want to recompile the Bootstrap less files with an updated fonts folder or add php unitiy testing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;4. Configure Laravel&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to make use of the Live Reload feature, you can either add this JavaScript to your template.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&amp;quot;//localhost:35729/livereload.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or (what I recommend) download and install following blade template files.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://janikvonrotz.ch/wp-content/uploads/2015/01/Laravel-default-template.zip&#34;&gt;Download template files&lt;/a&gt; or get the latest version &lt;a href=&#34;https://gist.github.com/janikvonrotz/68f4da6bc6a4374d9f9b&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Add these files to a new folder called default in the app views folder &lt;code&gt;&amp;lt;project name&amp;gt;\app\views\default&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then delete the file &lt;code&gt;&amp;lt;project name\app\views\home.php&lt;/code&gt; and add a new file &lt;code&gt;&amp;lt;project name&amp;gt;\app\views\home.blade.php&lt;/code&gt; with the following content.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;@extends(&amp;#39;default.master&amp;#39;)&#xA;@section(&amp;#39;content&amp;#39;)&#xA;Content goes here&#xA;@stop&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This template assumes that you distinct between a local and a productive environment. You have to update two configuration files before you&amp;rsquo;ll run your project.&lt;/p&gt;&#xA;&lt;p&gt;In the file &lt;code&gt;&amp;lt;project name&amp;gt;\boostrap\start.php&lt;/code&gt; add your hostname to the detect environment array.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$env = $app-&amp;gt;detectEnvironment(array(&#xA;&#x9;&amp;#39;local&amp;#39; =&amp;gt; array(&amp;#39;&amp;lt;yourhostname&amp;gt;&amp;#39;,&amp;#39;&amp;lt;anotherhostname&amp;gt;&amp;#39;),&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to connect to a MySQL database you also of to update the local environment database config file &lt;code&gt;&amp;lt;project name&amp;gt;\app\config\local\database.php&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;5. Run the Application&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we are ready to run the whole project. You can start the development server by typing &lt;code&gt;Grunt&lt;/code&gt; into your command line. Navigate to &lt;a href=&#34;http://localhost:8000&#34;&gt;http://localhost:8000&lt;/a&gt; and you should see a simple Boostrap site.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Prevent a lot of spam on your next php form with this simple trick</title>
      <link>https://janikvonrotz.ch/2014/04/28/prevent-a-lot-of-spam-on-your-next-php-form-with-this-simple-trick/</link>
      <pubDate>Mon, 28 Apr 2014 12:08:19 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/28/prevent-a-lot-of-spam-on-your-next-php-form-with-this-simple-trick/</guid>
      <description>&lt;p&gt;Spam bots were parsing websites html to code and searching for form patterns. What they luckily don&amp;rsquo;t do in most cases is running javascript or applying css code.&#xA;This behaviour is a good way to tell a human from a spambot apart.&lt;/p&gt;&#xA;&lt;p&gt;Here is a simple example of how to make use of this behaviour to prevent a lot of spam.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;php&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;//post the form fields from below&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    $name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; $_POST[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    $machine &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; $_POST[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;machine&amp;#39;&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ($machine &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;exit&lt;/span&gt;(); &lt;span style=&#34;color:#75715e&#34;&gt;//if a spambot filled out the &amp;#34;machine&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#75715e&#34;&gt;//field, we don&amp;#39;t proceed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;//validate the name and do stuff with it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;?&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt; &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;html&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;    &amp;lt;head&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;        &amp;lt;title&amp;gt;Test Form&amp;lt;/title&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;        &amp;lt;style&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            /* hide the &amp;#34;machine&amp;#34; field */&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            .machine { display: none; }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;        &amp;lt;/style&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;    &amp;lt;/head&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;    &amp;lt;body&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;        &amp;lt;form method=&amp;#34;post&amp;#34; action=&amp;#34;&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;input name=&amp;#34;name&amp;#34; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;!-- below field is hidden with css --&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;input name=&amp;#34;machine&amp;#34; class=&amp;#34;machine&amp;#34; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;!-- edit - show a warning (also hidden) to users with CSS disabled --&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;label for=&amp;#34;machine&amp;#34; class=&amp;#34;machine&amp;#34;&amp;gt;If you are a human, don&amp;#39;t fill out this field!&amp;lt;/label&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;            &amp;lt;input type=&amp;#34;submit&amp;#34; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;        &amp;lt;/form&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;    &amp;lt;/body&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;/html&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The idea here is that spambots will fill out all fields in the form. So we hide one of the fields with CSS (so users don&amp;rsquo;t see it) and if it&amp;rsquo;s filled out, we don&amp;rsquo;t allow the submission to complete.&lt;/p&gt;&#xA;&lt;p&gt;Latest version of this snippet: &lt;a href=&#34;https://gist.github.com/11363197&#34;&gt;https://gist.github.com/11363197&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Install QR code service</title>
      <link>https://janikvonrotz.ch/2014/04/17/install-qr-code-service/</link>
      <pubDate>Thu, 17 Apr 2014 10:35:03 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/17/install-qr-code-service/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9445729&#34;&gt;https://gist.github.com/9445729&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;To generate QR codes with php we are using the project &lt;a href=&#34;https://codeberg.org/janikvonrotz/QR-Generator-PHP&#34;&gt;QR Generator PHP&lt;/a&gt; hosted on GitHub.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/31/install-nginx/&#34;&gt;Nginx&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/01/nginx-minimal-website/&#34;&gt;Nginx minimal website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/20/install-php5-fpm/&#34;&gt;php5-fpm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/11/install-nginx-php5-fpm-website/&#34;&gt;Nginx php5-fpm website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Clone project with git.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cd /usr/local/src&#xA;sudo git clone https://codeberg.org/janikvonrotz/QR-Generator-PHP.git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Rename the project directory to get a shorter url.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo mv QR-Generator-PHP qr&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Add the config to one of your Nginx sites.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server{&#xA;    &#xA;    ...&#xA;    &#xA;    # change location for QR code requests&#xA;    location /qr{&#xA;        root /usr/local/src;&#xA;        index index.php;&#xA;    }&#xA;    &#xA;    location ~ .php$ {&#xA;        &#xA;        ...&#xA;        &#xA;        # change the php root for QR code requests&#xA;        if ($request_uri ~* /qr) {&#xA;            set $php_root /usr/local/src;&#xA;        }&#xA;        &#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Test config and reload Nginx service.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo nginx -t &amp;amp;&amp;amp; sudo service nginx reload&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Test the new QR code service by open a browser on &lt;code&gt;//[host]/qr/?d=example.org&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Install phpMyAdmin website</title>
      <link>https://janikvonrotz.ch/2014/04/14/install-phpmyadmin-website/</link>
      <pubDate>Mon, 14 Apr 2014 09:49:37 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/14/install-phpmyadmin-website/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9392925&#34;&gt;https://gist.github.com/9392925&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/31/install-nginx/&#34;&gt;Nginx&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/01/nginx-minimal-website/&#34;&gt;Nginx minimal website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/20/install-php5-fpm/&#34;&gt;php5-fpm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/25/install-php5-modules/&#34;&gt;php5-mcrypt, php5-mysql&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/11/install-nginx-php5-fpm-website/&#34;&gt;Nginx php5-fpm website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/07/install-mysql/&#34;&gt;MySQL&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Start the installation phpMyAdmin.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install phpmyadmin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As we use nginx for this installation, hit Tab and Enter on the first prompt.&lt;/p&gt;&#xA;&lt;p&gt;Chose &lt;!-- raw HTML omitted --&gt; and enter the MySQL root password on the second prompt.&lt;/p&gt;&#xA;&lt;p&gt;Create a secure password for phpMyAdmin. Don&amp;rsquo;t use the MySQL root password!&lt;/p&gt;&#xA;&lt;p&gt;Add the phpMyAdmin Nginx configuration to one of your websites.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server{&#xA;    ...&#xA;    &#xA;    root /usr/share;&#xA;&#xA;    ...&#xA;    &#xA;    location ~ .php$ {&#xA;        ...&#xA;        &#xA;        # change the php root for phpMyAdmin&#xA;        if ($request_uri ~* /phpmyadmin) {&#xA;            set $php_root /usr/share;&#xA;        }&#xA;        &#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Test config and reload Nginx service.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo nginx -t &amp;amp;&amp;amp; sudo service nginx reload&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open your browser on &lt;code&gt;//[host]/phpmyadmin&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Increase Max Upload for php5-fpm website</title>
      <link>https://janikvonrotz.ch/2014/04/11/increase-max-upload-for-php5-fpm-website/</link>
      <pubDate>Fri, 11 Apr 2014 06:55:10 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/11/increase-max-upload-for-php5-fpm-website/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9604715&#34;&gt;https://gist.github.com/9604715&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;In some cases the default memory allocation for php is not enough to run an application properly.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/31/install-nginx/&#34;&gt;Nginx&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/01/nginx-minimal-website/&#34;&gt;Nginx minimal website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/20/install-php5-fpm/&#34;&gt;php5-fpm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/11/install-nginx-php5-fpm-website/&#34;&gt;Nginx php5-fpm website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;instruction&#34;&gt;Instruction&lt;/h1&gt;&#xA;&lt;p&gt;Update the php5-fpm config.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /etc/php5/fpm/php.ini&#xA;Set memory_limit = 512M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart the php5-fpm service.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service php5-fpm restart&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Install Nginx php5-fpm website</title>
      <link>https://janikvonrotz.ch/2014/04/11/install-nginx-php5-fpm-website/</link>
      <pubDate>Fri, 11 Apr 2014 06:52:52 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/11/install-nginx-php5-fpm-website/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9445746&#34;&gt;https://gist.github.com/9445746&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;This is a minimal Nginx configuration to run php based websites/ applications.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/31/install-nginx/&#34;&gt;Nginx&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/04/01/nginx-minimal-website/&#34;&gt;Nginx minimal website&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/20/install-php5-fpm/&#34;&gt;php5-fpm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Add this Nginx configuration to your website config.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server{&#xA;&#xA;    ...&#xA;    &#xA;    # php5-fpm configuration&#xA;    location ~ \.php$ {&#xA;        &#xA;        set $php_root /var/www/[host];&#xA;        &#xA;        fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;&#xA;        include /etc/nginx/fastcgi_params;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Test config and reload Nginx service.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo nginx -t &amp;amp;&amp;amp; sudo service nginx reload&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Install php5 modules</title>
      <link>https://janikvonrotz.ch/2014/03/25/install-php5-modules/</link>
      <pubDate>Tue, 25 Mar 2014 11:38:33 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/03/25/install-php5-modules/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9758559&#34;&gt;https://gist.github.com/9758559&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;Php5 modules extending the functionality for php scripts and are required by several php projects.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ubuntu server&lt;/li&gt;&#xA;&lt;li&gt;php5-fpm&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Restart the php5-fpm service after every installation.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service php5-fpm restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php5-curl&#34;&gt;php5-curl&lt;/h2&gt;&#xA;&lt;p&gt;CURL is a library for getting files from FTP, GOPHER, HTTP server.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-curl&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php5-dev&#34;&gt;php5-dev&lt;/h2&gt;&#xA;&lt;p&gt;This package provides the files from the PHP5 source needed for compiling additional modules.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-dev &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php5-geoip&#34;&gt;php5-geoip&lt;/h2&gt;&#xA;&lt;p&gt;This PHP module allows you to find the location of an IP address - City, State, Country, Longitude, Latitude, and other information as all, such as ISP and connection type.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-geoip&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php5-mcrypt&#34;&gt;php5-mcrypt&lt;/h2&gt;&#xA;&lt;p&gt;This package provides a module for MCrypt functions in PHP scripts.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php5-mysql&#34;&gt;php5-mysql&lt;/h2&gt;&#xA;&lt;p&gt;This package provides modules for MySQL database connections directly from PHP scripts.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;source&#34;&gt;Source&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://packages.ubuntu.com/&#34;&gt;Ubuntu package repository&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Step by Step: Install WordPress Blog</title>
      <link>https://janikvonrotz.ch/2014/03/22/step-by-step-install-wordpress-blog/</link>
      <pubDate>Sat, 22 Mar 2014 10:26:15 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/03/22/step-by-step-install-wordpress-blog/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Latest Version of this guide: &lt;a href=&#34;https://gist.github.com/9320678&#34;&gt;https://gist.github.com/9320678&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finishing this guide you&amp;rsquo;ll get:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A running WordPress installation&lt;/li&gt;&#xA;&lt;li&gt;Nginx proxy with PHP and Fast CGI&lt;/li&gt;&#xA;&lt;li&gt;MySQL server accessible with phpMyAdmin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Specification of latest running installation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Date: 03.03.2014&lt;/li&gt;&#xA;&lt;li&gt;OS: Ubuntu 64 bit - 12.04.4 LTS&lt;/li&gt;&#xA;&lt;li&gt;Provider: Amazon EC2&lt;/li&gt;&#xA;&lt;li&gt;Browser: Google Chrome - 33.0.1750.117&lt;/li&gt;&#xA;&lt;li&gt;WordPress: 3.8.1&lt;/li&gt;&#xA;&lt;li&gt;Nginx: 1.1.19&lt;/li&gt;&#xA;&lt;li&gt;MySQL: 5.5.35&lt;/li&gt;&#xA;&lt;li&gt;PHP: 5.3.10&lt;/li&gt;&#xA;&lt;li&gt;phpMyAdmin: 3.4.10.1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Requirements&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Server is behind a firewall, that only allows http, https and ssh&lt;/li&gt;&#xA;&lt;li&gt;The server is accessed with ssh keys (user password authentication must be disabled)&lt;/li&gt;&#xA;&lt;li&gt;Server is not accessed with the root user&lt;/li&gt;&#xA;&lt;li&gt;You&amp;rsquo;re able to edit files with &lt;a href=&#34;http://www.cheatography.com/ericg/cheat-sheets/vi-editor/&#34;&gt;VI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;ubuntu&#34;&gt;Ubuntu&lt;/h2&gt;&#xA;&lt;p&gt;Update Ubuntu&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Install additional packages&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo aptitude install build-essential zip git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;mysql&#34;&gt;MySQL&lt;/h2&gt;&#xA;&lt;p&gt;Install MySQL server and php5 MySQL module&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install mysql-server php5-mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set the mysql root user password during the installation&lt;/p&gt;&#xA;&lt;p&gt;Install the default MySQL databases&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo mysql_install_db&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Run the finisher script and respond every prompt with yes to get a secure MySQL installation&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo /usr/bin/mysql_secure_installation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Connect to your new MySQL server&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mysql -uroot -p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Enter the root password&lt;/p&gt;&#xA;&lt;p&gt;And run this command to get the MySQL version&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SHOW variables LIKE &amp;quot;%version%&amp;quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;nginx&#34;&gt;Nginx&lt;/h2&gt;&#xA;&lt;p&gt;Install Nginx&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install nginx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Nginx site configuration file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo touch /etc/nginx/sites-available/wordpress.conf&#xA;sudo vi /etc/nginx/sites-available/wordpress.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Paste this config&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server {    &#xA;listen   80;&#xA;&#xA;&#x9;root /var/www/wordpress;&#xA;&#x9;index index.php index.html index.htm;&#xA;&#xA;&#x9;server_name [example.com];&#xA;&#xA;&#x9;location / {&#xA;&#x9;&#x9;try_files $uri $uri/ /index.php?q=$uri&amp;amp;$args;&#xA;&#x9;}&#xA;&#xA;&#x9;error_page 404 /404.html;&#xA;&#xA;&#x9;error_page 500 502 503 504 /50x.html;&#xA;&#x9;location = /50x.html {&#xA;&#x9;&#x9;root /usr/share/nginx/www;&#xA;&#x9;}&#xA;    &#xA;    client_max_body_size 10M;&#xA;&#xA;&#x9;# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&#xA;&#x9;location ~ \.php$ {&#xA;&#x9;&#x9;try_files $uri = 404;&#xA;&#x9;&#x9;#fastcgi_pass 127.0.0.1:9000;&#xA;&#x9;&#x9;# With php5-fpm:&#xA;&#x9;&#x9;fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;&#x9;&#x9;fastcgi_index index.php;&#xA;&#x9;&#x9;include fastcgi_params;&#xA;&#x9;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Optionally you can rewrite false urls to a specified canonical url&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server {&#xA;    listen       80;&#xA;    server_name  www.example.com  example.com;&#xA;    if ($http_host = www.example.org) {&#xA;        rewrite  (.*)  http://[example.com]$1;&#xA;    }&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a symlink to the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/wordpress.conf /etc/nginx/sites-enabled/wordpress.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart Ngnix&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service nginx restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Check Nginx version&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;nginx -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php&#34;&gt;PHP&lt;/h2&gt;&#xA;&lt;p&gt;Install PHP with FastCGI support&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-fpm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;configure PHP installaton&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; sudo vi /etc/php5/fpm/php.ini&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Find the line &lt;code&gt;cgi.fix_pathinfo=1&lt;/code&gt; by pressing ESC and enter&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/;cgi.fix_pathinfo=1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Uncomment this line and change value to 0&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cgi.fix_pathinfo=0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If this number is kept as 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path—a much safer alternative.&lt;/p&gt;&#xA;&lt;p&gt;Find the line &lt;code&gt;; default extension directory.&lt;/code&gt; and insert below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;extension=mcrypt.so&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Update the listening port for the php fpm&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /etc/php5/fpm/pool.d/www.conf&#xA;Set listen = /var/run/php5-fpm.sock&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart the service&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service php5-fpm restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create the website folder&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo mkdir /var/www/wordpress&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Add a PHP info file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /var/www/wordpress/info.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set content&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;?php&#xA;phpinfo();&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Open your browser on &lt;a href=&#34;http://example.com/info.php&#34;&gt;http://example.com/info.php&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Delete this file if everything works&lt;/p&gt;&#xA;&lt;h2 id=&#34;phpmyadmin&#34;&gt;phpMyAdmin&lt;/h2&gt;&#xA;&lt;p&gt;Install phpMyAdmin&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install phpmyadmin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When phpMyAdmin prompts you to choose a server (either apache or lighttpd)hit tab, and select neither one.&lt;/p&gt;&#xA;&lt;p&gt;When phpMyAdmin asks you wether to configure database for phpmyadmin with dbconfig-common. Chose &lt;!-- raw HTML omitted --&gt; and enter the MySQL root user password&lt;/p&gt;&#xA;&lt;p&gt;Hit &lt;!-- raw HTML omitted --&gt; on the MySQL application password for phpmyadmin prompt.&lt;/p&gt;&#xA;&lt;p&gt;Create a symbolic link for the phpMyAdmin website&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Nginx configuration file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo touch /etc/nginx/sites-available/phpmyadmin.conf&#xA;sudo vi /etc/nginx/sites-available/phpmyadmin.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Paste this config&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server{&#xA;&#x9;listen 80;&#xA;&#x9;&#xA;&#x9;server_name [Your Public IP];&#xA;&#x9;root /var/www/;&#xA;&#x9;&#xA;&#x9;index index.php index.html index.htm;&#xA;&#x9;&#xA;    client_max_body_size 10M;&#xA;    &#xA;&#x9;location ~ .php$ {&#xA;&#x9;&#x9;try_files $uri = 404;&#xA;&#x9;&#x9;fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;&#x9;&#x9;fastcgi_index index.php;&#xA;&#x9;&#x9;include /etc/nginx/fastcgi_params;&#xA;&#x9;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a symlink to the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart Ngnix&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service nginx restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open the browser on http://[YourPublicIP]/phpmyadmin/&lt;/p&gt;&#xA;&lt;h2 id=&#34;wordpress&#34;&gt;WordPress&lt;/h2&gt;&#xA;&lt;p&gt;Open the WordPress site directory&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cd /var/www/wordpress/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Download latest WordPress package and untar it&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo wget http://wordpress.org/latest.tar.gz&#xA;tar -xzvf latest.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Copy the untared files to the current folder and delete the other files&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo cp -r ./wordpress/* ./&#xA;sudo rm -r wordpress&#xA;sudo rm latest.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s create the MySQL WordPress user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mysql -u root -p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Enter the MySQL root user password&lt;/p&gt;&#xA;&lt;p&gt;Create the WordPress database&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CREATE DATABASE wordpress;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create the WordPress database user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CREATE USER wordpress@localhost;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set the password for the WordPress database user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SET PASSWORD FOR wordpress@localhost = PASSWORD(&amp;quot;[password]&amp;quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Grant WordPress user full access on WordPress database&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY &#39;[password]&#39;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Refresh MySQL and exit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FLUSH PRIVILEGES;&#xA;exit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Copy the WordPress example config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo cp wp-config-sample.php wp-config.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Edit the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi wp-config.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set database, database user and his password&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;define(&amp;#39;DB_NAME&amp;#39;, &amp;#39;wordpress&amp;#39;);&#xA;&#xA;define(&amp;#39;DB_USER&amp;#39;, &amp;#39;wordpress&amp;#39;);&#xA;&#xA;define(&amp;#39;DB_PASSWORD&amp;#39;, &amp;#39;[password]&amp;#39;);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Update permissions for Nginx user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo chown www-data:www-data * -R &#xA;sudo usermod -a -G www-data www-data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open the browser on &lt;a href=&#34;http://example.com&#34;&gt;http://example.com&lt;/a&gt; and install you WordPress blog&lt;/p&gt;&#xA;&lt;h2 id=&#34;source&#34;&gt;Source&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://dev.mysql.com/doc/refman/5.7/en/linux-installation-native.html&#34;&gt;Install MySQL&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04&#34;&gt;How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04 by Digital Ocean&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server/&#34;&gt;How To Install phpMyAdmin on a LEMP server by Digi&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04&#34;&gt;How To Install Wordpress with nginx on Ubuntu 12.04 by Digital Ocean&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;http://nginx.org/en/docs/http/converting_rewrite_rules.html&#34;&gt;Nginx rewrite rules&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://dev.mysql.com/doc/refman/5.0/en/installation-version.html&#34;&gt;Get MySQL version&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Install php5-fpm</title>
      <link>https://janikvonrotz.ch/2014/03/20/install-php5-fpm/</link>
      <pubDate>Thu, 20 Mar 2014 13:41:30 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/03/20/install-php5-fpm/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9343960&#34;&gt;https://gist.github.com/9343960&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Install the package with aptitude.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo aptitude install php5-fpm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Check the php5-fpm version.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;php5-fpm -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;source&#34;&gt;Source&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://blog.chrismeller.com/configuring-and-optimizing-php-fpm-and-nginx-on-ubuntu-or-debian&#34;&gt;Configuring and Optimizing PHP-FPM and Nginx on Ubuntu&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
