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

Sameer Borate's Blog:
Read the version of a PDF in PHP
July 22, 2011 @ 09:54:18

Sameer Borate has a quick post to his blog today with some code that lets you read the version of a PDF document programmatically without a dependency on a PDF extension or library being installed.

The following [example] is a very short code to read the version number of a PDF document using PHP. I needed this recently during a PDF processing app developed in PHP. As Adobe uses different compression methods in various versions, it becomes necessary to be able to identify the version of the PDF under work.

The code opens the file with a fopen and parses a certain line for the major and minor version. The PDF extension for PHP can do something similar with the pdf_get_value function passing in either "major" or "minor" as the second parameter.

0 comments voice your opinion now!
tutorial read version pdf file extension fopen


Total PHP:
Deleting files with PHP
August 06, 2008 @ 11:19:48

The Total PHP site has another introductory tutorial posted showing you how to correctly delete files in your PHP scripts.

Following our tutorials on uploading files and listing files, this tutorial will walk you through deleting files from a directory. This is done using the unlink() function.

Their example is pretty simple (as is the concept) - they show how to check to be sure that the file you want to remove isn't in use/open and then issue the unlink to remove it from the file system.

0 comments voice your opinion now!
delete file upload list tutorial fopen unlink


Elizabeth Smith's Blog:
Php User Streams - why doesn't anyone use them?
May 07, 2007 @ 08:04:00

In a new post today, Elizabeth Smith takes a look at one of the lesser used (well, overall) features that PHP has to offer these days - PHP user streams.

PHP user streams are amazing - they're powerful, fun, and make things like a templating system with filters and multiple back ends quick and easy.

Here's a little "test script" that shows you how to implement contexts for your streams. What are contexts? They're resources that hold additional information. Built in php streams, such as the ftp streams, already have contexts you can set. But they're also great to use in your own user land streams.

In the test script, she shows how to open a stream to a few different resources (including passing parameters and user information), grabbing the contents of each.

1 comment voice your opinion now!
user stream example path fopen user stream example path fopen



Pierre-Alain Joye's Blog:
Windows fixes release for Zip, fopen(,"rb") may not be binary safe
November 28, 2006 @ 07:13:09

A new release of the Zip PECL package has been made according to this post on Pierre-Alain Joye's blog today. The main update in this release is to counteract a Windows bug that's interfering with binary file opens.

The issue is actually a windows bug. No matter if I give or not the "b" flag to fopen, the write operations are not binary safe. It seems to be a known issue as many projects use the same trick.

The problem comes up when PHP forces the binary mode in SAPI and CLI, making the binary writes to a file non-binary safe no matter what. Pierre is also asking for help from anyone out there with any information/bug reports/references about this issue that would yield something useful.

0 comments voice your opinion now!
fopen binary safe windows force mode bug sapi cli fopen binary safe windows force mode bug sapi cli


ThinkPHP Blog:
Handling large files with(out) PHP
August 02, 2006 @ 05:47:06

On the ThinkPHP blog today, there's a quick hint about dealing with larger files both with and whithout PHP.

As one man was quoted "640K of memory should be enough for anybody" no one will need to access more than 2 GB data. What happens if you - just for scientific reasons of course - try to access larger files using your 32bit hardware and your favorite programming language PHP?

They give the example of opening a large 2 gig file with PHP and the resulting error that would pop up. They try a few differnt ways before getting down to more of a non-PHP PHP solution (yes, you read that right). They decided, instead, to create a script to work with the file chunked, using an exec() call to the unix split command to break it up.

0 comments voice your opinion now!
file handling large fopen error split chunk exec file handling large fopen error split chunk exec



Community Events





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


language refactor install testing list configure symfony2 opinion developer interview unittest framework community podcast series code release laravel introduction threedevsandamaybe

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