Phalcon PHP – i’m lovin it

Since i gave up working with Symfony 1.4, i was searching for a new framework. Because i couldn’t find one that i like, i ended up in developing a small framework by myself. Searching for some solutions related to ORM and ODM, i read some posts related to Phalcon.

Honestly, in a few minutes, i felt in love with this framework. Mainly because of the architecture (very similar with what i developed for myself) and because it is written in C, and it comes as a php extension.

The learning curve should be very fast for any developer that has the basic knowledge about MVC pattern and is familiar with namespaces. Also, the documentation is awesome + that there are a tons of examples on Github.

I am testing it under Ubuntu, Nginx + PHP-FPM – it is incredibly fast. Anyway, there are a lot of improvements that has to be made, but they are moving fast.

All in all, i’m lovin it !

Nginx – upstream sent too big header while reading response header – solution

If you get this kind of error in your nginx logs:

ERROR: *1754 upstream sent too big header while reading response header from upstream, client: X.X.X.X, server: XXXX

One solution that worked for me, was to set the fastcgi_buffers and fastcgi_buffers_size in nginx configuration file:

$ vim /etc/nginx/nginx.conf

Add the following params to your nginx configuration file:

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;

Restart nginx:

$ /etc/init.d/nginx restart

* This helped you ? Please share.

Installing Redis + Php Redis Extension + igbinary in Ubuntu 12.04

This is a quick example of how to install Redis server, Redis PHP extension + Igbinary in Ubuntu 12.04. All steps requires sudo access.

1. Install Redis server

Because the official Ubuntu PPA is not updated with the latest version of Redis, we need to add another repository:

$ sudo add-apt-repository ppa:chris-lea/redis-server
$ sudo apt-get update
$ sudo apt-get install redis-server

If “add-apt-repository” fails, try to run this first:

$ sudo apt-get install python-software-properties

2. Install igbinary

$ sudo pecl install igbinary

3. Install PHP Redis extension

$ cd
$ git clone https://github.com/nicolasff/phpredis.git
$ cd phpredis
$ phpize
$ ./configure --enable-redis-igbinary
$ sudo su
$ make && make install

There is a repository that has the php redis helper: https://github.com/ukko/phpredis-phpdoc

Hope this was heplful 🙂

Port forwarding with iptables

If you ever want to try port forwarding with iptables, here is a quick example of forwarding a public port (45000) – public network to a private port (22) – ssh – private network:

$ iptables -t nat -A PREROUTING -p tcp --dport 45000 -j DNAT --to-destination 192.168.1.200:22
$ iptables -t nat -A POSTROUTING -j MASQUERADE

If this is not working, check if your system has enabled ip forwarding. If not, execute this in your terminal:

$ sysctl net.ipv4.ip_forward=1

* The above command might not work if you are on a VPS.

Avoid ssh connection timeout

One way to avoid ssh connection timeout, is to use your ssh config file:

$ vim ~/.ssh/config

Add the following lines:

Host myhost
  HostName myhost.tld
  ServerAliveInterval 60
  Port 22
  User myusername

Or, if you want to set the keep alive for all hosts:

Host *
  ServerAliveInterval 60

Tip: now you can connect like this:

$ ssh myhost

Want Your Company to Grow? Fire Your Managers!

Too many employees work for their boss rather than their company or their clients. Businesses these days are filled with multiple layers of management, and employees often find themselves playing politics and focusing on tasks to make their boss happy.

At the end of the day, the company quickly forgets what their goals are and what they are in business to do — and everyone is focusing on the task at hand with little sense of how it fits into the bigger picture.

If you notice this in your workplace, your top-down hierarchy is the culprit.

By eliminating this model at my digital marketing agency, Ciplex, we created a company people love working at, and saved money in the process. Our customer satisfaction went up, and the quality of work improved. We have happier employees, satisfied clients, lowered costs, and a better company overall.

 

Read the full article