News Feed
Jobs Feed
Sections




News Archive
feed this:

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

PHPMaster.com:
Saving PHP Sessions in Redis
July 09, 2013 @ 10:53:01

On PHPMaster.com today there's a new tutorial showing you how to store your application's sessions in Redis, a key/value store known for its flexible nature and speed.

PHP's default handling of session data is probably sufficient for most applications, but sometimes a project will demand a different storage approach. Luckily, the session handling routines can be overridden either by a series of functions (in older versions of PHP) or a class with methods (in newer versions) which handle various aspects of session management. In this article we'll learn how to create a custom session handler which implements PHP's SessionHandlerInterface interface and stores the session data in a Redis database.

He talks some about the reasoning behind using something more than just the normal PHP session handling (including the flexibility it provides). He covers some of the basics of the session handling functionality and covers how the data itself is stored. Finally, he gets to the actual class - a Redis-specific handler that implements the SessionHandlerInterface interface.

0 comments voice your opinion now!
tutorial redis session storage save introduction

Link: http://phpmaster.com/saving-php-sessions-in-redis/

Zurab Davitiani:
PHP Sessions in Erlang Mnesia
July 02, 2013 @ 11:31:43

In a new post to his site Zurab Davitiani shows you how to use a PHP-to-Erlang bridge to store your sessions in Mnesia. Mnesia is a distributed, soft real-time database management system written in the Erlang programming language.

I decided one of the simplest things to do would be to create a session storage for PHP in Mnesia. But that, in doing so, I would also create an extremely simple key value store wrapper around Mnesia which would track access times.

The instructions help you get the needed software set up including mypeb, kvstore and lib360. He lists all the steps needed to get the platform up and running, complete with exact commands to execute. He does point out a few things that are missing from the setup including making kvstore easier to work with and some PHP session garbage collection.

0 comments voice your opinion now!
erlang mnesia session tutorial storage database

Link: http://unix0.wordpress.com/2013/06/22/php-sessions-in-erlang-mnesia

Sameer Borate:
Storing images into a database - resolving a contentious matter
February 21, 2013 @ 11:16:45

In this new post to his CodeDiesel site Sameer Borate looks at something that's been a controversial topic with developers (not just PHP) about storing binary data, like images, in a database instead of on the local file system.

There is much discussion and argument with no final say on the issue. In one of my recent project the same issue was raised; the client and myself discussing the benefits and drawback of storing the images into a database. The project needed storing around 50,000 images, so it was important to get the question resolved satisfactorily. After much deliberation we settled on using the file system. The major factor in the decision was that we needed the database and images decoupled as we would be having multiple databases using the same set of images.

He goes on to talk about some of the things you should consider when you're deciding if storing images in the database is the right thing for your application including:

  • The bloat that can come with storing binary data (larger database size)
  • Updating images requires two operations - updating the database and updating the cached image locally
  • Images usually serve faster when they come from the filesystem through the web server
  • BLOB (a common type for binary data storage) is variable-width and can degrade performance

You can read the rest of the reasons (and get more detail on the ones above) in the rest of the post.

0 comments voice your opinion now!
images binary data storage database benefits disadvantages


Patrick van Kouteren:
CloudVPS object store beta introduction
August 28, 2012 @ 12:52:35

Patrick van Kouteren has a new tutorial posted to his site showing you how to connect your application with an OpenStack instance (specifically the CloudVPS option) via some simple CURL commands (easily translatable into PHP).

Lately I've been playing around with the CloudVPS ObjectStore, which is currently in beta phase. This blogpost shows the options of this ObjectStore in a practical way and concludes with a summary of commands you can use yourself to interact with it and some ideas. For this post, I assume you are familiar with cURL, REST and HTTP headers.

He shows how to make the requests for:

  • Authentication
  • Working with containers
  • Adding files to a container
  • Setting access permissions
0 comments voice your opinion now!
object storage curl tutorial container file authentication


Michael Nitschinger's Blog:
Using Couchbase as a flexible session store
June 21, 2012 @ 09:24:38

Michael Nitschinger has a new post to his site today showing how to implement Couchbase as a storage mechanism for your session information (including some handy extra features).

What do I mean by flexible? Well, the combination of a highly scalable key-value store and the possibility to query your data through views allows you to gain unique insight inside your data in near realtime. [...] Let's look at some obstacles that we as application developers face and then see how we may solve them through Couchbase and its functionality.

He talks about some of the options to track user sessions (both on the server and client side) including PHP's sessions, HTML5 data storage and memcache. He covers some of the most basic session tracking needs and shows how to use the CouchBase extension to work with and setting some key/value combinations for user sessions. He shows how to query these data structures (JSON data) and filter to find only the records needed

0 comments voice your opinion now!
couchbase tutorial session storage


IBM developerWorks:
Store datasets directly in shared memory with PHP
January 20, 2012 @ 11:29:24

On the IBM developerWorks site today there's a new tutorial showing you how to store shared data directly to a shared memory space of your PHP application.

Once created, and given proper permissions, other processes in the same machine can manipulate those segments by: read, write, and delete. This means that an application written in C can share information with an application written in other languages, such as Java or PHP. They can all share information, as long as they can access and understand that information. [...] This article's proposal is simple, learn how to create and manipulate shared memory segments with PHP and use them to store datasets that other applications can use.

Your PHP installation will need to have been compiled with "enable-shmop" to work with the code in this tutorial. Their examples show how to use the shmop_open, shmop_write and other related functions to read, write, remove and close segments in the shared memory space. They also include an example of using the SimpleSHM library to make it easier to interact with the shared memory space as a standard storage location.

0 comments voice your opinion now!
shared memory shmop dataset simpleshm storage


Johannes Schlüter's Blog:
High Performance PHP Session Storage on Scale
November 18, 2011 @ 10:13:25

In this new post to his blog, Johannes Schlüter looks at a high-performance solution to the usual storing PHP session information via a memcache frontend with a MySQL Cluster backend.

Unfortunately even such a system [using MySQL and InnoDB tables] has limits and unfortunately replication is no good solution here to scale further as we will always need a master for writing the updated session data. By using replication we can take some load from it and we can configure a slave which can be promoted to master to keep session alive if the primary master machine fails but at some point in time we need another solution ... but, happy news, again: One doesn't have to look far as MySQL cluster will be happy to help. MySQL Cluster "is a high-availability, high-redundancy version of MySQL adapted for the distributed computing environment," as the MySQL documentation states.

He describes the setup (after pointing to this post about installing MySQL Cluster for memcache) and includes some sample code/SQL/ini settings you'll need to use to get PHP's memcached functionality to cooperate with it.

0 comments voice your opinion now!
performance session storage mysql cluster memcache frontend backend


Andrew Martin's Blog:
Serving PHP session files from a RAM based disk (tmpfs) for AWS Micro Instance
October 06, 2011 @ 11:42:36

Andrew Martin has a new post to his blog looking at a technique that could be used to help minimize some of the performance issues you could see on AWS micro instances dealing with PHP session handling. His alternative is serving them from a RAM-based disk instead.

It's rare to find a web server with slow disk I/O performance, but Amazon's EC2 micro-instances are one such example. Their EBS disk subsystem access is rated "low", and this can have a detrimental effect on HTTP throughput. [...] This leaves sessions, which can be written to a redundant and fault tolerant storage system. [...] In order to speed up the disk access, a RAM-based disk can be mounted over the session directory. This has the disadvantage of being volatile - the data is lost in case of a server reboot, or the mount point being unmounted. However if tolerable, storing sessions in RAM insulates the application from poor filesystem performance.

He mentions the two types of kernels that can be used, ramfs and tmpfs, and the specifics of using a tmpfs filesystem to implement the technique (complete with command line calls to make it happen).

0 comments voice your opinion now!
session files ram disk tmpfs storage performance


Project:
Google Storage Plugin for CakePHP
July 14, 2011 @ 11:03:21

Jonathan Bradley has submitted a handy new helper for the CakePHP users out there that can help to work with Google's Storage in a drop-in plugin - the Simple Google Storage Plugin for CakePHP.

Ever noticed how there is no decent support for CakePHP to utilize Google Storage? Well the wait is over, after realizing that Amazon S3 was just way to unreliable and bloated with spammers and usuage hogs. You can now add Google Storage support to your CakePHP application.

Obviously you'll need to be set up with Google Storage before using it, but the tool makes it as simple as calling publish() to push the data out, return all of the bucket information for your account and pull out information about individual objects. There's also a method that lets you make new buckets on the fly to make categorization simpler.

The heart of the code lies in the Storage class, so if you want to see how it's done, check that first. Other frameworks have their own interfaces with the Google services too, like the Zend Framework's Zend_GData component.

1 comment voice your opinion now!
google storage cakephp plugin bucket file


Brian Swan's Blog:
How to Use the Storage Emulator with the Windows Azure SDK for PHP
April 20, 2011 @ 08:43:53

In a recent post to his blog Brian Swan shows you how to use the Storage Emulator for Azure with PHP via their provided SDK. It's a quick post but it has a helpful code snippet if you've been struggling with getting it set up.

This is a short post to address this question: How do I use the local Storage Emulator (formerly known as Development Storage) when using the Windows Azure SDK for PHP? The Windows Azure Command Line Tools for PHP provide an option for running an application locally in the Compute Emulator, but I didn't see an option for using the local Storage Emulator. As it turns out, the answer is very simple, although somewhat difficult to find.

The trick is to omit the constructor parameters when creating a new table/blob/client to get it to create things locally instead of on your Azure instance. He also includes a set of links that can help fill in some of the gaps in the whole Windows Azure deployment process.

0 comments voice your opinion now!
windows azure sdk storage emulator tutorial



Community Events











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


framework install example composer package code hack unittest opinion symfony2 application hhvm facebook security introduction component release language overview podcast

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