Archive for February, 2010

SBDavid

Shared Memory Pages

Shared Memory Pages

To facilitate data sharing, you can create shared memory pages. Multiple processes can read and write to and from a common shared memory area. The kernel maintains and administers the shared memory areas and allows individual processes access to the shared area.

The special ipcs command allows you to view the current shared memory pages on the system. Here’s the output from a sample ipcs command.

root@dell:~# ipcs -u

—— Shared Memory Status ——–
segments allocated 6
pages allocated 576
pages resident 528
pages swapped 0
Swap performance: 0 attempts 0 successes

—— Semaphore Status ——–
used arrays = 0
allocated semaphores = 0

—— Messages: Status ——–
allocated queues = 0
used headers = 0
used space = 0 bytes

Each shared memory segment has an owner that created the segment. Each segment also has a standard Linux permissions setting that sets the availability of the segment for other users. The key value is used to allow other users to gain access to the shared memory segment.

-m shared memory segments

root@dell:~# ipcs -m

—— Shared Memory Segments ——–
key shmid owner perms bytes nattch status
0×00000000 327680 buddy 600 393216 2 dest
0×00000000 360449 buddy 600 393216 2 dest
0×00000000 262146 buddy 600 393216 2 dest
0×00000000 294915 buddy 600 393216 2 dest
0×00000000 393220 buddy 600 393216 2 dest
0×00000000 425989 buddy 600 393216 2 dest

SBDavid

Resizing Ext3

Resizing Ext3

An ext3 filesystem can supposedly be expanded with resize2fs while mounted, but standalone would be safer.

A few ways you can do it:

resize2fs
parted
Partition Magic 7.x

In all cases, first convert ext3 –> ext2: [Note: resize2fs works with ext3.]

tune2fs -O ^has_journal /dev/hdax
e2fsck -v -f /dev/hdax

Resize the partitions with tool of choice.

Convert back to ext3

tune2fs -j /dev/hdax
e2fsck -v -f /dev/hdax

-j Add an ext3 journal to the filesystem.

Installing the PEAR package manager and Checking if PEAR works

When using PHP >= 4.3.0, the PEAR Package Manager is already installed unless one has used the ./configure option –without-pear.

Verifying command line tool

Both pear and pecl tools should be available everywhere on command line. For that to work, pear’s binary (bin) directory should be in your PATH variable.

# apt-cache search php-pear
php-xml-util – a XML utility for php-pear
php-pear – PEAR – PHP Extension and Application Repository

To verify it works, simply type pear. A list of commands should be shown:

root@laptop:~# pear
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel

You should further test that PEAR is up to date:

root@laptop:~# pear version
PEAR Version: 1.7.1
PHP Version: 5.2.6-3ubuntu4.5
Zend Engine Version: 2.2.0

Options for downloading PECL extensions

There are several options for downloading PECL extensions, such as:

The pecl install extname command downloads the extensions code automatically, so in this case there is no need for a separate download.

http://pecl.php.net/ The PECL web site contains information about the different extensions that are offered by the PHP Development Team. The information available here includes: ChangeLog, release notes, requirements and other similar details.

pecl download extname PECL extensions that have releases listed on the PECL web site are available for download and installation using the » pecl command. Specific revisions may also be specified.

SVN Most PECL extensions also reside in SVN. A web-based view may be seen at » http://svn.php.net/viewvc/pecl/. To download straight from SVN, the following sequence of commands may be used:

$ svn checkout http://svn.php.net/repository/pecl/extname/trunk extname

SBDavid

PECL upload progress extension

PECL upload progress extension

Summary An extension to track progress of a file upload.

Download from – http://pecl.php.net/package/uploadprogress

http://pecl.php.net/get/uploadprogress-1.0.1.tgz

Extract the uploadprogress-1.0.1.tgz archive

$ phpize
$ ./configure
$ make
$ sudo make install

Add the extension to php.ini by adding this line extension=uploadprogress.so

Restart apache

/etc/init.d/httpd restart

« Prev - Next »