News Feed
Sections




News Archive
feed this:

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

NetTuts.com:
Build Web Apps From Scratch With Laravel Filters, Validations, and Files
August 01, 2012 @ 13:55:10

NetTuts.com has posted the latest in their series about the Laravel framework with this new post, a look at creating filters, validators and working with files.

In this Nettuts+ mini-series, we'll build a web application from scratch, while diving into a great new PHP framework that's rapidly picking up steam, called Laravel. In this lesson, we'll be learning about some very useful Laravel features: filters, and both the validation and files libraries.

They continue improving their sample application ("Instapics") and show you how to:

  • Create a filter to run before or after the request is handled
  • Apply a set of validation rules to a given dataset
  • Handle custom error messaging
  • Work with local files and uploads

They then take all of this and apply it to their application, creating an "auth" filter and login form, creating a form and doing some validation on its results and letting the user upload an image file.

0 comments voice your opinion now!
laravel framework tutorial filter validation files


Joshua Thijssen's Blog:
Using augeas (in PHP)
June 04, 2012 @ 08:17:56

In this new post to his blog, Joshua Thijssen looks at using the Augeas tool in a PHP application. Augeas is a configuration editing tool, making it easy to parse many different types of configs and transform them into a tree structure.

Even though I really like using sed and awk, sometimes its hard to change or add parameters in configuration files. Big sed statements that may or may not work, double checking if everything has been done correctly etc. Augeas is a really cool tool that lets you view / add / modify and delete all kind of data from configuration files. If you are using Puppet, you are probably aware of this tool, but I notice that a lot of PHP developers have never heard of it.. Let's explore..

He shows an example of a configuration file and how the "augtool" command line script can be used to modify one of them. He then shows how to use the tool's library to set the server's "date.timezone" setting in the php.ini.

0 comments voice your opinion now!
augeas commandline library configuration files


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


Juozas Kaziukenas's Blog:
Using Phing to sync files with shared hosting
March 02, 2009 @ 13:41:12

Juozas Kaziukenas has a new post to his blog today looking at using Phing to keep files in sync on a shared hosting, FTP only kind of environment.

Today I was trying to use [Phing] in shared hosting server, but as you will see, Phing can't do a lot of it's functionality without direct access to server (over shh for example). [...] Things get worse, when you try to sync files in shared hosting environment, where only FTP is available. [...] Code in the hole some months ago posted solution which uses Net_FTP (FTP functionality wrapper) package to upload files to server. I decided to try given solution, so I modified it to download source code from SVN first and then upload them.

His Phing configuration sets up the application, defining the source directory, the files to push, the FTP connection to make and pushes the files over out of an svn export. He has a slightly different solution (no code/config for this one) that would grab the last revision value from the remote server and only push out the files have have changed since then.

2 comments voice your opinion now!
phing sync files shared hosting ftp subversion svn source configuration


SitePoint PHP Blog:
On $_GET and $_POST
February 05, 2009 @ 11:14:33

On the SitePoint PHP Blog today Troels Knak-Nielsen takes a deeper look at two of the superglobals a lot of PHP developers take for granted - $_GET and $_POST.

When a PHP script is invoked by a web server, it is as the result of a HTTP request. A HTTP request has a target URI and that URI consists of different parts. One of these parts is the query. As the PHP process starts up, the query gets parsed into an associative array. And for some reason, somebody decided on the unfortunate $_GET, because it's what you use for GET requests - right? Wrong!

He points out that all HTTP requests, regardless if they're GET or POST will have that GET information (not necessarily in $_GET, though). He also mentions another commonly used (and sometimes abused) superglobal - $_FILES. His biggest gripe, though, is that the naming of the variables confuses the developer as to the true content of the HTTP request.

And I won't even comment on the nastiness of $_REQUEST.
6 comments voice your opinion now!
get files request superglobal http request content confuse


PHPBuilder.com:
How to Upload Images Using PHP
February 02, 2009 @ 10:23:00

The PHPBuilder.com site has a quick new tutorial showing how to upload images to your server via a PHP script (including some error checking).

One of the most frequently asked questions about PHP is "how can I use PHP to upload an image". In this article we'll discuss the details of how you can do just that!

Their script is done in three steps - an HTML form to accept the input, the PHP script to handle the upload (working with the $_FILES superglobal) and another HTML page to let the user know their upload was a success. When the file is uploaded, they check for a few things: the internal error PHP could throw, ensuring that the uploaded file exists and checking to ensure that the file is an image. Only then is it moved over to the true uploads directory to be stored.

0 comments voice your opinion now!
upload image example tutorial superglobal files


Tiffany Brown's Blog:
Simple pagination for arrays with PHP 5
December 15, 2008 @ 08:48:20

Tiffany Brown has a quick tutorial on a pagination method she's come up with for splitting out array contents over multiple pages.

While working on a recent project, I had to build a feature that displayed a list of files available in a directory. A simple way is just to use scandir() and a foreach loop to spit out a pretty list. There's a small problem though: long lists aren't all that user friendly. I decided instead to paginate the results. Here's one way to do it using PHP 5.

Her method reads in all of the (valid) files from the directory, assigns them to an array and uses the array_chunk function to split them up into groups on five. These groups can be easily looped through and displayed out as links easily.

0 comments voice your opinion now!
pagination php5 arraychunk directory files


DevShed:
Building File Uploaders with PHP 5
March 20, 2008 @ 11:18:11

On DevShed today there's a new tutorial showing how to build file upload functionality into your scripts.

If you're a PHP developer who has built a certain number of web applications, then it's quite probable that you've already worked with HTTP file uploads. [...] First I'm going to teach you how to handle file uploads using a procedural approach, and then, with the topic well underway, by way of the object-oriented paradigm.

The introduce the beginners out there to the $_FILES array (a superglobal) that contains the details about the file(s) that have been submitted. Next comes the construction of a simple form and how to handle the submission on the PHP side.

0 comments voice your opinion now!
file upload php5 tutorial beginner files superglobal form


Zend Developer Zone:
PHP Security Tip #15 (Remove Temporary Files)
March 23, 2007 @ 09:20:00

The Zend Developer Zone has posted security tip #15 today, focusing on an easily forgotten aspect of web development (not just in PHP) - forgetting to remove temporary files.

As developers, most of us are very messy. I've worked on countless projects and at each either run across or left a trail of diagnostic files laying around. (info.php, test.php, doMe.php, etc.) These tiles, if found by someone with nefarious intent, can leak valuable information about your system.

Always remember to remove these types of files...as Cal puts it:

It would be a shame to spend all that time securing your application only to leave info.php or worse yet, a "quick piece of code" in test.php that could potentially leak dangerous information about your system. Don't help the ad guys any more than you have to.
0 comments voice your opinion now!
temporary files remove securitytip diagnostic temporary files remove securitytip diagnostic


DevShed:
Reading, Writing and Creating Files in PHP
August 23, 2006 @ 08:59:30

DevShed has a new tutorial posted today with a look at one of the more common tasks performed with PHP (second to generating web pages, of course) - working with files. It can be a little tricky for a budding PHP programmer, but they've got the info you need to get started.

Reading and writing to files can be useful if you do not require the storing of important data, such as a web counter. I must warn you though, that this method of storage should not be used to store passwords and other critical information, as it is not safe. Here we will discuss how to handle files and directories in PHP, specifically, how to create, read and write them.

They start off with a look at file permissions on both Unix and Windows systems ot give you an idea of what problems they could cause. Then, it's on to the actual files themselves - for this part, though, they only look at reading them in and working with their contents.

0 comments voice your opinion now!
tutorial reading writing creating files part1 permissions tutorial reading writing creating files part1 permissions



Community Events





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


symfony language mvc library opinion version podcast update framework series community composer laravel introduction voicesoftheelephpant tool package security interview release

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