Installing PEAR for PHP

pearsmall

Installation

For Windows:

  • To update your PEAR installation, request http://pear.php.net/go-pear in your browser and save the output to a local file go-pear.php.
  • Assuming you have installed PHP already, and it is runnable from the command line type php go-pear.php

For FreeBSD:

  • Add the PEAR DB package from the ports /usr/ports/databases/pear-DB

Test Installation

To make sure that PEAR is working simply type in pear at the command prompt. If nothing shows then check that the PEAR path is part of your system path. Check the version of PEAR by typing pear version

To use PEAR and PEAR compatible packages in your applications, you normally include them into your PHP scripts using require_once().  For this to work, PEAR’s php_dir must be a part of PHP’s include path.

First check where PEAR installs php files by typing

pear config-get php_dir

Whatever the folder is, this folder will contain System.php

To find which configuration file is used by your PHP installation. On command line, execute php –ini

When you execute a phpinfo() in the browser it should always the show the PEAR path in its include path for the PEAR packages to work.




Posted in Apache/PHP by amit. No Comments

Automated Web Testing

We have now adoped Selenium for automated web application testing. This increases the quality level of our software and generates better confidence for our clients.

big-logo

Posted in Apache/PHP Programming by amit. No Comments

Installing VSFTPD

1.Install it from the ports

cd /usr/ports/ftp/vsftpd

make config

make install clean

2.Edit the vstfpd.conf file in /usr/local/etc/vsftpd.conf to customize the settings

3.To run it from the command line:

/usr/local/libexec/vsftpd &

3.To make it run at startup create an executable file in /etc/rc.d

#! /bin/sh

#

/usr/local/libexec/vsftpd &

4.Restart computer

Posted in FreeBSD Unix by amit. No Comments

How to save a remote image to local disk

$image_url = “http://example.com/image.jpg”;
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);

// write to local file
$f = fopen(’/home/www/path/image.jpg’, ‘w’);
fwrite($f, $image);
fclose($f);

// output to browser
header(”Content-type: image/jpeg”);

print $image;

?>

Posted in Apache/PHP by amit. No Comments

How to delete .svn folders recursively

There is a very simple way of doing this. We use the find command to get all the s/.v .svn folders in a folder. The next step is to pass the output of this command to the delete command .

So  to list all .svn folders in the current folder:

find . -type d -name .svn

Next pass the output of this to the rm command by enclosing the find command in accented single quotes:

rm -rf `find. -type d -name .svn`
Posted in FreeBSD Unix by amit. No Comments

Checklist of applications to install

A reference list of all installed apps required for use on FreeBSD 8.0 or later

abiword - Word processing application

aterm - Better alternative to xterm

firefox - browser

fluxbox - window manager

filezilla - ftp client

gcolor2 - color picker utility

gkrellm - system monitoring util

linux-base-f10  - fedora linux compatibility base libraries

linux-f10-flashplugin - flash plugin for firefox and other browsers

mysql 5.x - mysql server and client

apache22 - apache http server

php5.x - php

opera - browser

portsnap - port updater tool

portaudit - port security tool

portmaster - port installer

putty - ssh tool

subversion - svn version control

vim - editor

xpdf - pdf viewer

xnview - image capture and processing utility

ffmpeg - audio/video conversion tool

xmms - mp3 player

mplayer - video player

Selenium - Firefox add-on for automated web testing

siege - web stress testing tool fromn joe dog sofware

Posted in FreeBSD Unix by amit. No Comments

Spara beta version is launched

We have beta launched Spara - a free online service for taking backups of your Facebook data. This should be a godsend for people who have a lot of data in their Facebook profiles.

Spara is available here

Spara - Save your Facebook

Spara - Save your Facebook

Posted in Misc by amit. No Comments

Recovering from a corrupt rc.conf

Sometimes we may make a mistake in the rc.conf file - either a syntax error or loading something which causes the system to crash. In such a case we need to fix the rc.conf file so that the system can boot normally.

The steps to do this are given below:

  • Boot into single user mode
  • When prompted for a shell pathname,  press Enter
  • Type mount -urw / to re-mount the root file system in read/write mode.
  • Type mount -a -t ufs to mount the current file system so that you can runyour preferred editor eg. vi
  • Edit /etc/rc.conf as required and save it
  • Restart the system
Posted in FreeBSD Unix by amit. No Comments

Apache post-install issue with mod_unique_id

If after installing Apache and starting the server the following message shows in the error logs and the apache server does not start:

hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of xxxxxx

then in httpd.conf disable the line

LoadModule unique_id_module libexec/apache2/mod_unique_id.so

Restart again. This is usually the fix if changing hosts and httpd.conf ServerName entries etc. do not fix the problem.

Posted in FreeBSD Unix by amit. No Comments

Installing Mysql 5.x

The commands are given below. Though this was used to install mysql 5.5.4 , it is applicable to older versions also (and perhaps newer ones as well).

cd /usr/ports/databases/mysql55-server/
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql &
/usr/local/bin/mysqladmin -u root password newpassword

Edit /etc/rc.conf to start mysql server at startup by putting the line

mysql_enable=”YES”

After this, restart FreeBSD.

Posted in FreeBSD Unix by amit. 1 Comment