News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Julien Pauli:
Zoom on PHP objects and classes
March 26, 2015 @ 12:50:49

Julien Pauli has a recent post to his site that "zooms in" on objects and classes with a look behind the scenes at how they're handled in the PHP source (at the C level) with plenty of code examples and explanations as to how they work.

Everybody uses objects nowadays. Something that was not that easy to bet on when PHP5 got released 10 years ago (2005). I still remember this day, I wasn't involved in internals code yet, so I didn't know much things about how all this big machine could work. But I had to note at this time, when using this new release of the language, that jumps had been made compared to old PHP4. The major point advanced for PHP5 adoption was : "it has a new very powerful object model". That wasn't lies. [...] Here, I will show you as usual how all this stuff works internally. The goal is always the same : you understand and master what happens in the low level, to make a better usage of the language everyday.

The article does a great (if lengthy) job of covering everything that happens with PHP's objects and class system, including stats about memory consumption. He includes both the PHP code and the C code to illustrate what's happening with classes, interfaces, traits and object methods/attributes (including object references). He also talks about what "$this" is and how class destructors are handled.

0 comments voice your opinion now!
object class behindthescenes detail c code memory usage

Link: http://jpauli.github.io/2015/03/24/zoom-on-php-objects.html

ClanCats Station:
Writing a webserver in pure PHP - Tutorial
March 26, 2015 @ 11:27:42

On the Clancats.com blog there's a recent post showing how to create a web server in pure PHP, an interesting experiment but definitely not recommended for any kind of higher load situation.

Well, this is pretty useless, but it is possible. But again its pretty.. uesless. This tutorial will hopefully help you to better understand how a simple webserver could work and that it's no problem writing one in PHP. But again using this in production would be trying to eat a soup with a fork. So just, .... just don't. Let me shortly explain why this is not a that good idea.

PHP is a scripting language that simply is not really designed for such tasks. A webserver is a long running process which PHP is not made for. Also PHP does not natively support threading ( pthreads ), which will make developing a good performing webserver a really hard task.

He walks you through all the code needed to create the web server (also available on GitHub) by making:

  • A "server" that does the listening for incoming and sends outgoing requests
  • A request object that parses the incoming request and makes header and body content available
  • A response object that allows for the setting of response codes, body content and headers
  • Exception handling for problems encountered during the request/response process

The full code is provided during the process along with explanations of what each part does. There's also a basic introduction to what a typical web server is and how the process of request/response usually flows.

0 comments voice your opinion now!
webserver tutorial version request response server

Link: http://station.clancats.com/writing-a-webserver-in-pure-php

Remi Collet:
PHP 7.0 as Software Collection
March 26, 2015 @ 10:15:48

Remi Collet has a new post today talking about the next major release of the PHP language - PHP 7 - and how it, in its current state, can be installed now as an RPM from the "remi" repository as a software collection.

RPM of upcoming major version of PHP 7.0, are available in remi repository for Fedora 20, 21, 22 and Enterprise Linux 6, 7 (RHEL, CentOS, ...) in a fresh new Software Collection (php70) allowing its installation beside the system version. As I strongly believe in SCL potential to provide a simple way to allow installation of various versions simultaneously, and as I think it is useful to offer this feature to allow developers to test their applications, to allow sysadmin to prepare a migration or simply to use this version for some specific application, I decide to create this new SCL.

Instructions for the installation (via yum) are included and a list of some things "to be noticed" about the setup are also included.

0 comments voice your opinion now!
php7 software collection fedora enterprise linux rpm yum install remi repository

Link: http://blog.famillecollet.com/post/2015/03/25/PHP-7.0-as-Software-Collection

SitePoint PHP Blog:
Top 10 Z-Ray Features to Check Out
March 26, 2015 @ 09:50:23

The SitePoint PHP blog has a new post today from Daniel Berman (of Zend) with the top 10 features of Z-Ray to be sure to check out. Disclaimer: Z-Ray is a tool provided by Zend, a part of their Zend Server product.

Necessity is the mother of invention goes the famous saying. For PHP developers, there is no greater need than visibility. But developers today have a tough choice to make as they develop and debug their apps. Either use crude methods such as printing, debugging information, or storing it in a log file, or - use multiple debugging/profiling tools that are awkward and require a lot of work from the developer's side. [...] This article introduces the top 10 features of Z-Ray - an innovative new technology from Zend that makes PHP development a whole lot quicker and easier by giving developers unprecedented insight into their code - and the visibility they need to develop top-notch apps.

Among the items on their Top 10 list are things like:

  • Viewing information about page requests
  • Execution time and memory consumption
  • Showing errors and warnings
  • Viewing functions called during execution
  • Debugging features for mobile apps and APIs

Check out the full post for a list of more features and screenshots/detail on each one.

0 comments voice your opinion now!
zend zray zendserver top10 list features screenshot

Link: http://www.sitepoint.com/top-10-z-ray-features-check/


DigitalOcean Community Blog:
How To Set Up a Two Node LEPP Stack on CentOS 7
March 25, 2015 @ 11:52:30

On the DigitalOcean community blog they've posted a guide to setting up a LEPP server (Linux, Nginx, PHP and PostgreSQL) on a CentOS 7 instance (not specific to their own platform either, can be applied anywhere).

In this tutorial, we will create a simple web application in a two-tier architecture. Our base operating system for both nodes will be CentOS 7. The site will be powered by an Nginx web server running PHP code that talks to a PostgreSQL database. Instead of adopting a "top-down" approach seen in other LAMP or LEMP tutorials, we will use a "ground-up" approach: we will create a database tier first, then the web server and then see how the web server can connect to the database. We will call this configuration a LEPP (Linux, Nginx, PHP, PostgreSQL) stack.

They create a two-tier setup that involves the use of two CentOS systems (with examples from their own hosting options) and walk you through:

  • Installing PostgreSQL
  • Configuring PostgreSQL
  • Updating the Database Server Firewall
  • Creating and Populating the Database
  • Installing Nginx
  • Updating the Web Server Firewall
  • Configuring Nginx
  • Installing PHP
  • Configuring PHP
  • Creating the Web Application

It seems like a lot of steps but all of the necessary commands and configuration updates are included in each step so it's basically a copy and paste kind of walk-through.

0 comments voice your opinion now!
tutorial centos leep linux nginx php postgresql walkthrough

Link: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-two-node-lepp-stack-on-centos-7

DZone.com:
Get a Handle on PHP Handlers
March 25, 2015 @ 10:25:47

On DZone.com today there's a post covering the different kinds of handlers that can execute PHP - those pieces of code that work with the web servers we use every day to interpret and execute PHP code.

PHP Handlers? mod_php? FPM? How do we make sense of the inner workings of PHP outside of our lines of code? We know we can run PHP on the server to build web applications swiftly, but how can we optimize our environment and configurations to reach maximum scale? We know that PHP has its drawbacks for not being asynchronous or event-driven, which is all the more reason to ensure maximum optimization. The impact of your server environment on your PHP application performance can be more than you think you can afford. A careful examination of your PHP ecosystem will help you avoid suffering performance loss in areas you can otherwise solve for easily.

They provide a brief summary of what PHP handers, well, handle and where they fit in the overall architecture of execution. They then get into the details on some of them:

  • CGI - mod_cgi
  • suPHP - mod_suphp
  • DSO - mod_php
  • FastCGI - mod_fcgid
  • FPM (FastCGI Process Manager) - php-fpm

Included in each is an overview of how it works and some of the main advantages (and disadvantages) of their use. He also mentions two of the most popular web servers that work with these handlers: Apache and Nginx.

0 comments voice your opinion now!
handlers webserver execute modcgi modphp modsuphp modfcgi phpfpm

Link: http://php.dzone.com/articles/get-handle-php-handlers

Derick Rethans:
Xdebug 2.3 Improvements to Debugging
March 25, 2015 @ 09:13:34

In the latest in his series covering some of the improvements in the latest Xdebug release, Derick Rethans has posted this new article detailing some of the performance enhancements related to remote debugging that come with this new version.

This is the fourth article in a series about new features in Xdebug 2.3, which was first released on February 22nd. In this article we are looking at the improvements towards "remote" debugging.

The updates include showing the values of user-defined constants, being able to set an exception breakpoint on all exceptions and additional features around debugging the exceptions themselves. The output now includes the exception's error code and which exception the flow was broken on (though in his example of PHPStorm, the IDE won't report that information back). The last change he mentions is a change that reverts the output to a log if it can't write to a socket (usually SELinux related).

0 comments voice your opinion now!
xdebug performance improvement remote debugging version release

Link: http://derickrethans.nl/xdebug-2.3-debugging-improvements.html

Community News:
Recent posts from PHP Quickfix
March 25, 2015 @ 07:06:27

Recent posts from the PHP Quickfix site:
0 comments voice your opinion now!



NetTuts.com:
Programming With Yii2 Integrating User Registration
March 24, 2015 @ 12:27:16

NetTuts.com has posted the next part in their "Programming with Yii2" series today with this tutorial showing you how to integrate user registration into your sample application.

This is part four of a series on Yii2. In Programming With Yii2: Getting Started, we set up Yii2 locally, built a Hello World application, set up a remote server, and used Github to deploy our code. In part two, we learned about Yii's implementation of its Model View Controller architecture and how to build web pages and forms that collect and validate data. In part three, we learned about working with databases and ActiveRecord. In this tutorial, we'll walk you through integrating a popular user registration plugin.

They walk you through the use of the Yii2-User extension to provide the user handling functionality. The tutorial shows you how to get it installed (via Composer), run its database migrations to create the needed tables and where to update the configuration files to pull the plugin into the execution. They also help you set up SwiftMailer (what it uses to send its emails) and then gets into the integration of the registration with the application with a signup page.

0 comments voice your opinion now!
programming yii2 integration user registration yii2user extension tutorial

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-integrating-user-registration--cms-22974


Community Events

Don't see your event here?
Let us know!


unittest language security library podcast laravel5 php7 series extension version development framework opinion laravel release api interview voicesoftheelephpant introduction community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework