Feed aggregator

A new blog!

Planet-PHP - Mon, 29/04/2013 - 22:53

I just launched a new version of my blog, and you're looking at it :). I've went through a number of platforms, most recently habari, which I still have a lot of love for.

But my installation was going rapidly out of date, was becoming very slow due to using Sqlite as a backend, and most of all, I wanted to use GitHub to store my posts so everyone can make edits.

So I settled on using Jekyll, hosted on GitHub pages. Biggest drawback: it's all 100% static, so I had to use Disqus to enable comments. Don't really like the idea of someone else owning my precious, precious data, but alas… I'm in the 'cloud services business' myself, and you gotta practice what you preach.

The first responses have been an overwhelming "weren't you able to find a better template anywhere?". I'm obviously not much a visual artist myself, so I had no problem with the concept. But it's hard to find solid minimalistic designs, and I really wanted a strong focus on actual content, and a great mobile experience, so I've had some trouble finding things that matched those objectives.

Regardless, I'm quite happy with the look of embedded code, I mean… I think this looks pretty sweet:

<?php

include __DIR__ . '/vendor/autoload.php';

use Sabre\XML;

$reader = new XML\Reader();
$reader->open('atom.xml');

$output = $reader->parse();
var_dump($output);

If you recognize the color scheme, indeed.. It's the old vim 'desert' scheme ported to css.

I also ditched the old domainname (rooftopsolutions.nl). I started 'Rooftop Solutions' when I was a 17-year old kid, over 10 years ago. This has been my moniker ever since, but recently I officially 'shut down' this business when I moved from Münster, Germany to London.

Figured I might as well start fresh and use my real name.

While we're on the topic of London. If you're reading this and happen to also live in London. If you're up for some armchair philosophy or programming discussions over a pint, I'm still pretty new here and in the market for friends, so drop me a line!

To conclude: I hope a new system will encourage me to do a better job at blogging. I've been pretty shit last year, and this is my first post of 2013.

I'm actually not sure how relevant blogs still are in 2013. There's definitely been a steep decline, but I enjoy the medium as a consumer and I reckon 10 years down the road older blog posts may still hold some relevancy, unlike compressed twitter discussions with little context.

Anyway, if you're reading this, thanks for sticking with me. If you have any criticisms or suggestions, I'd love to hear it!

Catégories: Open Source, PHP Community

NetTuts.com: HTTP: The Protocol Every Web Developer Must Know - Part 2

PHPDeveloper.org - Mon, 29/04/2013 - 22:07

NetTus.com has followed up their previous article covering some of the basics of the HTTP protocol with this new post, part 2 of the series. They suggest that HTTP, the messaging format of the web, is the one protocol that every web developer should know.

In my previous article, we covered some of HTTP's basics, such as the URL scheme, status codes and request/response headers. With that as our foundation, we will look at the finer aspects of HTTP, like connection handling, authentication and HTTP caching. These topics are fairly extensive, but we'll cover the most important bits.

In this article, they talk about things like the HTTPS secure version of HTTP, server-side connection handling, identification/authorization and working with caching and cache control headers.

Link: http://net.tutsplus.com/tutorials/tools-and-tips/http-the-protocol-every-web-developer-must-know-part-2

Elijah Horton: Sandboxing Untrusted Code With PHPSandbox

PHPDeveloper.org - Mon, 29/04/2013 - 18:56

Elijah Horton has a recent post to his site sharing a tool he's developed to sandbox and validate PHP code of user-contributed code.

Few quotes related to the PHP language are as pithy and resoundingly accurate as the phrase: "Eval is evil." The reasons are myriad: the eval() function basically gives whatever code is passed to it unlimited control of the parser, and this freedom makes eval() both a temptation for developers, who may need to dynamically control PHP at runtime, and a panacea for hackers who are ever-searching for more servers to add to their botnets. So, how does one make use of the extreme power available through runtime evaulation of PHP, without exposing one's server to near-certain rooting? Through a sandbox.

His tool - PHPSandbox, uses the PHP-Parser library to deconstruct the PHP code its given and look for issues. He gives an example of a call to mail and how it would catch the issue. He shows how to install it via Composer, how to configure it with whitelisted methods/functions. It also includes a way to overwrite function calls with a bit safer alternative.

Link: http://www.fieryprophet.com/blog/detail/sandboxing-untrusted-code-with-phpsandbox

Reddit.com: How to progress my PHP skills?

PHPDeveloper.org - Mon, 29/04/2013 - 17:22

On Reddit.com a reader has asked the community what they think he needs to do to progress his PHP skills past the "little bit" he's learned so far.

Last summer I started learning a little bit of PHP, knowing HTML and CSS drove me towards wanting to learn some PHP for fun. I went through a pretty simple book, and made some simple websites (registration and message system, user submitted data, file uploads) using mostly tutorials which I tweaked a little bit. Since last summer I haven't learned anything new, but now that summer is coming along again I might be a bit bored, so I have been thinking of attempting to learn even more.

Suggestions included in the comments are things like:

  • Learn about software architecture.
  • Understand your environment.
  • I very highly suggest learning a PHP framework.
  • http://www.phptherightway.com
  • Start learning industry tools for PHP. It will all influence your coding style, and illustrate why some styles are considered best practices.
  • To add to the other suggestions, I recommend becoming a regular contributor to one or more open source projects.
  • What helped me a lot was to write my own micro framework using OOP that I can now use for future websites and web applications.
  • Come up with a 'complex' web site/application idea and get to it. Bonus points if you can launch it and make money off it (half kidding).

You can read the full set of comments for more good suggestions here.

Link: http://www.reddit.com/r/PHP/comments/1d32dr/how_to_progress_my_php_skills

7PHP.com: Interview with Jakub Vrana - Co-Author Of The Official PHP Manual

PHPDeveloper.org - Mon, 29/04/2013 - 16:09

7PHP.com has another community interview posted today - this time it's with Jakub Vrana, a co-author that works on the official PHP manual.

In this edition I talked with Jakub Vrana who is a co-author of The Official PHP Manual. @jakubvrana is also the creator of the two successful projects namely Adminer and NotORM. I invite you to know him better and to learn from his 7php PHP interview.

The interview shares Jakub's answers about things like:

  • His history as a PHP developer
  • What he sees as good and bad parts of it
  • His preferred tools
  • His choices on frameworks and ORMs
  • How to get started contributing to the documentation/manual
  • Some about his book "1001 tips and tricks for PHP"
Link: http://7php.com/php-interview-jakub-vrana

Top Version Control Systems used by PHP Developers

Planet-PHP - Mon, 29/04/2013 - 15:17
By Manuel Lemos
Version Control Systems are important tools that every developer should be using. However, for many developers version control systems do not make part of their development tool set.

Read this article to learn what are version control systems, why they are so important to be used by all developers, and what are the most popular systems used by PHP developers.
Catégories: Open Source, PHP Community

Community News: Packagist Latest Releases for 04.29.2013

PHPDeveloper.org - Mon, 29/04/2013 - 15:03
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 04.28.2013

PHPDeveloper.org - Sun, 28/04/2013 - 15:01
Recent releases from the Packagist:

PHP: Redirection limit reached

Planet-PHP - Sat, 27/04/2013 - 21:36

PHP may give you the following error:

PHP Warning: file_get_contents(http://example.org/):
 failed to open stream: Redirection limit reached, aborting

This means that the URL you are accessing is telling you via a HTTP Location: header, that the data you want can be found on a different URL. This different URL tells you that the data you want can be found on another different URL. This another different URL ...

The game continues, 20 times. Then, PHP decides to stop following redirects and gives you the error.

The HTTP headers that make your client follow the Location header can are:

More redirections

If you want more than the default 20 redirects allowed by PHP, you can modify the HTTP stream context by setting the max_redirects option:

<?php
$context = stream_context_create(
    array(
        'http' => array(
            'max_redirects' => 101
        )
    )
);
$content = file_get_contents('http://example.org/', false, $context);
?>
No redirection

You may also choose to not follow any redirects by setting follow_location :

<?php
$context = stream_context_create(
    array(
        'http' => array(
            'follow_location' => false
        )
    )
);
$content = file_get_contents('http://example.org/', false, $context);
?>

In this case, you will get the content of the page that causes the redirect.

Catégories: Open Source, PHP Community

PHP: Unable to find the wrapper "https"

Planet-PHP - Sat, 27/04/2013 - 21:08

PHP may tell you the following:

PHP Warning: file_get_contents():
Unable to find the wrapper "https" - did you forget
to enable it when you configured PHP?

This means that PHP is not able to do secure HTTP requests. Reason for this is that it has no SSL library to use.

Unix

Recompile PHP with the --with-openssl flag.

Windows

Edit your php.ini file and add the following line:

extension=php_openssl.dll

Catégories: Open Source, PHP Community

Community News: Packagist Latest Releases for 04.27.2013

PHPDeveloper.org - Sat, 27/04/2013 - 15:09
Recent releases from the Packagist:

PHPMaster.com: Better Understanding Random

PHPDeveloper.org - Fri, 26/04/2013 - 18:52

On PHPMaster.com there's a new tutorial talking about randomness in PHP, what it is and some of the things it can be used for.

Use of random values is very important in the computer security field. It is crucial in computer programming for development of secure systems that are not vulnerable to malicious subversion. Cryptography relies on random value's generation and their reproducibility for unpredictable output that is core for security of any system. Random values are fundamental for secure coding practices and PHP highly makes use of them for security. You will find them used in all libraries and frameworks and almost all codes rely on them for the generation of tokens, salts and as inputs for further functions.

He talks about the important of good random numbers and some of the common uses for it including generating salts and unique identifiers. He mentions the "pseudorandomness" of PHP's generators and how they're seeded to help increase this randomness. He finishes up the tutorial with some suggestions and language features for creating "as random as possible" values like using "/dev/urandom" on Linux-based systems.

Link: http://phpmaster.com/better-understanding-random

/Dev/Hell Podcast: Episode 31: Feline Tooth Extraction

PHPDeveloper.org - Fri, 26/04/2013 - 17:22

The /Dev/Hell podcast has posted their latest episode - Episode #31 - Feline Tooth Extraction. The podcast is hosted by PHP community members Chris Hartjes and Ed Finkler.

Short notes time: In this episode, Chris and Ed talk about conferences we always wanted to go to, and languages & tools we'd thought we'd hate and turned out to like. Then Ed waxes on the Open Recipes project.

You can listen to this latest episode either through the in-page player or by downloading the mp3. Links to all of the technologies and tools they mention are in the show's notes on the page.

Link: http://devhell.info/post/2013-04-24/feline-tooth-extraction

Software Gunslinger: PHP is meant to die, continued

PHPDeveloper.org - Fri, 26/04/2013 - 16:15

In his previous post ("PHP was meant to die") the point was made that PHP isn't really designed as a language to handle long running processes very well. It's made to handle a few operations and then die at the end of the request. In this follow up post he talks more about using PHP for long running processes and a library that could help.

Yes, I already acknowledged that PHP has a garbage collection implementation starting 5.3.0 and up (opt-in or opt-out, that's not the problem). I also acknowledge that garbage collection works, and is able to take care of most circular references just fine. [...] Anyway, as previously stated too, garbage collection is a great thing, but not enough for PHP. It's a borrowed feature that does not play well with old fundamental decisions inherited from the original design. Garbage collection is not a magical solution for every problem, like many tried to argue about. Let's illustrate with another example.

His example uses the React PHP library (a non-blocking I/O platform) to handle a lot of incoming data to a port and report back some memory usage and limit settings. He explains a bit about what's happening and shares the results of the test, including the end result - a fatal error when the memory limit was hit. He still comes to the same conclusion, ultimately...PHP is just not the language to use for long-running processes that do any large amount of work.

Link: http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued

Community News: Packagist Latest Releases for 04.26.2013

PHPDeveloper.org - Fri, 26/04/2013 - 15:09
Recent releases from the Packagist:

Luis Atencio: Notes on Continuous Delivery - Implementing a Testing Strategy

PHPDeveloper.org - Thu, 25/04/2013 - 18:55

Luis Atencio has posted the latest article in his "Continuous Delivery" series today, this time with a focus on implementing a testing strategy. This is the fourth post in the series (part 1, part 2 and part 3).

There are three things in life that are always held to be true: we will die someday; we will pay taxes; and software will have bugs.... LOL [...] A testing strategy is often overlooked in software projects. This should not be too surprising, we want to build applications quickly and release them quickly. However, leaving quality out of the picture or towards the end are terrible mistakes.

He talks some about the different types of testing that revolve around software development - "business facing" and "technology facing." These are each split down even further into things like acceptance, integration and unit testing.

Link: http://www.luisatencio.net/2013/04/notes-on-continuous-delivery.html

Rob Allen: Simple logging of ZF2 exceptions

PHPDeveloper.org - Thu, 25/04/2013 - 17:31

In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.

I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.

He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.

Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions
Syndiquer le contenu