Archive for July, 2009

How to: Setting, Using and Running Test with PHPUnit

Posted in Apache, Linux, PHP, Technical, work with tags , , , , , , , on July 30, 2009 by saffrongeek

[Warning: require_once(PHPUnit2/Framework/TestCase.php): failed to open stream: No such file or directory in… ]

How I got it?

I wanted to check my phpunit installed and try it for my testing. I took a sample code as below:

<?php
require_once ‘PHPUnit2/Framework/TestCase.php’;
class ArrayTest extends PHPUnit_Framework_TestCase {

}

?>

Then I opened up a terminal and keyed in the below command:

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ phpunit phpunitdemo

I got the error Warning: require_once(PHPUnit2/Framework/TestCase.php): failed to open stream: No such file or directory in /home/saffrongeek/Projects/sao2crmdr/phpunitdemo.php on line 2

HOW TO RESOLVE THIS:

Step #1: Open a file broser and go and verify where PEAR and phpunit files exist. In mine both where at the following folder paths respectively: /usr/share/php/

Step #2: Open the php.ini and modify the include_path as below:

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo gedit /etc/php5/apache2filter/php.ini

Remove semicolon in front and add the pear and phpunit paths to look as include_path = “.:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/PHPUnit”

Step #3: Restart Apache server as below:

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo /etc/init.d/apache2 restart

Step #4: Correct the file included and class from PHPUnit2 to PHPUnit.

Now try again in terminal and I got it working.

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ phpunit phpunitdemo
PHPUnit 3.3.17 by Sebastian Bergmann.

..

Time: 0 seconds

OK (2 tests, 2 assertions)

Let me know whether it works for you and your comments.


Setting PHPUnit in Ubuntu [LAMP]

Posted in Apache, Linux, mysql, PHP, Technical, work with tags , , , , , , , , , , , , on July 30, 2009 by saffrongeek

I have just copied the commands I tried on my terminal for someone else in search for the same. Hope it is useful.

Basic commands:

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo apt-get install php-pear
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo pear channel-discover pear.phpunit.de
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo pear install phpunit/PHPUnit

saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo pear channel-update pear.php.net
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo pear upgrade-all
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo pear channel-update pear.phpunit.de
Optional:
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ sudo apt-get install php5-xdebug

Check :
saffrongeek@saffrongeek-laptop:~/Projects/sao2crmdr$ phpunit –version

WAMP : Some useful pointers

Posted in Apache, mysql, PHP, Technical, work with tags , , , , , on July 28, 2009 by saffrongeek

First of all, the location of web root with reference to my test machine :

D:\wamp\www

My Root username was root and no password

———————————————————————————

To start the service you can start wampserver. This creates a control instance to the right bottom side. You can left click over the icon and you can find all the options to run/stop/restart services or could manually start / stop mysql / apache services from the pop up menu.

———————————————————————————

Virtual host setting up

———————————————————————————

Location : D:\wamp\bin\apache\Apache2.2.11\conf

Open httpd.conf and uncomment below line to look as below

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Vhost files are located inside

D:\wamp\bin\apache\Apache2.2.11\conf\extra

with name : httpd-vhosts.conf. Add virtual host to this.

————————————————————————–

If you want to configure a folder to be accessible from outside add something as below on the httpd.conf file:

<Directory “D:/wamp/www/saffron/sites/modules/_custom/sync/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Allow from 127.0.0.1
</Directory>

—————importing a sql dump from prompt——————————

If you got a dump file , which is large and phpmyadmin doesnt support you can use the mysql command prompt. The wampserver control panel gives a mysql console which I found tough to do a import.

I did , by opening up a windows command prompt, typing in the path to mysql.exe and username and password and path to the dump file as below.Note, the sql dump , was placed in the same bin folder.

C:\>D:\wamp\bin\mysql\mysql5.1.32\bin\mysql -u{dbusername} -p{dbpassword} {dbname} < D:\wamp\bin\mysql\mysql5.1.32\bin\sqldump.sql

National Security Guards OR National Shikandi Group ?

Posted in @home, drama, society with tags , , , , , , , , , on July 26, 2009 by saffrongeek

National Security Guards OR National Shikandi Group ?

Let me share a few news clips to justify the title. The day today known as 26/11 saw the NSG in action. Atleast , the terrorist strike got them a chance to get live on channels of their heroism( if it could be called so ). All were havin good words for them, roses being passed to them as a good will thanks.

After few weeks, it is gearing up time for General Election. The news channel was showing politician coming out of his residence to attend some public gathering. Ahead of him is one marching NSG commando. What we see next is, Lalu kicking him and abusing badly… sayin something like , ” in the name of protection , saalein kahin bhi aa tapktey hai”.

What Lalu missed that day to realize was that , the NSG commando job is to keep him safe and Lalu got no authority to question him , rather obey commando thoughts in security.

Well, NSG deserve this , that is what they are made for. Protect these politicians and at the same time receive kicks on their ass.

Now, why am I saying? Few days back the government made a press briefing that they are thinking of pulling back many of the NSG from providing unnecessary protection. Good news but cant trust this government because it is not RUN by strong hand and mind but a old man who just now underwent bypass surgery.

The funny part is to see the same Lalu who kicked the NSG that day protesting and saying this would call for untoward incidents and should be reconsidered.

Now, it is time for security cops to send message to governement that either they stay their ground or security cop go on a non-coperation movement.

Customizing the connector Dave way : Step 3

Posted in Apache, coldfusion, Linux, mysql, PHP, Technical, work with tags , , , , , , , , , on July 22, 2009 by saffrongeek

Dave Shuck in his post got a intersting section. Customize the connector. Reference link . That is great post. I follow that idea further and paste my terminal shots and procedures as described.

Now, customize Apache connector. Be sure about the present working directory at each command.
saffrongeek@saffrongeek-laptop:$ sudo gedit /etc/apache2/httpd.conf
Copy lines below starting with  #JRun
# JRun Settings
LoadModule jrun_module /opt/coldfusion8/runtime/lib/wsconfig/1/mod_jrun22.so
saffrongeek@saffrongeek-laptop:/etc/apache2/mods-available$ sudo gedit cf8.load


# JRun Settings
LoadModule jrun_module /opt/coldfusion8/runtime/lib/wsconfig/1/mod_jrun22.so


$ sudo gedit /etc/apache2/httpd.conf
Copy lines below

<IfModule mod_jrun22.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore /opt/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store
JRunConfig Bootstrap 127.0.0.1:51800
#JRunConfig Errorurl url <optionally redirect to this URL on errors>
#JRunConfig ProxyRetryInterval 600 <number of seconds to wait before trying to reconnect to unreachable clustered server>
#JRunConfig ConnectTimeout 15 <number of seconds to wait on a socket connect to a jrun server>
#JRunConfig RecvTimeout 300 <number of seconds to wait on a socket receive to a jrun server>
#JRunConfig SendTimeout 15 <number of seconds to wait on a socket send to a jrun server>
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

saffrongeek@saffrongeek-laptop:~$ cd /etc/apache2/
saffrongeek@saffrongeek-laptop:/etc/apache2$ sudo gedit cf8connector
Paste and save.

$ sudo gedit /etc/apache2/httpd.conf and Add below line :-
DirectoryIndex index.cfm

saffrongeek@saffrongeek-laptop:~$ sudo gedit /etc/apache2/sites-available/cflocale
and Add ‘Include cf8connector’ to look like below:-

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName cflocale
ServerAlias *.cflocale
DocumentRoot /home/saffrongeek/Projects/cflocale
Include cf8connector
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/saffrongeek/Projects/cflocale/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

saffrongeek@saffrongeek-laptop:~$ sudo a2dissite cflocale
Site cflocale disabled.
Run ‘/etc/init.d/apache2 reload’ to activate new configuration!
saffrongeek@saffrongeek-laptop:~$ sudo a2ensite cflocale
Enabling site cflocale.
Run ‘/etc/init.d/apache2 reload’ to activate new configuration!
saffrongeek@saffrongeek-laptop:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                                                                                                              … waiting                                                                                                                                          [ OK ]

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

All works great!! Thanks..

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Other Good References:

Iknowkungfu : url

thecrumb : url

ubuntu forums : url

Installing coldfusion in Ubuntu : Step 2

Posted in Apache, coldfusion, Linux, mysql, PHP, Technical, work with tags , , , , , , , , , , , on July 22, 2009 by saffrongeek

Installing Coldfusion

Getting coldfusion , download link [download]

Open a terminal and go to the directory where you have downloaded coldfusion.

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

saffrongeek@saffrongeek-laptop:~/Desktop/vermillons/$ chmod +x coldfusion-801-lin.bin
saffrongeek@saffrongeek-laptop:~/Desktop/vermillons/$ sudo ./coldfusion-801-lin.bin

Preparing to install…
Extracting the JRE from the installer archive…
Unpacking the JRE…
Extracting the installation resources from the installer archive…
Configuring the installer for this system’s environment…

Launching installer…

Preparing CONSOLE Mode Installation…

===============================================================================
Choose Locale…
—————-

->1- English

CHOOSE LOCALE BY NUMBER:

Presse Enter.

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): Y


===============================================================================
Install Type
————

If you do not have a serial number, select either 30-day trial or Developer
Edition.

->1- Install new version of Adobe ColdFusion 8 with a serial number
2- 30-day trial
3- Developer Edition

Installation Choice:

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Installation Choice: 3

===============================================================================
Installer Configuration
———————–

What kind of installation do you want?

->1- Server configuration
2- Multiserver configuration
3- J2EE configuration (EAR file)
4- J2EE configuration (WAR file)

Choose one of the following options::

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Choose one of the following options:: 1

===============================================================================
Is Adobe ColdFusion 8 (Server Configuration) Installed?
——————————————————-

You cannot install the server configuration of Adobe ColdFusion 8 if it is already installed on this computer.

Is there already a server configuration of Adobe ColdFusion 8 installed?

1- Yes
->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:
: 2

===============================================================================
Subcomponent installation
————————-

The following options are available for installation.

An option marked with “[X]” in front will be installed and an option with “[ ]”
will not.  Choosing an option will toggle it on or off

[X] 1) ColdFusion 8 Documentation
[X] 2) Adobe LiveCycle Data Services ES
[X] 3) ColdFusion 8 Search Services
[X] 4) Start ColdFusion on system init

5) Continue with installation

Select an option:
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select an option: 5

===============================================================================
Choose Install Folder
———————

Select the directory where you want to install Adobe ColdFusion 8.

Directory:

Default Install Folder: /opt/coldfusion8

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
:
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Press enter and below screen comes
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): Y

===============================================================================

If you do not have an Adobe LiveCycle Data Services ES serial number, leave the
serial number field blank to install a 120-day trial.

After the trial period expires, LCDS becomes Express edition until registered.
The Express edition is a free, non-expiring commercial use product for
application deployed on a single machine with not more than one CPU.

Enter your serial number for Adobe LiveCycle Data Services ES.
Example (you can omit the dashes if you prefer):
XXXX-XXXX-XXXX-XXXX-XXXX-XXXX

Serial Number::
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
===============================================================================
Earlier Versions of Adobe ColdFusion installed?
———————————————–

If you installed an earlier version of ColdFusion on this computer, you can migrate your settings to Adobe ColdFusion 8.

Is there an earlier version of ColdFusion installed on this computer (for example, ColdFusion 6 or ColdFusion MX 7)?

1- Yes
->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:
: 2

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
===============================================================================
Configure Web Servers
———————

Please configure your web server(s).  If you do not configure a web server the
built-in web server will be used on port 8500 or the next available port.

1- Add Web Server Configuration
->2- Continue with installation

Choice: 1

****************************************************

->1- Apache
2- Sun ONE Web Server (iPlanet)
3- Cancel

What kind of web server are you configuring:
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What kind of web server are you configuring: 1

What directory contains your Apache configuration file (httpd.conf)? (For
example, on Red Hat Linux it could be located in the /etc/httpd/conf
directory if you installed from an rpm, or for SuSe Linux, it could be in
/etc/apache2)

Directory: /etc/apache2

****************************************************

Where is the Apache program binary file? (For example, on Red Hat Linux it
could be /usr/sbin/httpd if you installed from an rpm, or for SuSE Linux it
could be located at /usr/sbin/httpd2) If you have more than one instance of
Apache on your computer, enter the binary file location for the Apache web
server that will use ColdFusion. (Note: this is not the Apache start and
stop script.)

File: /usr/sbin/apache2

****************************************************

Where is the control file that you use to start and stop the Apache web
server? (For example, this could be /etc/init.d/httpd on Red Hat Linux if
you installed from an rpm, /usr/sbin/apache2ctl on SuSe Linux, or it could
be /usr/local/apache/bin/apachectl on hand-compiled versions.)

File: /etc/init.d/apache2

****************************************************
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
****************************************************

Please configure your web server(s).  If you do not configure a web server the
built-in web server will be used on port 8500 or the next available port.

1- Add Web Server Configuration
2- Remove Web Server Configuration
3- Edit:Apache : /etc/apache2
->4- Continue with installation

Choice: 4

===============================================================================
Choose Adobe ColdFusion 8 Administrator Location
————————————————

Select the location of the web root for Adobe ColdFusion 8. This is where the installer places the Adobe ColdFusion 8 Administrator.

This directory must be the web root for one of the websites to be configured for use with Adobe ColdFusion 8.

Directory: (DEFAULT: /etc/htdocs): /home/saffrongeek/Projects/cflocale

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\\

Follow installer and create a runtime user and administration password. Do not forget this password.

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

===============================================================================
Enable RDS
———-

The ColdFusion Remote Development Service (RDS) lets developers using Adobe
tools remotely connect to this server for development purposes. RDS is required
for Line Debugging, Report Builder, and DreamWeaver Extensions.

If this is a production server, Adobe recommends that you disable RDS.
Note, however, that disabling RDS also disables debugging, the directory
browsing applets in the ColdFusion Administrator and some of the functionality
in the Report Builder.

Enable RDS  (Y/N): N

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
===============================================================================
Installation Confirmation
————————-

Installation Type:
Server configuration

Licensing:
Developer Edition

Installation Directories:
Product: /opt/coldfusion8
Web root: /home/saffrongeek/Projects/cflocale

Server Information:
Web Server: Apache (/etc/apache2)
Port:
Search Services: installed
Adobe LiveCycle Data Services ES: installed ( Express edition )
Documentation: installed
RDS: disabled

Disk Space Information (for Installation Target):
Required: 923,564,250 bytes
Available: 4,513,050,624 bytes

PRESS <ENTER> TO CONTINUE:

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
===============================================================================
Installing…
————-

[==================|==================|==================|==================]
[——————|——————|——————|——————]

===============================================================================
Installation Complete
———————

You have successfully completed the first step in installing Adobe ColdFusion
8.

To continue with your installation, go to /opt/coldfusion8/bin and type
“./coldfusion start” to start your server.

Once the server, is started log in to the Configuration Wizard at
http://%5Bmachinename%5D/CFIDE/administrator/index.cfm

Press Enter to exit the installer:

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\||\

Now let us start the CF server, in the terminal type as below:-

saffrongeek@saffrongeek-laptop:~$ sudo /opt/coldfusion8/bin/coldfusion start

All should be fine.:) Now open a browser and type the following:

http://cflocale for document root of cf project and http://cflocale/CFIDE/administrator/index.cfm for administration.




Setting Coldfusion in Ubuntu : Step 1

Posted in Apache, coldfusion, Linux, mysql, Technical, work with tags , , , , , , on July 22, 2009 by saffrongeek

Setting up basic coldfusion environment in Ubuntu :: Step 1

saffrongeek@saffrongeek-laptop:~$ sudo gedit /etc/apache2/sites-available/cflocale

[ Note , I keep my webroot as Projects folder in the path. Please change the document root as yours accordingly.]
Paste the below and save..

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName cflocale
ServerAlias *.cflocale
DocumentRoot /home/saffrongeek/Projects/cflocale

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/saffrongeek/Projects/cflocale/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

saffrongeek@saffrongeek-laptop:~$ sudo a2ensite cflocale
Enabling site cflocale.
Run ‘/etc/init.d/apache2 reload’ to activate new configuration!
saffrongeek@saffrongeek-laptop:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                                                                                                              … waiting                                                                                                                                          [ OK ]

%d bloggers like this: