Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories


Installing PEAR framework and packages

Ástþór IPÁstþór IP

PEAR is a framework and distribution system for reusable PHP components.

1. Install the PEAR framework

get install php-pear

2. Restart apache

/etc/init.d/apace2 restart

3. Install a PEAR package (optional)

pear install Net_Ping-2.4.5

You can install any PEAR package using this command but in this example we’ll install the Net_Ping package

4. Here’s a sample PHP code to use the Net_Ping package (optional)

require_once "Net/Ping.php";
$ping = Net_Ping::factory();
 
$host = 'debiantutorials.com';
$count = 3;
 
if (PEAR::isError($ping))
{
    echo $ping->getMessage();
}
else
{
    $ping->setArgs(array('count' => $count));
    $res = $ping->ping($host);
    foreach ($res->_raw_data as $line)
    {
        echo $line . "\n";
    }
}

This code will ping the host debiantutorials.com three times and echo the results

Comments 0
There are currently no comments.