Select Page
Node.js: Five Things Every PHP Developer Should Know

Node.js: Five Things Every PHP Developer Should Know

I recently started working on a few Node.js applications. Coming most recently from PHP (and Drupal in particular), I found the transition to Node.js to be surprisingly easy. Pleasurable, in fact. But I had to learn to think differently about a few things.

Below I list the five things I think every PHP developer should know about Node.js.

1. Node.js Is Built On Chrome’s JavaScript Engine

Google’s browser, Chrome, has a notoriously fast JavaScript engine called V8. And this JavaScript engine can be cleanly separated from the web browser. Node.js is built on V8. This is one of the main reasons why Node.js is so fast.

This has several positive implications for you, the developer:

  • You don’t need to learn a new “dialect” of JavaScript. I find myself referencing Chrome’s and Mozilla’s JS documentation all the time, because Node works the same way.
  • With V8’s JIT (Just In Time) compiling, apps run at near-native speeds (benchmarks indicate it’s much faster than PHP and Ruby, in terms of running analogous computational tasks).
  • As V8 improves, Node will too.

2. Node.js Isn’t (Just) A Web Server or Platform

Unlike PHP, Node.js is not “web centric” (yes, you can run CLI apps in PHP, but that wasn’t the original intent). Node.js is a general-purpose JavaScript runtime with a host of powerful libraries — one of which happens to provide an HTTP/HTTPS server implementation.

But you can do much more with Node. It is easy to build command line clients and other TCP/IP servers.

On the one hand, this is great news. Node.js is so flexible.

On the other hand, since Node.js isn’t HTTP-centric, you may find yourself having to implement code to do things once provided for you by the framework. In other words, in node, there is no$_GET.

3. Node.js Is Object-Oriented (In That Weird JavaScript Way)

I love jQuery. But it’s made me lazy. It’s made it very easy to write quick and dirty scripts without thinking about architecture. When using JavaScript for a few pieces of browser bling, perhaps this isn’t a bad thing.

But Node’s clearly not about browser bling. It’s about application building. Which means architecture. When you write code in Node.js, you’re going to want to get neck-deep in JavaScripts prototypal object model.

Having that strong 10-years-in-Java background, I thought that JavaScript’s weird prototype system would drive me crazy. And sometimes it does. But surprisingly, I’m falling in love with it. Node.js (and NPM, the amazing Node Package Manager) make such good use of the prototypal JavaScript system that merely writing code “like they do” helped me clear many of the hurdles that my Class/Interface mind thought would be hard to grok.

4. Evented I/O?

Now we’re to the most controversial aspect of Node.js. Node itself runs in one thread. ONE! (Compare this to your typical Apache/PHP system where a dozen or more PHP instances are running at once.) Yet somehow it is fast and efficient.

What’s the secret? Sharing execution time, and offloading intensive IO processes to other threads.

I could go off on a long jargon-filled tangent about the benefits and drawbacks of “evented I/O”, but instead I’ll stick to the practical: When writing in Node.js, you need to think a little harder about whether your task is slow (and I/O bound) or fast. Use asynchronous functions with callbacks or event handlers for the slow work.

The important thing is to make sure that your application code doesn’t allow one request to monopolize the main Node process for too long without giving opportunities for other requests to get some work done.

5. Package Management is a Must!

Be honest. Do you love PEAR? Do you turn almost all of your code into PEAR or PECL packages? Not that many PHP developers do (and a surprising number of them don’t even know what PEAR packages are!).

You probably don’t want to carry that mentality over to Node.js.

  • Node.js is designed to be a minimalistic framework. 90% of the stuff you find in PHP’s core will not be present in Node.js’s core. Need an example or two? Database drivers? Not in Node’s core. Mail libraries? Not in Node’s core. HTML support? Not in Node’s core.
  • But a modular architecture is in Node’s core. And you will use it because it is awesome.
  • The npm tool (Node Package Manager) is the second thing you should download — right after Node. With it, a world of Node.js libraries will be available to you. Drivers, parsers, formatters, servers… there are thousands of packages.
  • Building and publishing your own packages is dead simple. I released my first one only a few days after starting with Node. It’s just that easy.

If you’re a Drupal developer, you can think about Node’s packaging system as something similar to Drupal modules — but with the developer (and not site-builder) in mind.

How To install vsftpd on CentOS 6

How To install vsftpd on CentOS 6

The first two letters of vsftpd stand for “very secure” and the program was built to have strongest protection against possible FTP vulnerabilities.

Step One—Install vsftpd

You can quickly install vsftpd on your virtual private server in the command line:

We also need to install the FTP client, so that we can connect to an FTP server:

sudo yum install ftp

Once the files finish downloading, vsftpd will be on your VPS. Generally speaking, the virtual private server is already configured with a reasonable amount of security. However, it does provide access to anonymous users.

Step Two—Configure VSFTP

Once VSFTP is installed, you can adjust the configuration.

Open up the configuration file:

sudo vi /etc/vsftpd/vsftpd.conf

One primary change you need to make is to change the Anonymous_enable to No:


Prior to this change, vsftpd allowed anonymous, unidentified users to access the VPS’s files. This is useful if you are seeking to distribute information widely, but may be considered a serious security issue in most other cases. After that, uncomment the local_enable option, changing it to yes.


Finish up by uncommenting command to chroot_local_user. When this line is set to Yes, all the local users will be jailed within their chroot and will be denied access to any other part of the server.


Finish up by restarting vsftpd:

sudo service vsftpd restart

In order to ensure that vsftpd runs at boot, run chkconfig:

chkconfig vsftpd on

Step Three—Access the FTP server

Once you have installed the FTP server and configured it to your liking, you can now access it.

You can reach an FTP server in the browser by typing the domain name into the address bar and logging in with the appropriate ID. Keep in mind, you will only be able to access the user’s home directory.

Alternatively, you can reach the FTP server through the command line by typing:


Then you can use the word, “exit,” to get out of the FTP shell.

Source : Digitalocean

How To Setup Virtual Host (Server Block) For Nginx On Ubuntu 14.04

How To Setup Virtual Host (Server Block) For Nginx On Ubuntu 14.04

Here’s a brief tutorial that shows you how to create a virtual host or server block on Nginx web server. Virtual Host is a term used with Apache2 to host multiple websites on a single web server.

Nginx on the other hand calls it Server Block. So to Nginx it’s called Server Block and Apache2, it’s called Virtual Host. So instead of running a single website on a single web server, virtual hosting allows for one web server to host multiple websites with different domain names in separate containers.

That’s what this short guide is going to show you. Websites hosted in virtual environments will need separate root directories to host each website content. Each website also will have its own configurations files which control how the website functions and that’s the beauty of implementing virtual hosting with web servers.

To get started with implementing virtual server blocks on Nginx, continue below.


Install Nginx on Ubuntu 14.04

First install Nginx web server. To do that on Ubuntu 14.04, run the commands one

sudo apt-get update && sudo apt-get install nginx

Creating Virtual Directory

The next step is to create separate virtual directories for each website. Since Nginx default path is at /var/www/, we’re going to be creating our directories in there.

Create a virtual directory for a website called

sudo mkdir -p /var/www/html/

Content for domain will live in the /var/www/html/ directory. You can create as many you like, just keep them separate.

The next thing is granting the appropriate ownership to Nginx webserver. To change the ownership of the directory to Nginx, run the commands below.

sudo chown -R www-data:www-data /var/www/html/

Next, change the permissions on the directory so Nginx can function correctly.

sudo chmod -R 755 /var/www/html

Creating a test page
Now you can create a test index page and place it in the vhost folder of to verify if the virtual host is working since there’s nothing there. Copy and page the code below into a new file called index.html

This is my test page

Configuring the virtual host
The next step is defining the virtual host perimeter in its configuration file. Virtual host configuration files are used to control how the virtual webserver functions and operates.

In this file is where you define the document root directory, control access rights, define the server name, admin email address and more. The configuration file is very important.

When you install Nginx on Ubuntu, a default configuration file with the basic settings is created. This file is there to verify that Nginx is working after you browse to the host.

So, we’re going to make a copy of the default configuration file to create the domain configuration file. To do that, run the commands below.

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/

Next, open the new configuration file for and define the configurations for the virtual site.

sudo vi /etc/nginx/sites-available/

Configure the file

server {
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
root /var/www/html/;
index index.html index.htm;

This is the basic configuration just to confirm that the virtual host is up. For more detailed configuration of Nginx, do a search on this site for Nginx configuration.

Save the file.

Finally, run the commands below to enable the site by creating a symbolic link to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Run the commands below to remove the default enabled site to prevent duplicate entry for the default IP/Port

sudo rm /etc/nginx/sites-enabled/default

Restart Nginx and test the site

sudo service nginx restart

If you’re running this test locally, create a host entry on your local computer for with IP address of the server.

Do this for as many virtual websites as you wish, just make sure to define the unit IP addresses.

Features and benefits of zend framework

Features and benefits of zend framework

Experienced developers claim that using ZendFramework developing web-applications is a better approach than writing your own code. Why? Let’s look at.

Proof of compliance with standards and use the best programming practices:

One of the features of PHP is that it is not certain imprisons developer coding standards. Every experienced PHP-developer eventually comes to their own style of coding and design texts programme. I understand someone else’s program often cause trouble, which is important for the coordinated work of the project team. Relative “softness» PHP to the free coding method sometimes leads to “poor” and potentially vulnerable code.

ZendFramework avoids this danger by offering developers a set of libraries written in compliance with today’s best PHP-programming techniques. The framework offers a standard layout of project files, provides turnkey solutions the most common problems arising in web-programming – is cleaning and checking of input data, etc.. Thus, the construction project on the framework, this leads to the creation of more high-quality code and more secure applications. In addition, it should be noted good documentation ZendFramework, allowing hassle-free to add to the project team for new developers at any stage of its implementation.


ZendFramework implemented with full support for the new object model in PHP version 5.x The architecture of this model, which is based on OOP (Object Oriented Programming), encourages developers to write programs based on the reuse of code, thus reducing the time to write duplicate code. It is important for web-applications that have multiple interfaces for data exchange. For example, if you need to add to an existing application in the search interface based on XML, optionally repeating the code logic controller available – the process of adding new functionality to ZendFramework is simple and transparent.


ZendFramework designed for building applications on the Internet. This means that such an application can take advantage of anyone, ie people living in different countries, speak different languages, use different formats in the notation of the date, time and currency. There was a time when the desire to write the developer “friendly” site for visitors from different countries were significant effort and headache. With ZendFramework this can not worry – component ZendLocale language setting controls the component responsible for ZendTranslate multilingual and work with Latin characters, Chinese and other scripts, components and ZendDate ZendCurrency responsible for localized formatting of dates, times, and currency.

Open source

In the financial support of the project the company is actively involved ZendFramework ZendTechnologies. But despite this, ZendFramework is an open source and developed mainly large group of volunteers that fix bugs and add new features. ZendTechnologies officially determines the direction and development of a group of “leading developers” that produce the final product functionality. Thus, the framework is available for use without paying license fees or the need to purchase additional hardware or software.

Extensive community support

Your project using ZendFramework, can easily integrate a Flickr photo galleries or simply maps GoogleMaps-use components and Zend_Service_Flickr Zend_Gdata. Interaction with Flash-application that uses the format AMF (ActionMessageFormat) of Adobe performed using component Zend_Amf. Ability to organize RSS-subscription newsletter legkorealizuetsya component Zend_Feed.

These features are mentioned in order to point out one of the attractive features ZendFramework-use creative forces of hundreds of experienced developers worldwide. ZendFramework includes a plurality of independent components that are used by developers to quickly add new features to your PHP-proekty.Ctochki cost time and effort, this technique of the project is much more preferable in comparison with writing your own code.

Google Sitelinks search box within the search results

Google Sitelinks search box within the search results

Starting today, Google has announced that you’ll be seeing a new and improved sitelinks search box. This new search box is designed to make it easier for users to reach specific content on your site, directly through your own site-search pages.

Google points out that when When users search for a company by name they may really be searching for something specific to that company’s website. Previously, when Google’s algorithms detected this, they would display a larger set of sitelinks and an additional search box below that search result. That search box which let users do site: searches over the site straight from the results.

With the change that Google rolled out today, the sitelinks search box is now more prominent and placed above the sitelinks. The new search box also supports Autocomplete.

The new site links search box has the ability to send the user directly to your website’s own search pages, provided your pages are marked up correctly. Here’s how to markup your site in order to enable this feature.

You need to have a working site-specific search engine for your site. If you already have one, notify Google by marking up your homepage as a entity with the potentialAction property of the markup. You can use JSON-LD, microdata, or RDFa to do this; check out the full implementation details on Google’s developer site.

If the markup is implemented correctly on your site, users will have the ability to jump directly from the sitelinks search box to your site’s search results page. If Google doesn’t detect any markup, users will be shown a Google search results page for the corresponding site: query, just as they have been doing up to this point.