PHP programming tutorials

Pear Fix for “Error: Unable to Unpack”

Contributed by davak on February 12, 2009 under PHP programming

Recently while trying to install some Pear packages, I received an odd “Error: Unable to Unpack” message. A search for this error message found a lot of complaining people and not a lot of answers. I finally figured out the cause and the fix for this common Pear problem.

Comments
 

PHP: Upload Files to the Server

Contributed by William_Wilson on September 30, 2008 under PHP programming

With PHP, it is simple to upload any file to your server.

Comments
 

PHP: Print the current year for copyright notices

Contributed by qmchenry on March 8, 2008 under PHP programming

Hardcoding the year in a copyright notice is an easy way to get a blog or other website started, just placing the starting and ending years next to the copyright symbol. We have the very best of intentions to change this number right after the big ball drops in Times Square each year. We’re also human and, all too often, I see websites with copyright notices that are years behind. If your website is PHP-powered, this quick bit of code will put the current year in your copyright notice and off of your mind.

Comments
 

Make Wordpress Stop Replacing Double Dash with Em-dash

Contributed by johnnythawte on November 20, 2006 under PHP programming

Wordpress by default replaces the double dash (–) with an em-dash character. If you are showing code or programming examples this will cause your visitors unnecessary confusion. This recipe shows the simple way to turn that behavior off.

Comments
 

PHP: Delete or expire a browser cookie

Contributed by qmchenry on July 14, 2006 under PHP programming

Cookies may be created with an expiration time. It may become necessary to expire a cookie before the expiration time such as when a user logs out of a cookie-based authentication web application. This recipe describes expiring a cookie.

Comments
 

PHP: Read a browser cookie value

Contributed by qmchenry on under PHP programming

Once your web application has set a cookie in a user’s browser, it is a simple matter to retrieve that value in subsequent page requests. This recipe describes reading a value from a cookie in PHP.

Comments
 

PHP: Set or create a simple browser cookie with setcookie

Contributed by qmchenry on under PHP programming

Web applications overcome the lack of session support in the HTTP protocol primarily through the use of cookies. Transparent to the user and simple for the web developer, cookies provide the foundation of keeping up with who a web user is, where they’ve been, and what they had for lunch. Well, who and where, anyway.

Comments
 

PHP: Rename or move a file on the server

Contributed by qmchenry on July 10, 2006 under PHP programming

Working with server-side files with PHP adds a great deal of flexibility to some applications. A common scenario when working with files involves creating a temporary file through uploading or other means and then renaming this file to a permanent location. This recipe describes changing the name of an existing file using the PHP function rename().

Comments