Php

Apache and PHP on OS X Yosemite

Apache and PHP on OS X Yosemite

It’s just a short instructions how to run Apache and PHP on OS X Yosemite.

PHP and Apache are already there – just need to run Apache and enable PHP. Video showing up whole process is available here:

Here you can check out exact changes.

Firsting first – we have to run Apache

sudo apachectl start

Then make some changes in httpd.conf file

sudo nano /etc/apache2/httpd.conf

HHVM on Amazon EC2 in 2 minutes

HHVM on Amazon EC2 in 2 minutes

Probably you already heard about  HHVM . As on their website:

HHVM is an open-source virtual machine designed for executing programs written in Hack  and PHP . HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.

Using simple terms – HHVM allows you run scripts written in PHP but much, much more faster. Obviously you the main purpose of HHVM is to run HACK language, but it works pretty good with PHP itself.

PHP, work queues

PHP, work queues

Biggest pain point in PHP is lack of asynchronous calls. The only reasonable way is to use some kind of “backend” processing and task list to execute. Some people use cron to run given script each n-minutes and execute tasks. But there is a little bit more “professional” approach.  Beanstalk is a simple, fast work queue. Idea is pretty simple – you can just throw tasks into queue and then have background worker which is pulling data from pipe and executes task.

Couple ideas: sending emails, processing images, making heavy queries into database. But the best part of it – you don’t have to use PHP for back processing. It could be anything, because protocol us universal and worker and client doesn’t have to be in the same language. So you can schedule task in PHP, and run it in Go. I’m not going too much into details. Just run some examples.

Phalcon is a new PHP Framework of my choice

Phalcon is a new PHP Framework of my choice

I’m working on multiple PHP based projects. Most of them using CodeIgniter as a base framework. I mastered it into stage, where has no secrets for me. The problem is that I also know disadvantages of this bit outdated framework. Recently core team announced that they are dropping future development so it means that CI is dead. Doesn’t mean that I don’t like it anymore. I just started looking for something new.

I like CI because I got control over everything. Modern PHP frameworks trying to solve all problems for you. It’s amazing, but lack of control is what you don’t need in when you developing projects. What do you need it’s this easy flow during development process. Full control over your MVC structure, but also a lot of “help” from framework itself.