Category ‘PHP’ (page 1)

Reading multiple parameters in PHP

Friday, 02.10.2009.

Suppose you have to send four values: element Id, table, row and column compounded in one URL parameter. That is simple, parameters can be concatenated and delimited with special character. But how to send multiple of these complex URL parameters?

1 response so far

Week list for the current date in PHP

Thursday, 30.04.2009.

This post shows two examples of how to find the week list for the current date. Input parameter is date, and the output is date list from Monday till Sunday. First example is done with classic algorithm while second example uses ISO week date format.

7 responses so far

Backup Linux server with PHP

Monday, 30.03.2009.

You can find a lot of backup solutions for Linux server. From expensive and multi platform software like NetBackup to simple BASH scripts. As a Linux (LAMP) administrator, I decided to write my own backup script in PHP. I wanted to backup important locations like Web root, crontabs, /etc, /root and copy MySQL dump files.

No responses yet

Find files with PHP

Monday, 23.03.2009.

In PHP you can find files with function glob. The glob function searches for all the pathnames matching pattern according to the rules used by the libc glob function, which is similar to the rules used by common shells. It is nice, but it works for the current directory only. If you need function to search whole directory subtree, then it can be done with few line more.

1 response so far

Create thumbnail with PHP (2)

Saturday, 21.03.2009.

In this post you will find how to create thumbnail images with PHP. Function uses GD library so it doesn't depend on installed utilities like ImageMagick. On the other hand, you will have to install php-gd module - "yum install php-gd". Function will resize JPEG, PNG and GIF images, while PNG and GIF without losing their transparency.

3 responses so far

Create thumbnail with PHP (1)

Saturday, 21.03.2009.

PHP can be used to create and manipulate image files in a variety of different image formats. This post shows how to create thumbnail image in the same directory as the original image. Instead of GD library, I used utilities from ImageMagick suite of tools so your PHP shouldn't have a GD module installed.

No responses yet

Log PHP errors to the separate file

Tuesday, 10.03.2009.

In this post you will find how to configure PHP to log errors and warnings to the separate log file - error_php. You can place error_php wherever you want, but I will suggest to choose the /tmp directory ...

No responses yet