Create a Local Development Environment on a Mac

Open Terminal

I usually do this by open the search option and search for Terminal.

Install Homebrew aka Brew

The first thing we do is install Homebrew. With Homebrew you can really turn your Mac into the development machine of your dreams.

Here’s how you do it:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Wget and Unzip

The next step is to install everything the other packages depend on. I am not getting into too much detail here. Here’s the list, just copy the command into Terminal and hit enter

Brew install wget
Brew install unzip
Brew install re2c

Install Apache

Brew install httpd

Add the Apache server to your start-up list so that it automatically starts when you reboot your Mac. Do this as follows:

brew services start httpd

Install and config PHP

Brew install php

Add PHP to your start-up list so that it automatically starts when you reboot your Mac. Do this as follows:

brew services start php

Edit php.ini. Mine is located in /usr/local/etc/php/7.3/.

Get SSH2 working on a Mac

Brew install openssl
Brew install libssh2

Download and install the PHP 7 module for SSH2. I personally like to keep my Mac as clean as possible, and if you also wish to do that I suggest you create a ‘src’ dir in your root, the CD into that dir and download and extract the zip file as stated below:

wget https://github.com/Sean-Der/pecl-networking-ssh2/archive/php7.zip
unzip php7.zip
cd pecl-networking-ssh2-php7
phpize
./configure
make
sudo make install

Now here comes the most tricky part of all.

If you are as unlucky as me you get a bunch of errors and warnings after running the make command. It took me half a day to figure out how to work around it, so here’s my solution:

The errors occur because they forgot to typecast variables in C, so we need to do this ourselves to get to the next step in this installation guide.

Edit ssh2_fopen_wrappers.c, I personally prefer doing this in an IDE like Visual Studio Code.

We only need to solve the errors, in my case three, since these are the reason the installation of the PHP module for SHH2 failed. I have bolded the invalid operants and will show you the fix below.

/src/pecl-networking-ssh2-php7/ssh2_fopen_wrappers.c:1248:42: error: invalid operands to binary expression (‘zend_string’ (aka ‘struct _zend_string’) and ‘int’)
if (resource->path && resource->path[0] == ‘/’) {

/src/pecl-networking-ssh2-php7/ssh2_fopen_wrappers.c:314:24: error: invalid operands to binary expression (‘zend_string’ (aka ‘struct _zend_string’) and ‘int’)
if (resource->host[0] == 0 && context &&

/src/pecl-networking-ssh2-php7/ssh2_fopen_wrappers.c:300:24: error: invalid operands to binary expression (‘zend_string’ (aka ‘struct _zend_string’) and ‘int’)
if (resource->host[0] == 0 && context && psftp &&

Looking at the details of the error message we can see that we need to typecast integers into strings, and therefore we wrap the (bolded) variables with typecast functions itoa().

  • itoa(resource->path[0]) == ‘/’
  • itoa(resource->host[0]) == 0
  • itoa(resource->host[0]) == 0

That’s it, we can now move on, run make once more, and finish this part of the installation by running sudo make install. But remember where the files are installed, you well need to use this location later. Mine are placed in /usr/local/Cellar/libssh2/1.8.0.

Edit php.ini again and add extension=ssh2.so.

Brew install autoconf

Install MySQL server

Brew install mysql

Again, if you want to have MySQL in your start-up list, you can do so with the following command:

brew services start mysql

The first time you will have to log in as the root user, and you don’t need a password.

mysql -u root

Once logged in we will have to create a new user, grant him the required privileges and the alter him so the user can also log into phpMyAdmin. Here’s how you do it:

CREATE USER 'giorgio'@'localhost' IDENTIFIED BY 'PASSWORD';

GRANT ALL PRIVILEGES ON *.* TO 'giorgio'@'localhost'
WITH GRANT OPTION;

ALTER USER 'giorgio'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';

You can, of course, use any username, and don’t forget to change the default password ‘PASSWORD’ into something slightly more secured…

Since this is my development machine, I prefer to keep user root without a password. It might save me a lot of frustration at some point.

To exit MySQL you can type \q and hit enter.

Install PHPMyAdmin

To install PHPMyAdmin and make it work, you will also have to edit the httpd.conf file. Here are the steps to take:

Brew install phpmyadmin

To enable phpMyAdmin you will have to add the following code to httpd.conf:

Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   <IfModule mod_authz_core.c>
      Require all granted
   </IfModule>
   <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
   </IfModule>
</Directory>

Finally, restart Apache and browse to http://localhost/phpmyadmin, and voilà!

Here’s a really good guide about SASS, I suggest you scan it to understand what SASS is all about.

Install SASS

If you are a web developer like me, you might find it cool to install SASS as well. Here’s how you do it with Homebrew:

brew install sass/sass/sass

(Note to self) Here’s how you compile and compress (minify) your sass files:

sass style.scss:../stylesheets/style.css --style compressed

Install Pure-FTPD

Brew install pure-ftpd

I will add some more details about creating a Pure-FTPD user and everything related. But first, here’s a bonus:

Add a domain to your host file for local development

sudo nano /etc/hosts

And add your domain as follows, pointing to 127.0.0.1 which is your localhost:

127.0.0.1    domain.com    www.domain.com

And don’t forget, you must also flush your Mac’s DNS cache with the following command:

sudo killall -HUP mDNSResponder

Installing Fail2ban on CentOS

Here’s a short tutorial for those of you looking to install Fail2ban on an existing CentOS server or VPS.

First of all, you will have to determine which CentOS version you have, with the following command after starting an SSH session using a terminal window:

cat /etc/centos-release

The response will probably be something like this:

CentOS release 6.8 (Final)

Now that we know the CentOS version is 6, we will have to get the latest EPEL yum repository, using the following command:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

Next step is to install Fail2ban with the following command:

yum install fail2ban

When prompted Is this ok [y/N]: please type y and then hit enter.

This may take a few minutes, so sit back and relax waiting for the installation to finish.

The reasons you might want to protect your server or VPS using Fail2ban is because you are experiencing too many false logins attempts for WordPress, Proftpd, Exim2 or sshd4/sshd5 for example. To do so you will have to create the following local configuration file, using an editor such as nano:

nano /etc/fail2ban/jail.local

(Don’t have Nano? You can install Nano with the following command: yum install nano.)

Here is how to set-up an sshd jail to catch failed login attempts to SSH:

[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/secure
maxretry = 3
findtime = 3600
bantime = 86400

Here is how to set-up an exim jail to catch failed login attempts to Exim:

[exim]
enabled = true
port = smtp,465,submission
filter = exim
logpath = /var/log/exim/mainlog
maxretry = 3
findtime = 86400
bantime = 31536000

Now that we have created these jails, and saved our configuration file (ctrl+x) we have to restart our server or VPS with the following command:

service fail2ban start

If everything went as expected you should get the following response:

Starting fail2ban: [ OK ]

Using Fail2ban to block login attempts to WordPress

If additionally you also would like to protect your server or VPS from failed login attempts to WordPress, you should first create a filter.

Your filters are located here: /etc/fail2ban/filter.d/

Create a new filter named wordpress.conf using Nano as follows: nano /etc/fail2ban/filter.d/wordpress.conf

Copy and paste the following code into the newly created wordpress.conf filter file:

# Fail2Ban filter for wordpress
#

[INCLUDES]

before = common.conf

[Definition]

_daemon = wordpress

failregex = ^%(__prefix_line)sAuthentication failure for .* from <HOST>$
^%(__prefix_line)sPingback error .* generated from <HOST>$

ignoreregex =

# Author: John Doe

Now that you have created the wordpress.conf filter, you will need to add a new rule to your jail.local file which you have previously created:

[wordpress]
enabled = true
filter = wordpress
logpath = /var/log/secure
maxretry = 3
findtime = 86400
bantime = 31536000
action = iptables-multiport[name=wordpress,port="80,443"]

Finally, you will have to restart Fail2ban using the following command: service fail2ban restart

If everything went well, this is what the response should look like:

Stopping fail2ban: [ OK ]
Starting fail2ban: [ OK ]

Congratulations, your server or VPS is now protected against scum trying to make your life miserable!

Back with a Vengeance!

The summer is nearing its end, and the ‘good times’ are coming. Just like most other gambling affiliates, I suffer badly during the months of July and August – less traffic, less rake, and so on. During the 2009 summer I lost about 50% of my income, which scared the crap out of me, but thankfully this year, mainly because of investing a fair amount of money into SEO, I managed to keep a stable income. Fair to say, I hate the summer just as much as I love it!

Thursday we came back from our family vacation. This year we’ve spent two weeks in Estepona (15 km from Marbella) South of Spain. This is also the region we are planning to move to, at least in our dreams (until I convince Lydia that there are plenty of decent schools for our children). The climate is very good all year round, the Spanish people are really friendly, and life over there seems to be a real bargain compared to the Netherlands. And let’s not forget, with a possible government ran by Geert Wilders’ party… who wants to be here after all.

Anyway, the vacation was rather good, although the hotel could have been much better for a four-star hotel. The room was nice, the hotel looked nice too, including the poolside, but these douche bags were charging us for about everything you can think of! If you ever think of going to Estepona, think again before booking the Pierre et Vacances – Calendonia Golf Resort.

Three weeks before leaving I decided to do what Tim Ferriss says, the author of the 4-Hour Workweek. I decided to focus on projects that are currently generating the most of my income, to make even more with them, instead of putting my energy into newly launched projects. So I redesigned Poker For Free, the site got a complete overhaul. While I was doing so, I was split testing the homepage to see if the new design outperformed the old one, and it did. So after working day and night for three weeks, I decided to put the site live just before flying to Spain. Quite a risk, but I was so excited that I didn’t want to wait. Fortunately, it didn’t turn out to be a bad decision.

While I was gone I used my iPhone to periodically check my e-mail and my statistics, and was happy to find out that Poker For Free’s traffic went up by 50%!!! Of course, this had nothing to do with the new site, but all with the $20,000+ which I invested in SEO over the past 8 months. With my site performing so well, I couldn’t wait to get back and work, but on the other hand, I was really enjoying the time off with the family – so I let it rest.

As Pursuing Success is my personal and marketing blog, it’s about time that I should write something interesting about affiliate marketing, right? So my next blog will be about the new Poker For Free, and what I did prior to merging hundreds of pages into the new site. That’s a promise! But for now, I will keep it a little bit more personal though.

While in Spain, I kept going to the gym every other day while Dante went to bed for his siesta. Since I started working out in February, it has become one of my favorite pass times. I managed to lose 7 kg already (my current weight is 82 kg), but I think that it must be at least double as much in fat effectively, as I gained quite a bit in muscles too, obviously. I am now proud to announce that I have a Four-Pack, and it won’t be too long before I get to that much admired Six-Pack!

August 18, 2010 – I’m continuing where I left off 10 days ago, and of course many crazy things have happened in the meantime. God, don’t you love the affiliate life! One of the things that worries me is PokerStars. They are so big and powerful, and think they can keep screwing affiliates… over, and over again. And the shittiest thing about it is that I have just reinstalled them on Poker For Free, as a service to my US visitors, about 40% of my total traffic. Want to know why I don’t feel comfortable with my recent decision to continue working with PokerStars, please have a look at this PAL thread: PokerStars Partners are Fucking You Over. Read, or scan it, but you will get the point.

Before I left to the South of Spain, I received an email from Barry with Heaven Affiliates. One of my domains, pokerheavenreview.com, infringed their registered trademark, and he politely asked me to take it down, either by handing over the control to them or redirect it to another domain. I wouldn’t be me if I didn’t try to get something out of it, and asked them for a compensation of $250. Unfortunately, they denied it, but in a very decent matter, so I let it rest and told them I would take it down after I got back from vacation. So today I finally moved my Poker Heaven mini-site to its new location, and 301 redirected the old URLs. The new location, DepositPoker.co.uk, is a site I bought from a guy at the forums, which I already wrote something about in one of my previous blog posts.

During my daily workouts sessions at the gym, I have given some special thought to my next blog post. As you could read earlier in this one, my next post will be about redesigning an existing website with reasonable amounts of traffic. I think I might have found a few ideas to come with an interesting article, and with the transition of PokerKamers.nl the other day, the Dutch equivalent of Poker For Free, I also managed to refresh my own memory a little bit. I am actually looking forward to writing it, but I have some other really important things on the agenda first, such as the translation of the almost 3,000 words counting Poker Crusher Review. I shouldn’t be making any more promises, except to my kids!

Screenshot of Externally Linked ImageThe last topic, before I call it a day and visit my brother in law for a cup of coffee, is something I discovered while exploring my site’s statistics. I noticed a lot of hits coming from two specific freeroll forums. I am not mentioning their URLs on purpose, because I believe password thieves are about the lowest scum of the affiliate industry you can get. Back to the point, it came to my notice that the hits from these specific referrals were occurring because of an externally linked image causing a 404 error, an image that was deleted when I launched the new Poker For Free site. Today I gave them a Dutch treat, and replaced my image with a new one telling their visitors: “Type pokerforfree.org in your address bar.” I don’t know, and honestly, don’t care if I actually get any traffic off it, I just had some fun doing it. Next time you steal from me, or whichever hard working affiliate, think again bitch!

Overhauling the German Max Poker Bonus

Max Poker Bonus LogoYesterday I’ve been mostly busy moving the German Max Poker Bonus to a new environment and upgrading the scripts to our latest’s. When Kurt and I started working together and created our first Max Poker Bonus site, we decided to host it on a server located in Austria (instead of Germany) because of a German law that prohibits sites linking to online gaming sites. This law is also the reason that we chose to use a .com, instead of a .de domain. So we found a small, but the reliable host, where the wires are short when you’re in need of assistance. Host Austria that is.

Unfortunately, Host Austria’s infrastructure was a little bit outdated, and because of that many of the scripts I’ve created for the Dutch Max Poker Bonus and UK Max Poker Bonus didn’t work. We could easily have moved to another host, but we decided to stay, as quite frankly we were more than satisfied with their service.

Long story short, yesterday was the big day! Christian from Host Austria copied our site and database to a new server, and I made sure that all scripts got upgraded and verified that everything worked as it should. After changing the DNS overnight, I woke up this morning to find our site running flawlessly. Great!

Today I will finish off the big overhaul.

As many of you already know, Google recently released Site Performance, a tool that you can find under Labs in your Webmaster Tools. This, together with Google’s Page Speed tool and Yahoo’s YSlow tool, both add-ons to Firebug, gives you advice in which areas you can adjust your to improve its performance. Things like enabling Gzip compression or parallelizing downloads can really speed up your site. I’ve done this (and more) for a few of my sites already, and I really recommend doing it if you own a site with a fair amount of traffic. Case studies have proven that a faster loading website drastically improves user experience, thus conversions, and we all know what that means!