Hi All,
Below are the sample code for making A USB drive Autorun.
1. Crate a file autorun.inf
2. Paste the below code on autorun.inf and save it on USB drive.
3. Change "firefox.exe" based opon ur requirment.
4. Will work on XP only
[autorun]
open=firefox.exe "http://www.mozilla.com/"
shell\open\command=firefox.exe "http://www.mozilla.com/"
useautoplay=1
Monday, December 28, 2009
Monday, September 21, 2009
Program to kill database process.
class dbMysql
{
var $host, $user, $pass, $conn;
var $errNum, $errMsg;
var $rowCount, $qryType;
function dbMysql($host, $user, $pass)
{
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
$this->rowCount = 0;
$this->errNum = 0;
$this->errMsg = '';
$this->qryType = 0;
}
function open()
{
if (!$this->conn = @mysql_connect($this->host,$this->user,$this->pass))
{
$this->errNum = 2;
$this->errMsg = 'Cannot Connect to DataBase Server';
return false;
}
$this->errNum = 0;
$this->errMsg = 'OK';
return true;
}
function select($dbName)
{
if (!(@mysql_select_db($dbName,$this->conn)))
{
$this->errNum = 2;
$this->errMsg = 'Cannot Select Requested DataBase';
return false;
}
$this->errNum = 0;
$this->errMsg = 'OK';
return true;
}
function getAutoId()
{
return @mysql_insert_id($this->conn);
}
function getResultCount($result)
{
return ($this->qryType) ? @mysql_num_rows($result) : @mysql_affected_rows($this->conn);
}
function query($qryStr)
{
eregi('^SELECT',$qryStr) ? $this->qryType = 0 : $this->qryType = 1;
return @mysql_query($qryStr,$this->conn);
}
function fetch($result)
{
return @mysql_fetch_object($result);
}
function close()
{
@mysql_close($this->conn);
}
}
/* START HERE - ADD HOST USER AND PASSSWORD */
$db = new dbMysql("localhost", "root", "scrypt581t");
if (!$db->open())
{ print("ERROR: " . $db->errNum . " -- " . $db->errMsg); }
$result = $db->query("SHOW FULL PROCESSLIST");
while ($row=mysql_fetch_array($result)) {
$process_id=$row["Id"];
if ($row["User"] != "root" ) {
print("KILLED: " . $process_id);
$sql="KILL $process_id";
mysql_query($sql);
}
}
if (!$result)
{
$db->close();
print("ERROR: " . $db->errNum . " -- " . $db->errMsg);
}
$db->close();
?>
{
var $host, $user, $pass, $conn;
var $errNum, $errMsg;
var $rowCount, $qryType;
function dbMysql($host, $user, $pass)
{
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
$this->rowCount = 0;
$this->errNum = 0;
$this->errMsg = '';
$this->qryType = 0;
}
function open()
{
if (!$this->conn = @mysql_connect($this->host,$this->user,$this->pass))
{
$this->errNum = 2;
$this->errMsg = 'Cannot Connect to DataBase Server';
return false;
}
$this->errNum = 0;
$this->errMsg = 'OK';
return true;
}
function select($dbName)
{
if (!(@mysql_select_db($dbName,$this->conn)))
{
$this->errNum = 2;
$this->errMsg = 'Cannot Select Requested DataBase';
return false;
}
$this->errNum = 0;
$this->errMsg = 'OK';
return true;
}
function getAutoId()
{
return @mysql_insert_id($this->conn);
}
function getResultCount($result)
{
return ($this->qryType) ? @mysql_num_rows($result) : @mysql_affected_rows($this->conn);
}
function query($qryStr)
{
eregi('^SELECT',$qryStr) ? $this->qryType = 0 : $this->qryType = 1;
return @mysql_query($qryStr,$this->conn);
}
function fetch($result)
{
return @mysql_fetch_object($result);
}
function close()
{
@mysql_close($this->conn);
}
}
/* START HERE - ADD HOST USER AND PASSSWORD */
$db = new dbMysql("localhost", "root", "scrypt581t");
if (!$db->open())
{ print("ERROR: " . $db->errNum . " -- " . $db->errMsg); }
$result = $db->query("SHOW FULL PROCESSLIST");
while ($row=mysql_fetch_array($result)) {
$process_id=$row["Id"];
if ($row["User"] != "root" ) {
print("KILLED: " . $process_id);
$sql="KILL $process_id";
mysql_query($sql);
}
}
if (!$result)
{
$db->close();
print("ERROR: " . $db->errNum . " -- " . $db->errMsg);
}
$db->close();
?>
Monday, September 14, 2009
symfony on XAMPP
= Overview =
This page details the steps required to install a complete development environment for symfony (SVN, Apache, PHP, PEAR, Phing). The Svn1ClickSetup and XAMPP installation tools are used to make it as simple as possible. This page is similar to BeginningSymfonyWithPear, but includes more detail on setting up the prerequisite packages.
== Contents ==
1. Install Subversion with Svn1ClickSetup
1. Clear out any previous apache and mysql installs
1. Install XAMPP with XAMPP installer in default location
1. Set PEAR directories
1. Upgrade PEAR
1. Install Phing
1. Install symfony
1. Create work directory and update apache config and hosts file
1. Create a symfony project in your work directory (taken from the askeet tutorial)
1. Create an SVN repository for the project
1. Import the project into the SVN repository
1. Start using the SVN files in your work directory
= 1. Install Subversion with Svn1ClickSetup =
Subversion is a command-based version control tool that lets you track changes to your files, and restore them to older versions should you need to do so. If you would like to learn more about Subversion, please check out [http://svnbook.red-bean.com/]. TortoiseSVN lets you execute Subversion commands from Windows explorer.
Svn1ClickSetup allows you to install both Subversion and TortoiseSVN all in one shot. You can download Svn1ClickSetup at [http://svn1clicksetup.tigris.org/]
To keep things simple, when you run Svn1ClickSetup, go ahead and install in default location. When prompted, make sure that you choose to install Tortoise SVN. Do not create a repository yet. If you create a repository, by mistake, you should can delete later, and if you missed the TortoiseSVN install, you can run Svn1ClickSetup again.
''''' How do you know it worked? '''''
If you go into Windows explorer, you can see that Tortoise SVN has been installed.
[[Image(image002.png)]]
= 2. Clear out any previous apache and mysql installs =
Go you the control panel and click on add/remove programs. Remove any packages that would have installed Apache, MySQL or PHP. Be careful to move out any files in the apache document root before you remove any program that installed apache – you don’t want to lose any previous work.
If you have a previous install, you might have to remove apache and mysql services:
First, open a command line window by going to the Run… choice on the start menu
[[Image(image003.png)]]
and then execute "cmd"
[[Image(image005.png)]]
After the command window opens, type the following:
{{{
sc delete apache
sc delete apache2
sc delete mysql
}}}
''''' How do you know it worked? '''''
If you enter these commands and do not receive an error, that means that you've successfully removed an apache or mysql service that was previously installed. However, it’s OK if you get a “does not exist” error – this just means that you didn’t have the services already installed.
= 3. Install XAMPP with XAMPP installer in default location =
You can download XAMPP from http://www.apachefriends.org/en/xampp-windows.html. Once the install file is downloaded, just execute it. To continue with the steps below, you should accept the default file location. When the install is complete, you should receive the following screen:
[[Image(image007.png)]]
After you click "Finish", you should see another screen:
[[Image(image009.png)]]
Click no if you only want to use XAMPP sometimes. Clicking yes sets up services that can be started automatically. You can also disable services or have them to be started manually, so there is not much to be lost by installing these as services. You can adjust service settings, by going into the Control Panel from the Start Menu, clicking on Administrative Tools, and then clicking on Services.
At this point, you should see the following shortcut on your desktop.
[[Image(image013.png)]]
Double click on the shortcut. You should see the following screen:
[[Image(image015.png)]]
Close the program with the “Exit” button instead of the “X” in the top right corner, else it will try to restart everything when you try to open the control panel again.
You should also add shortcuts to the XAMPP start and XAMPP stop batch files in the same directory as the control panel. These shortcuts are more reliable for starting and stopping Apache and MySQL (of course, this is not necessary if you have them installed as an automatic service).
''''' How do you know it worked? '''''
Open up your browser and go to !http://localhost. It should show the following screen:
[[Image(image017.png)]]
= 4. Set PEAR directories =
You want to be able to easily execute PEAR from the command line, so it’s important to set up the right include path and to make sure that all pear packages will be installed in the right locations.
1. From the desktop, right click My Computer and click properties.
1. In the System Properties window, click on the Advanced tab.
1. In the Advanced section, click the Environment Variables button.
1. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below:
C:\Program Files;C:\Winnt;C:\Winnt\System32
You want to add the following (make sure you have no spaces before or after semicolons:
C:\Program Files\xampp\php;C:\Program Files\xampp\mysql\bin;
''''' How do you know it worked? '''''
First open a command line window by going to the Run… choice on the start menu:
[[Image(image003.png)]]
and then execute "cmd"
[[Image(image005.png)]]
Enter the command:
{{{
pear config-show
}}}
If you see, output like the following, you know that you’ve set the environment variable correctly:
{{{
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir C:\Program Files\xampp\php
PEAR documentation directory doc_dir C:\Program Files\xampp\php\pear\docs
PHP extension directory ext_dir C:\Program Files\xampp\php\ext
PEAR directory php_dir C:\Program Files\xampp\php\pear
PEAR Installer cache directory cache_dir C:\Program Files\xampp\tmp
PEAR data directory data_dir C:\Program Files\xampp\php\pear\data
PHP CLI/CGI binary php_bin C:\Program Files\xampp\php\php.exe
PEAR test directory test_dir C:\Program Files\xampp\php\pear\tests
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 0
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin c:\gnupg\gpg.exe
Signature Key Directory sig_keydir C:\Program Files\xampp\php\pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename C:\Program Files\xampp\php\pear.ini
System Configuration File Filename C:\Program Files\xampp\php\pearsys.ini
}}}
= 5. Upgrade PEAR =
It’s important to upgrade PEAR at this point, because PEAR is used to install so many other things.
Type the following:
{{{
cd \progra~1\xampp\php
pear list-all | more
}}}
At this point you should see a list of all the PEAR packages that were installed with xampp. Your output should be something like this, and continue with all of the PEAR packages that were installed with XAMPP (a long list):
{{{
Retrieving data...0%....50%....ALL PACKAGES:
=============
PACKAGE LATEST LOCAL
pear/Archive_Tar 1.3.1 1.3.1 Tar file management class
pear/Contact_AddressBook 0.5.0 Address book export-import class
}}}
If you get an error at this stage, double check that you do not have apache, mysql, php, or pear installed anywhere else on your machine. For example, if you receive a "PHP Fatal error: Unable to open base address file in Unknown on line 0", this could signal that you have a previous install of MySQL, PHP, and Apache installed, possibly with an older package like !FoxServ. To correct such a problem, you would need to uninstall xampp (via the Windows control panel) and start back from step 2.
Type the following:
{{{
pear update-channels
}}}
You should get output like this:
{{{
Updating channel "pear.php.net"
Updating channel "pecl.php.net"
update-channels complete
}}}
Type the following:
{{{
pear upgrade pear
}}}
You should get output like this:
{{{
downloading PEAR-1.4.4.tgz ...
Starting to download PEAR-1.4.4.tgz (276,978 bytes)
.........................................................done: 276,978 bytes
upgrade ok: channel://pear.php.net/PEAR-1.4.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
To install use "pear install PEAR#featurename"
}}}
Unfortunately, in the process of updating the pear package, the pear configuration is somehow corrupted.
It seams that this is fixed in PEAR-1.4.6.tgz .... So skip correcting PEAR directories below untill "At this point, you PEAR directories should be reset"
Type the following:
{{{
pear config-show
}}}
In the following output you can see that the correct configuration from the xampp install has been overwritten:
{{{
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir C:\Program Files\xampp\php
PEAR documentation directory doc_dir C:\php5\pear\docs
PHP extension directory ext_dir C:\Program Files\xampp\php\ext\
PEAR directory php_dir C:\Program Files\xampp\php\pear
PEAR Installer cache directory cache_dir C:\WINDOWS\TEMP\pear\cache
PEAR data directory data_dir C:\php5\pear\data
PHP CLI/CGI binary php_bin C:\Program Files\xampp\php\php.exe
PEAR test directory test_dir C:\php5\pear\tests
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 0
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin c:\gnupg\gpg.exe
Signature Key Directory sig_keydir C:\WINDOWS\pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename C:\WINDOWS\pear.ini
System Configuration File Filename C:\WINDOWS\pearsys.ini
}}}
The configuration file locations and the doc_dir, cache_dir, data_dir, test_dir, and sig_keydir directory variables don’t make much sense on a Windows machine. These directories tell PEAR where to install packages. Why would we want to have half of our PEAR files in C:\Program Files\xampp\php\ and the other half under C:\php5?
Compare to the locations from the original XAMPP install, above.
To correct the PEAR directories, go to the command line and type:
{{{
pear config-set doc_dir “C:\Program Files\xampp\php\pear\docs”
pear config-set cache_dir “C:\Program Files\xampp\tmp”
pear config-set data_dir “C:\Program Files\xampp\php\pear\data”
pear config-set test_dir “C:\Program Files\xampp\php\pear\tests”
pear config-set sig_keydir “C:\Program Files\xampp\php\pearkeys”
}}}
At this point, you PEAR directories should be reset. You can upgrade the rest of the pear packages that came with XAMPP with the following command:
{{{
pear upgrade-all
}}}
You should receive the following output:
{{{
Will upgrade benchmark
Will upgrade html_form
Will upgrade html_progress
Will upgrade html_quickform_controller
Will upgrade html_table
Will upgrade html_template_it
Will upgrade html_template_sigma
Will upgrade http_request
Will upgrade log
Will upgrade net_geo
Will upgrade phpunit
Will upgrade system_command
Did not download dependencies: pear/HTML_Page2, use --alldeps or --onlyreqdeps to download automatically
Did not download dependencies: pear/PHP_Compat, use --alldeps or --onlyreqdeps to download automatically
pear/HTML_Progress can optionally use package "pear/HTML_Page2" (version >= 0.5.0beta)
pear/PHPUnit can optionally use package "pear/PHP_Compat"
downloading Benchmark-1.2.4.tgz ...
Starting to download Benchmark-1.2.4.tgz (7,587 bytes)
.....done: 7,587 bytes
downloading HTML_Form-1.3.0.tgz ...
Starting to download HTML_Form-1.3.0.tgz (14,742 bytes)
...done: 14,742 bytes
downloading HTML_Progress-1.2.5.tgz ...
Starting to download HTML_Progress-1.2.5.tgz (645,471 bytes)
...done: 645,471 bytes
downloading HTML_QuickForm_Controller-1.0.5.tgz ...
Starting to download HTML_QuickForm_Controller-1.0.5.tgz (16,413 bytes)
...done: 16,413 bytes
downloading HTML_Table-1.6.1.tgz ...
Starting to download HTML_Table-1.6.1.tgz (12,251 bytes)
...done: 12,251 bytes
downloading HTML_Template_IT-1.1.3.tgz ...
Starting to download HTML_Template_IT-1.1.3.tgz (19,314 bytes)
...done: 19,314 bytes
downloading HTML_Template_Sigma-1.1.4.tgz ...
Starting to download HTML_Template_Sigma-1.1.4.tgz (27,295 bytes)
...done: 27,295 bytes
downloading HTTP_Request-1.3.0.tgz ...
Starting to download HTTP_Request-1.3.0.tgz (13,808 bytes)
...done: 13,808 bytes
downloading Log-1.9.2.tgz ...
Starting to download Log-1.9.2.tgz (37,891 bytes)
...done: 37,891 bytes
downloading Net_Geo-1.0.1.tgz ...
Starting to download Net_Geo-1.0.1.tgz (6,468 bytes)
...done: 6,468 bytes
downloading PHPUnit-1.3.2.tgz ...
Starting to download PHPUnit-1.3.2.tgz (20,786 bytes)
...done: 20,786 bytes
downloading System_Command-1.0.3.tgz ...
Starting to download System_Command-1.0.3.tgz (5,162 bytes)
...done: 5,162 bytes
upgrade-all ok: channel://pear.php.net/System_Command-1.0.3
upgrade-all ok: channel://pear.php.net/HTML_Template_IT-1.1.3
upgrade-all ok: channel://pear.php.net/Log-1.9.2
upgrade-all ok: channel://pear.php.net/Net_Geo-1.0.1
upgrade-all ok: channel://pear.php.net/PHPUnit-1.3.2
upgrade-all ok: channel://pear.php.net/HTML_Form-1.3.0
upgrade-all ok: channel://pear.php.net/HTTP_Request-1.3.0
upgrade-all ok: channel://pear.php.net/HTML_Template_Sigma-1.1.4
upgrade-all ok: channel://pear.php.net/HTML_QuickForm_Controller-1.0.5
upgrade-all ok: channel://pear.php.net/HTML_Table-1.6.1
upgrade-all ok: channel://pear.php.net/Benchmark-1.2.4
upgrade-all ok: channel://pear.php.net/HTML_Progress-1.2.5
}}}
''''' How do you know it worked? '''''
You should check the pear configuration again with a “pear config-show” command to ensure that no directory locations have been corrupted; if everything the directory location have not changed, you’re ready to install Phing.
= 6. Install Phing =
Type the following:
{{{
pear install –a http://phing.info/pear/phing-current.tgz
}}}
You should get a result like the following:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Failed to download pear/VersionControl_SVN, version "0.3.0alpha1", latest release is version 0.3.0alpha1, stability "alpha", use "channel://pear.php.net/VersionControl_SVN-0.3.0alpha1" to install
Failed to download pecl/Xdebug within preferred state "stable", latest release is version 2.0.0beta4, stability "beta", use "channel://pecl.php.net/Xdebug-2.0.0beta4" to install
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
pear/PHPUnit2 can optionally use PHP extension "xdebug" (version >= 2.0.0beta2)
downloading PHPUnit2-2.3.3.tgz ...
Starting to download PHPUnit2-2.3.3.tgz (43,119 bytes)
...done: 43,119 bytes
install ok: channel://pear.php.net/PHPUnit2-2.3.3
}}}
The output is telling you that several dependent packages were not installed because the XAMPP pear configuration specifies to install stable code vs. alpha or beta code (which phing requires). PhpUnit2 was installed correctly, but other packages were not (please note that if you had not corrected the directory locations in the step above, PhpUnit2 would be installed in the wrong location instead of in the pear directory). If we run the same command again with the “-o” instead of the “-a” options we can ignore the optional dependencies (“-a” gets you all dependencies). But don’t bother with that like I did, you’ll just get this:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Did not download dependencies: pear/VersionControl_SVN, pecl/Xdebug, use --alldeps or --onlyreqdeps to download automatically
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
No valid packages found
install failed
}}}
At this point, we need to override our default settings and install the Phing dependencies manually. Going back to our message from the “-a” install of Phing, we can see that channels are specified. We can install them with the following commands:
{{{
pear install -a channel://pecl.php.net/Xdebug-2.0.0beta2
downloading xdebug-2.0.0beta2.tgz ...
Starting to download xdebug-2.0.0beta2.tgz (195,568 bytes)
.........................................done: 195,568 bytes
62 source files, building
ERROR: The DSP xdebug.dsp does not exist.
}}}
Since that didn’t work, try getting binary files. Go to the Xdebug site:
[http://www.xdebug.org/install.php]
Download the correct version of the xdebug DLL from this site and save it as C:\Program Files\xampp\php\
Add the following line to the C:\Program Files\xampp\php\php.ini and in C:\Program Files\xampp\apache\bin\php.ini and comment out the original line:
{{{
zend_extension_ts=“C:\Program Files\xampp\php\ xdebug-5.0-2.0.0beta1.dll” (use correct name)
}}}
If you don’t comment out the original line, you get:
[[Image(image021.png)]]
Getting back to the subject at hand, an attempt to install Phing again yields these results:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Failed to download pear/VersionControl_SVN, version "0.3.0alpha1", latest release is version 0.3.0alpha1, stability "alpha", use "channel://pear.php.net/VersionControl_SVN-0.3.0alpha1" to install
Failed to download pecl/Xdebug within preferred state "stable", latest release is version 2.0.0beta4, stability "beta", use "channel://pecl.php.net/Xdebug-2.0.0beta4" to install
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
No valid packages found
install failed
}}}
However, using phpinfo() in web browser, you can see that Xdebug is installed:
[[Image(image023.png)]]
I eventually just gave up and installed phing without dependencies:
{{{
pear install –n http://phing.info/pear/phing-current.tgz
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
warning: pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
install ok: channel://pear.php.net/phing-2.1.1
}}}
Install SVN package with:
{{{
pear install -o pear.php.net/VersionControl_SVN-0.3.0alpha1
downloading VersionControl_SVN-0.3.0alpha1.tgz ...
Starting to download VersionControl_SVN-0.3.0alpha1.tgz (33,829 bytes)
.........done: 33,829 bytes
install ok: channel://pear.php.net/VersionControl_SVN-0.3.0alpha1
}}}
Upgrade !PhpDocumentor with:
{{{
pear upgrade pear/PhpDocumentor-beta
downloading PhpDocumentor-1.3.0RC3.tgz ...
Starting to download PhpDocumentor-1.3.0RC3.tgz (2,711,672 bytes)
..............................................................................................................done: 2,711,672 bytes
upgrade ok: channel://pear.php.net/PhpDocumentor-1.3.0RC3
}}}
The XdebugOnWindows page shows you how to install Xdebug.
''''' How do you know it worked? '''''
Since Phing was installed with your upgraded version of PEAR, you know each step worked based on the "install ok" and "upgrade ok" messages.
== 7. Install symfony ==
The first thing to do is to add the 'symfony' channel:
{{{
pear channel-discover pear.symfony-project.com
}}}
To see the libraries available in this channel:
{{{
pear remote-list -c symfony
}}}
Now you are ready to install the latest stable version of symfony and all its dependencies with:
{{{
pear install symfony/symfony
}}}
Output looks ok:
{{{
downloading symfony-0.4.2.tgz ...
Starting to download symfony-0.4.2.tgz (1,199,762 bytes)
..............................................................................done: 1,199,762 bytes
downloading pake-1.0.76.tgz ...
Starting to download pake-1.0.76.tgz (16,523 bytes)
...done: 16,523 bytes
install ok: channel://pear.symfony-project.com/pake-1.0.76
install ok: channel://pear.symfony-project.com/symfony-0.4.2
}}}
Finally, for Symfony to work, you must also verify/update the following settings in the C:\Program Files\xampp\apache\bin\php.ini file:
{{{
register_globals = Off
magic_quotes_gpc = Off
}}}
If you intend on using short open tags (i.e or ) you must verify/update the following setting in the C:\Program Files\xampp\apache\bin\php.ini file:
{{{
short_open_tag = On
}}}
''''' How do you know it worked? '''''
Since symfony was installed with your upgraded version of PEAR, you know each step worked based on the "install ok" messages.
== 8. Create work directory and update apache config and hosts file ==
For the purposes of this guide, creat the c:\web directory to hold your symfony projects.
Update C:\Program Files\xampp\apache\conf\httpd.conf as follows:
{{{
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#default area for new web projects
ServerName web
DocumentRoot "C:\web"
#original xampp location
ServerName localhost
DocumentRoot "C:\Program Files\xampp\htdocs"
#allow access for the shared sf directory
Allow from All
#sample symfony project
ServerName askeet
DocumentRoot "C:\web\askeet\web"
DirectoryIndex index.php
Alias /sf "C:\Program Files\xampp\php\pear\data\symfony\web\sf"
AllowOverride All
Order allow,deny
Allow from All
}}}
Update C:\WINDOWS\system32\drivers\etc\hosts as follows:
{{{
127.0.0.1 localhost
127.0.0.1 askeet
127.0.0.1 web
}}}
''''' How do you know it worked? '''''
At this point, you don't. In the next step, you'll open your web browser go to !http://askeet and get a symfony welcome message. If there is a problem there, it could be a problem with this step.
== 9. Create a symfony project in your work directory (taken from the askeet tutorial) ==
In symfony, applications sharing the same data model are regrouped into projects. For the askeet project, we can already disclose the fact that there will be a frontend and a backend: that makes two applications. The project being the shell of the applications, it has to be created first. To do that, all you need is a directory and a symfony init-project command line:
{{{
cd C:\web\askeet
symfony init-project askeet
}}}
Now it is time to create the frontend application with the symfony init-app command:
{{{
symfony init-app frontend
}}}
''''' How do you know it worked? '''''
Restart Apache, and check that you now have access to the new application by going to !http://askeet/. You should get the following screen:
[[Image(image025.png)]]
== 10. Create an SVN repository for the project ==
In Windows explorer, make a directory where you would like the SVN repository to be.
Right click on the directory you just created, then scroll to TortoiseSVN > Create Repository here…
You should get the following pop-up window:
[[Image(image027.png)]]
Choose the file type you would like and click OK.
''''' How do you know it worked? '''''
You should get the following message:
[[Image(image029.png)]]
== 11. Import the project into the SVN repository ==
Go to your work area in Windows Explorer.
Delete the contents of the “cache” and “log directories.
Right click on the directory you just created, then scroll to TortoiseSVN > Import…
[[Image(image031.png)]]
Click on the button in the top right to browse for the location of the SVN repository that you just created.
Once selected, add a “/trunk” to the end of the file location.
Enter “initial import” in the Import Message field.
Click OK
''''' How do you know it worked? '''''
You should get output as follows:
[[Image(image033.png)]]
== 12. Start using the SVN files in your work directory ==
To use the SVN repository, we’ll actually want to checkout the files in an empty directory – SVN needs an empty directory to start.
Using Windows Explorer, rename your project directory from askeet to askeet.orig (keeping with the earlier example).
Create a new work directory named askeet
Right click on the directory you just created, then scroll to TortoiseSVN > SVN Checkout…
In the pop-up window verify that the “URL of repository” has the location of the SVN directory that you created; if not, browse and select it. Make sure you have /trunk added to the raw location.
Click OK and you should get the following window:
[[Image(image035.png)]]
When you go back to windows explorer, you should now see a green check mark next to the directory.
Delete the askeet.orig directory
Finally, go to window explorer, go to the C:\web\askeet directory. Right click on the “cache” directory and choose the ignore icon (a man with a blindfold) to ignore the cache directory. Do the same for the log directory.
Now, make sure to set the write permissions on the cache and logs directories back to the appropriate levels so that your web server can write to them again. In Windows Explorer look at the file properties and uncheck “Read-Only” then click “Apply”.
''''' How do you know it worked? '''''
If you got the expected output, that’s it. You’re done! You’ve gone from a fresh system to a working development environment that supports your symfony project.
This page details the steps required to install a complete development environment for symfony (SVN, Apache, PHP, PEAR, Phing). The Svn1ClickSetup and XAMPP installation tools are used to make it as simple as possible. This page is similar to BeginningSymfonyWithPear, but includes more detail on setting up the prerequisite packages.
== Contents ==
1. Install Subversion with Svn1ClickSetup
1. Clear out any previous apache and mysql installs
1. Install XAMPP with XAMPP installer in default location
1. Set PEAR directories
1. Upgrade PEAR
1. Install Phing
1. Install symfony
1. Create work directory and update apache config and hosts file
1. Create a symfony project in your work directory (taken from the askeet tutorial)
1. Create an SVN repository for the project
1. Import the project into the SVN repository
1. Start using the SVN files in your work directory
= 1. Install Subversion with Svn1ClickSetup =
Subversion is a command-based version control tool that lets you track changes to your files, and restore them to older versions should you need to do so. If you would like to learn more about Subversion, please check out [http://svnbook.red-bean.com/]. TortoiseSVN lets you execute Subversion commands from Windows explorer.
Svn1ClickSetup allows you to install both Subversion and TortoiseSVN all in one shot. You can download Svn1ClickSetup at [http://svn1clicksetup.tigris.org/]
To keep things simple, when you run Svn1ClickSetup, go ahead and install in default location. When prompted, make sure that you choose to install Tortoise SVN. Do not create a repository yet. If you create a repository, by mistake, you should can delete later, and if you missed the TortoiseSVN install, you can run Svn1ClickSetup again.
''''' How do you know it worked? '''''
If you go into Windows explorer, you can see that Tortoise SVN has been installed.
[[Image(image002.png)]]
= 2. Clear out any previous apache and mysql installs =
Go you the control panel and click on add/remove programs. Remove any packages that would have installed Apache, MySQL or PHP. Be careful to move out any files in the apache document root before you remove any program that installed apache – you don’t want to lose any previous work.
If you have a previous install, you might have to remove apache and mysql services:
First, open a command line window by going to the Run… choice on the start menu
[[Image(image003.png)]]
and then execute "cmd"
[[Image(image005.png)]]
After the command window opens, type the following:
{{{
sc delete apache
sc delete apache2
sc delete mysql
}}}
''''' How do you know it worked? '''''
If you enter these commands and do not receive an error, that means that you've successfully removed an apache or mysql service that was previously installed. However, it’s OK if you get a “does not exist” error – this just means that you didn’t have the services already installed.
= 3. Install XAMPP with XAMPP installer in default location =
You can download XAMPP from http://www.apachefriends.org/en/xampp-windows.html. Once the install file is downloaded, just execute it. To continue with the steps below, you should accept the default file location. When the install is complete, you should receive the following screen:
[[Image(image007.png)]]
After you click "Finish", you should see another screen:
[[Image(image009.png)]]
Click no if you only want to use XAMPP sometimes. Clicking yes sets up services that can be started automatically. You can also disable services or have them to be started manually, so there is not much to be lost by installing these as services. You can adjust service settings, by going into the Control Panel from the Start Menu, clicking on Administrative Tools, and then clicking on Services.
At this point, you should see the following shortcut on your desktop.
[[Image(image013.png)]]
Double click on the shortcut. You should see the following screen:
[[Image(image015.png)]]
Close the program with the “Exit” button instead of the “X” in the top right corner, else it will try to restart everything when you try to open the control panel again.
You should also add shortcuts to the XAMPP start and XAMPP stop batch files in the same directory as the control panel. These shortcuts are more reliable for starting and stopping Apache and MySQL (of course, this is not necessary if you have them installed as an automatic service).
''''' How do you know it worked? '''''
Open up your browser and go to !http://localhost. It should show the following screen:
[[Image(image017.png)]]
= 4. Set PEAR directories =
You want to be able to easily execute PEAR from the command line, so it’s important to set up the right include path and to make sure that all pear packages will be installed in the right locations.
1. From the desktop, right click My Computer and click properties.
1. In the System Properties window, click on the Advanced tab.
1. In the Advanced section, click the Environment Variables button.
1. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below:
C:\Program Files;C:\Winnt;C:\Winnt\System32
You want to add the following (make sure you have no spaces before or after semicolons:
C:\Program Files\xampp\php;C:\Program Files\xampp\mysql\bin;
''''' How do you know it worked? '''''
First open a command line window by going to the Run… choice on the start menu:
[[Image(image003.png)]]
and then execute "cmd"
[[Image(image005.png)]]
Enter the command:
{{{
pear config-show
}}}
If you see, output like the following, you know that you’ve set the environment variable correctly:
{{{
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir C:\Program Files\xampp\php
PEAR documentation directory doc_dir C:\Program Files\xampp\php\pear\docs
PHP extension directory ext_dir C:\Program Files\xampp\php\ext
PEAR directory php_dir C:\Program Files\xampp\php\pear
PEAR Installer cache directory cache_dir C:\Program Files\xampp\tmp
PEAR data directory data_dir C:\Program Files\xampp\php\pear\data
PHP CLI/CGI binary php_bin C:\Program Files\xampp\php\php.exe
PEAR test directory test_dir C:\Program Files\xampp\php\pear\tests
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 0
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin c:\gnupg\gpg.exe
Signature Key Directory sig_keydir C:\Program Files\xampp\php\pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename C:\Program Files\xampp\php\pear.ini
System Configuration File Filename C:\Program Files\xampp\php\pearsys.ini
}}}
= 5. Upgrade PEAR =
It’s important to upgrade PEAR at this point, because PEAR is used to install so many other things.
Type the following:
{{{
cd \progra~1\xampp\php
pear list-all | more
}}}
At this point you should see a list of all the PEAR packages that were installed with xampp. Your output should be something like this, and continue with all of the PEAR packages that were installed with XAMPP (a long list):
{{{
Retrieving data...0%....50%....ALL PACKAGES:
=============
PACKAGE LATEST LOCAL
pear/Archive_Tar 1.3.1 1.3.1 Tar file management class
pear/Contact_AddressBook 0.5.0 Address book export-import class
}}}
If you get an error at this stage, double check that you do not have apache, mysql, php, or pear installed anywhere else on your machine. For example, if you receive a "PHP Fatal error: Unable to open base address file in Unknown on line 0", this could signal that you have a previous install of MySQL, PHP, and Apache installed, possibly with an older package like !FoxServ. To correct such a problem, you would need to uninstall xampp (via the Windows control panel) and start back from step 2.
Type the following:
{{{
pear update-channels
}}}
You should get output like this:
{{{
Updating channel "pear.php.net"
Updating channel "pecl.php.net"
update-channels complete
}}}
Type the following:
{{{
pear upgrade pear
}}}
You should get output like this:
{{{
downloading PEAR-1.4.4.tgz ...
Starting to download PEAR-1.4.4.tgz (276,978 bytes)
.........................................................done: 276,978 bytes
upgrade ok: channel://pear.php.net/PEAR-1.4.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
To install use "pear install PEAR#featurename"
}}}
Unfortunately, in the process of updating the pear package, the pear configuration is somehow corrupted.
It seams that this is fixed in PEAR-1.4.6.tgz .... So skip correcting PEAR directories below untill "At this point, you PEAR directories should be reset"
Type the following:
{{{
pear config-show
}}}
In the following output you can see that the correct configuration from the xampp install has been overwritten:
{{{
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir C:\Program Files\xampp\php
PEAR documentation directory doc_dir C:\php5\pear\docs
PHP extension directory ext_dir C:\Program Files\xampp\php\ext\
PEAR directory php_dir C:\Program Files\xampp\php\pear
PEAR Installer cache directory cache_dir C:\WINDOWS\TEMP\pear\cache
PEAR data directory data_dir C:\php5\pear\data
PHP CLI/CGI binary php_bin C:\Program Files\xampp\php\php.exe
PEAR test directory test_dir C:\php5\pear\tests
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 0
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin c:\gnupg\gpg.exe
Signature Key Directory sig_keydir C:\WINDOWS\pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename C:\WINDOWS\pear.ini
System Configuration File Filename C:\WINDOWS\pearsys.ini
}}}
The configuration file locations and the doc_dir, cache_dir, data_dir, test_dir, and sig_keydir directory variables don’t make much sense on a Windows machine. These directories tell PEAR where to install packages. Why would we want to have half of our PEAR files in C:\Program Files\xampp\php\ and the other half under C:\php5?
Compare to the locations from the original XAMPP install, above.
To correct the PEAR directories, go to the command line and type:
{{{
pear config-set doc_dir “C:\Program Files\xampp\php\pear\docs”
pear config-set cache_dir “C:\Program Files\xampp\tmp”
pear config-set data_dir “C:\Program Files\xampp\php\pear\data”
pear config-set test_dir “C:\Program Files\xampp\php\pear\tests”
pear config-set sig_keydir “C:\Program Files\xampp\php\pearkeys”
}}}
At this point, you PEAR directories should be reset. You can upgrade the rest of the pear packages that came with XAMPP with the following command:
{{{
pear upgrade-all
}}}
You should receive the following output:
{{{
Will upgrade benchmark
Will upgrade html_form
Will upgrade html_progress
Will upgrade html_quickform_controller
Will upgrade html_table
Will upgrade html_template_it
Will upgrade html_template_sigma
Will upgrade http_request
Will upgrade log
Will upgrade net_geo
Will upgrade phpunit
Will upgrade system_command
Did not download dependencies: pear/HTML_Page2, use --alldeps or --onlyreqdeps to download automatically
Did not download dependencies: pear/PHP_Compat, use --alldeps or --onlyreqdeps to download automatically
pear/HTML_Progress can optionally use package "pear/HTML_Page2" (version >= 0.5.0beta)
pear/PHPUnit can optionally use package "pear/PHP_Compat"
downloading Benchmark-1.2.4.tgz ...
Starting to download Benchmark-1.2.4.tgz (7,587 bytes)
.....done: 7,587 bytes
downloading HTML_Form-1.3.0.tgz ...
Starting to download HTML_Form-1.3.0.tgz (14,742 bytes)
...done: 14,742 bytes
downloading HTML_Progress-1.2.5.tgz ...
Starting to download HTML_Progress-1.2.5.tgz (645,471 bytes)
...done: 645,471 bytes
downloading HTML_QuickForm_Controller-1.0.5.tgz ...
Starting to download HTML_QuickForm_Controller-1.0.5.tgz (16,413 bytes)
...done: 16,413 bytes
downloading HTML_Table-1.6.1.tgz ...
Starting to download HTML_Table-1.6.1.tgz (12,251 bytes)
...done: 12,251 bytes
downloading HTML_Template_IT-1.1.3.tgz ...
Starting to download HTML_Template_IT-1.1.3.tgz (19,314 bytes)
...done: 19,314 bytes
downloading HTML_Template_Sigma-1.1.4.tgz ...
Starting to download HTML_Template_Sigma-1.1.4.tgz (27,295 bytes)
...done: 27,295 bytes
downloading HTTP_Request-1.3.0.tgz ...
Starting to download HTTP_Request-1.3.0.tgz (13,808 bytes)
...done: 13,808 bytes
downloading Log-1.9.2.tgz ...
Starting to download Log-1.9.2.tgz (37,891 bytes)
...done: 37,891 bytes
downloading Net_Geo-1.0.1.tgz ...
Starting to download Net_Geo-1.0.1.tgz (6,468 bytes)
...done: 6,468 bytes
downloading PHPUnit-1.3.2.tgz ...
Starting to download PHPUnit-1.3.2.tgz (20,786 bytes)
...done: 20,786 bytes
downloading System_Command-1.0.3.tgz ...
Starting to download System_Command-1.0.3.tgz (5,162 bytes)
...done: 5,162 bytes
upgrade-all ok: channel://pear.php.net/System_Command-1.0.3
upgrade-all ok: channel://pear.php.net/HTML_Template_IT-1.1.3
upgrade-all ok: channel://pear.php.net/Log-1.9.2
upgrade-all ok: channel://pear.php.net/Net_Geo-1.0.1
upgrade-all ok: channel://pear.php.net/PHPUnit-1.3.2
upgrade-all ok: channel://pear.php.net/HTML_Form-1.3.0
upgrade-all ok: channel://pear.php.net/HTTP_Request-1.3.0
upgrade-all ok: channel://pear.php.net/HTML_Template_Sigma-1.1.4
upgrade-all ok: channel://pear.php.net/HTML_QuickForm_Controller-1.0.5
upgrade-all ok: channel://pear.php.net/HTML_Table-1.6.1
upgrade-all ok: channel://pear.php.net/Benchmark-1.2.4
upgrade-all ok: channel://pear.php.net/HTML_Progress-1.2.5
}}}
''''' How do you know it worked? '''''
You should check the pear configuration again with a “pear config-show” command to ensure that no directory locations have been corrupted; if everything the directory location have not changed, you’re ready to install Phing.
= 6. Install Phing =
Type the following:
{{{
pear install –a http://phing.info/pear/phing-current.tgz
}}}
You should get a result like the following:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Failed to download pear/VersionControl_SVN, version "0.3.0alpha1", latest release is version 0.3.0alpha1, stability "alpha", use "channel://pear.php.net/VersionControl_SVN-0.3.0alpha1" to install
Failed to download pecl/Xdebug within preferred state "stable", latest release is version 2.0.0beta4, stability "beta", use "channel://pecl.php.net/Xdebug-2.0.0beta4" to install
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
pear/PHPUnit2 can optionally use PHP extension "xdebug" (version >= 2.0.0beta2)
downloading PHPUnit2-2.3.3.tgz ...
Starting to download PHPUnit2-2.3.3.tgz (43,119 bytes)
...done: 43,119 bytes
install ok: channel://pear.php.net/PHPUnit2-2.3.3
}}}
The output is telling you that several dependent packages were not installed because the XAMPP pear configuration specifies to install stable code vs. alpha or beta code (which phing requires). PhpUnit2 was installed correctly, but other packages were not (please note that if you had not corrected the directory locations in the step above, PhpUnit2 would be installed in the wrong location instead of in the pear directory). If we run the same command again with the “-o” instead of the “-a” options we can ignore the optional dependencies (“-a” gets you all dependencies). But don’t bother with that like I did, you’ll just get this:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Did not download dependencies: pear/VersionControl_SVN, pecl/Xdebug, use --alldeps or --onlyreqdeps to download automatically
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
No valid packages found
install failed
}}}
At this point, we need to override our default settings and install the Phing dependencies manually. Going back to our message from the “-a” install of Phing, we can see that channels are specified. We can install them with the following commands:
{{{
pear install -a channel://pecl.php.net/Xdebug-2.0.0beta2
downloading xdebug-2.0.0beta2.tgz ...
Starting to download xdebug-2.0.0beta2.tgz (195,568 bytes)
.........................................done: 195,568 bytes
62 source files, building
ERROR: The DSP xdebug.dsp does not exist.
}}}
Since that didn’t work, try getting binary files. Go to the Xdebug site:
[http://www.xdebug.org/install.php]
Download the correct version of the xdebug DLL from this site and save it as C:\Program Files\xampp\php\
Add the following line to the C:\Program Files\xampp\php\php.ini and in C:\Program Files\xampp\apache\bin\php.ini and comment out the original line:
{{{
zend_extension_ts=“C:\Program Files\xampp\php\ xdebug-5.0-2.0.0beta1.dll” (use correct name)
}}}
If you don’t comment out the original line, you get:
[[Image(image021.png)]]
Getting back to the subject at hand, an attempt to install Phing again yields these results:
{{{
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
Failed to download pear/VersionControl_SVN, version "0.3.0alpha1", latest release is version 0.3.0alpha1, stability "alpha", use "channel://pear.php.net/VersionControl_SVN-0.3.0alpha1" to install
Failed to download pecl/Xdebug within preferred state "stable", latest release is version 2.0.0beta4, stability "beta", use "channel://pecl.php.net/Xdebug-2.0.0beta4" to install
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
No valid packages found
install failed
}}}
However, using phpinfo() in web browser, you can see that Xdebug is installed:
[[Image(image023.png)]]
I eventually just gave up and installed phing without dependencies:
{{{
pear install –n http://phing.info/pear/phing-current.tgz
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
.........................................................................done: 361,527 bytes
warning: pear/phing requires package "pear/PhpDocumentor" (version >= 1.3.0RC3), installed version is 1.2.3
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
install ok: channel://pear.php.net/phing-2.1.1
}}}
Install SVN package with:
{{{
pear install -o pear.php.net/VersionControl_SVN-0.3.0alpha1
downloading VersionControl_SVN-0.3.0alpha1.tgz ...
Starting to download VersionControl_SVN-0.3.0alpha1.tgz (33,829 bytes)
.........done: 33,829 bytes
install ok: channel://pear.php.net/VersionControl_SVN-0.3.0alpha1
}}}
Upgrade !PhpDocumentor with:
{{{
pear upgrade pear/PhpDocumentor-beta
downloading PhpDocumentor-1.3.0RC3.tgz ...
Starting to download PhpDocumentor-1.3.0RC3.tgz (2,711,672 bytes)
..............................................................................................................done: 2,711,672 bytes
upgrade ok: channel://pear.php.net/PhpDocumentor-1.3.0RC3
}}}
The XdebugOnWindows page shows you how to install Xdebug.
''''' How do you know it worked? '''''
Since Phing was installed with your upgraded version of PEAR, you know each step worked based on the "install ok" and "upgrade ok" messages.
== 7. Install symfony ==
The first thing to do is to add the 'symfony' channel:
{{{
pear channel-discover pear.symfony-project.com
}}}
To see the libraries available in this channel:
{{{
pear remote-list -c symfony
}}}
Now you are ready to install the latest stable version of symfony and all its dependencies with:
{{{
pear install symfony/symfony
}}}
Output looks ok:
{{{
downloading symfony-0.4.2.tgz ...
Starting to download symfony-0.4.2.tgz (1,199,762 bytes)
..............................................................................done: 1,199,762 bytes
downloading pake-1.0.76.tgz ...
Starting to download pake-1.0.76.tgz (16,523 bytes)
...done: 16,523 bytes
install ok: channel://pear.symfony-project.com/pake-1.0.76
install ok: channel://pear.symfony-project.com/symfony-0.4.2
}}}
Finally, for Symfony to work, you must also verify/update the following settings in the C:\Program Files\xampp\apache\bin\php.ini file:
{{{
register_globals = Off
magic_quotes_gpc = Off
}}}
If you intend on using short open tags (i.e or ) you must verify/update the following setting in the C:\Program Files\xampp\apache\bin\php.ini file:
{{{
short_open_tag = On
}}}
''''' How do you know it worked? '''''
Since symfony was installed with your upgraded version of PEAR, you know each step worked based on the "install ok" messages.
== 8. Create work directory and update apache config and hosts file ==
For the purposes of this guide, creat the c:\web directory to hold your symfony projects.
Update C:\Program Files\xampp\apache\conf\httpd.conf as follows:
{{{
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#default area for new web projects
ServerName web
DocumentRoot "C:\web"
#original xampp location
ServerName localhost
DocumentRoot "C:\Program Files\xampp\htdocs"
#allow access for the shared sf directory
Allow from All
#sample symfony project
ServerName askeet
DocumentRoot "C:\web\askeet\web"
DirectoryIndex index.php
Alias /sf "C:\Program Files\xampp\php\pear\data\symfony\web\sf"
AllowOverride All
Order allow,deny
Allow from All
}}}
Update C:\WINDOWS\system32\drivers\etc\hosts as follows:
{{{
127.0.0.1 localhost
127.0.0.1 askeet
127.0.0.1 web
}}}
''''' How do you know it worked? '''''
At this point, you don't. In the next step, you'll open your web browser go to !http://askeet and get a symfony welcome message. If there is a problem there, it could be a problem with this step.
== 9. Create a symfony project in your work directory (taken from the askeet tutorial) ==
In symfony, applications sharing the same data model are regrouped into projects. For the askeet project, we can already disclose the fact that there will be a frontend and a backend: that makes two applications. The project being the shell of the applications, it has to be created first. To do that, all you need is a directory and a symfony init-project command line:
{{{
cd C:\web\askeet
symfony init-project askeet
}}}
Now it is time to create the frontend application with the symfony init-app command:
{{{
symfony init-app frontend
}}}
''''' How do you know it worked? '''''
Restart Apache, and check that you now have access to the new application by going to !http://askeet/. You should get the following screen:
[[Image(image025.png)]]
== 10. Create an SVN repository for the project ==
In Windows explorer, make a directory where you would like the SVN repository to be.
Right click on the directory you just created, then scroll to TortoiseSVN > Create Repository here…
You should get the following pop-up window:
[[Image(image027.png)]]
Choose the file type you would like and click OK.
''''' How do you know it worked? '''''
You should get the following message:
[[Image(image029.png)]]
== 11. Import the project into the SVN repository ==
Go to your work area in Windows Explorer.
Delete the contents of the “cache” and “log directories.
Right click on the directory you just created, then scroll to TortoiseSVN > Import…
[[Image(image031.png)]]
Click on the button in the top right to browse for the location of the SVN repository that you just created.
Once selected, add a “/trunk” to the end of the file location.
Enter “initial import” in the Import Message field.
Click OK
''''' How do you know it worked? '''''
You should get output as follows:
[[Image(image033.png)]]
== 12. Start using the SVN files in your work directory ==
To use the SVN repository, we’ll actually want to checkout the files in an empty directory – SVN needs an empty directory to start.
Using Windows Explorer, rename your project directory from askeet to askeet.orig (keeping with the earlier example).
Create a new work directory named askeet
Right click on the directory you just created, then scroll to TortoiseSVN > SVN Checkout…
In the pop-up window verify that the “URL of repository” has the location of the SVN directory that you created; if not, browse and select it. Make sure you have /trunk added to the raw location.
Click OK and you should get the following window:
[[Image(image035.png)]]
When you go back to windows explorer, you should now see a green check mark next to the directory.
Delete the askeet.orig directory
Finally, go to window explorer, go to the C:\web\askeet directory. Right click on the “cache” directory and choose the ignore icon (a man with a blindfold) to ignore the cache directory. Do the same for the log directory.
Now, make sure to set the write permissions on the cache and logs directories back to the appropriate levels so that your web server can write to them again. In Windows Explorer look at the file properties and uncheck “Read-Only” then click “Apply”.
''''' How do you know it worked? '''''
If you got the expected output, that’s it. You’re done! You’ve gone from a fresh system to a working development environment that supports your symfony project.
Tuesday, July 21, 2009
Get rid of mysql sleep process/connections
Some times there are many many sleep processes in your SQL connection. These sleep connections consume a lot of resources (RAM, cache and processor). This can cause you mysql server slow down. If your mysql server is not responding then the query to the database will take a lot of time. In such situations, your website will open very slowly.
This is really frustrating for webmasters. Here, I will show you how can you get rid of these sleep processes.
What is sleep process and Why are there too many sleep process in mysql?
Sleep process are the connections waiting for new Mysql query. This can happen if the database connection is not closed properly. Or you are using mysql_pconnect() command in your php script.
$vi /etc/my.cnf
And add this line in my.cnf
wait_timeout = 60
This is really frustrating for webmasters. Here, I will show you how can you get rid of these sleep processes.
What is sleep process and Why are there too many sleep process in mysql?
Sleep process are the connections waiting for new Mysql query. This can happen if the database connection is not closed properly. Or you are using mysql_pconnect() command in your php script.
$vi /etc/my.cnf
And add this line in my.cnf
wait_timeout = 60
Monday, July 6, 2009
Jquery File upload
Hi
I worked on jquery Upload file.
below are the for for it
download API from http://www.uploadify.com/download/
Create file test.php
===== Code Start
Jquery Uploader
=====Code end
I worked on jquery Upload file.
below are the for for it
download API from http://www.uploadify.com/download/
Create file test.php
===== Code Start
=====Code end
Saturday, June 27, 2009
Monday, June 22, 2009
Linux date
Command for Linux Date : $ date +"%m-%d-%y"
Command for Linux Date/Time : $ date +"%m-%d-%y %T"
Command for changing Date time of linux: : $ date 062321542009 where 06:month ,23: day, 21: hour ,54: minut,2009: year
Command for Linux Date/Time : $ date +"%m-%d-%y %T"
Command for changing Date time of linux: : $ date 062321542009 where 06:month ,23: day, 21: hour ,54: minut,2009: year
for refrence: www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display
video to image converter in linux
FFMPEG is an awesome tool and today only i found that FFMPEG can extract JPEG image from video. To achieve this following are the software requirements.
Example:
fmpeg -i test.avi -ss 1.4 -vframes 33 -f image2 output%2d.jpg
Installing FFMPEG on Linux:
FFMPEG is an open source application that allows you to convert video and audio files easily between a variety of different formats. It supports most industry-standard codec and can convert from one file format to another quickly and easily. This article will guide you to installing FFMPEG and other codec on Linux.
Example:
fmpeg -i test.avi -ss 1.4 -vframes 33 -f image2 output%2d.jpg
Installing FFMPEG on Linux:
FFMPEG is an open source application that allows you to convert video and audio files easily between a variety of different formats. It supports most industry-standard codec and can convert from one file format to another quickly and easily. This article will guide you to installing FFMPEG and other codec on Linux.
FFMPEG Installation Requirements:
- FFMPEG
- LAME Mp3 Audio Codec (Requred for mpg, flv, avi, wmv etc files)
- AMR Audio Codec (Required for 3gp video files)
- XVID Audio Codec
- FFMPEG-PHP
Note on installing FFMPEG:
- All the Audio Codec getting used in FFMPEG are not part of FFMPEG Source base
FFMPEG Download URL:On the download page of FFMPEG they have geven the download link from SVN and checkout-snapshot but i would suggest to use SVN source code base. - FFMPEG Download Page FFMPEGThe url for the SVN source code for FFMPEG is: svn://svn.mplayerhq.hu/ffmpeg/trunk
To download from SVN you will have to install subversion located at subversion.tigris.org, or you can use “TortoiseSVN” located at tortoisesvn.tigris.org. - LAME Mp3 Codec download URL: Lame Mp3 Codec
- AMR Audio Download URL: AMR Audio Codec
- To install the AMR codec you will require both AMR-WB and AMR-NB files.
- XVID Audio Download URL: XVID Audio Codec
- FFMPEG-PHP Download URL: FFMPEG-PHP
Installation Steps: - It is a good practice to install all the external audio codec libraries first and then install the FFMPEG.
Installing LAME MP3 Encoder - Untar the lame file by using tar zxvf lametarfile
- Assign 777 permission rights to the lame folder by typing chmod 777 lamefolder -R
- Traverse to the root of lame folder and type./configuremakemake install
Installing AMR Codec - For installing the AMR codec there are two separate files that needs to be installed are AMR-WB and AMR-NB.
- Untar the AMR file by using tar zxvf tarfile
- Assign 777 permission rights to the amr folder by typing chmod 777 amrfolder -R
- Traverse to the root of amr folder and type./configuremakemake install
Note on Installing AMR:You might get errors installing AMR codec on Autoconf utility of linux. To resolve this problem will have to install the latest version of Autoconf utility from Download AutoConf
Installing Xvid Codec - Untar the xvid file bu using tar zxvf tarfilename
- Assign 777 permission rights to the lame folder by typing chmod 777 xvidfolder -R
- Traverse to the root of xvid folder
- Goto Build/generic folder and type./configuremakemake install
Installing GCC - This is required only if the SVN for FFMPEG is not compatible with the existing version of GCC(3x) requires a new version for the same
- After the installation of GCC need to convert all the files of SVN to Unix compatible by using “dos2unix ffmpegfolder/* -R”.
Installing FFMPEG - Download the ffmpeg from SVN
- Assign 777 permission rights to the ffmpeg folder by typing chmod 777 ffmepgfolder -R
- Traverse to the root of ffmpeg folder and
- type ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
- make
- make install
Installing FFMPEG-PHP
- Download the ffmpeg-php from Sourceforge
- Unpack the archive by using following command “tar -xjf ffmpeg-php.X.XX.tar.gz”
- Iterate inside the ffmpeg-php directory
- Run phpize (included with your php install) to build configuration files./configuremakemake install
NOTE FOR FFMPEG-PHP:If you are planning to install FFMPEG-PHP then will have to add –enable-shared parameter while configuring FFMPEG
You might get installation error while making the file related to html or texti files in ffmpeg\doc folder. The solution for this that worked for me is to just create a empty file by using touch command in the respective folders.
Note:The following configure parameter will work with FFMPEG 0.49. But now the latest version does not have –enable-libogg parameter so if you are planning to installing the latest version then the configure parameter would be /configure –enable-libmp3lame –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared.
Note on Reinstalling FFMPEG:If you are planning to reinstall the FFMPEG software the will have to perform following steps:
- ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
- make clean
- make
- make install
Lot of people are facing error on loading shared libraries libavdevice.so.52, solution to the same is:export LD_LIBRARY_PATH=/usr/local/lib/
Thursday, June 18, 2009
Upload big files
Hi,
For uploading big files we have to make some changes on php configuration.
max_input_time 6000
max_execution_time 6000
post_max_size 300M
upload_max_filesize = 300M
memory_limit = 32
You can do it using .htaccess
php_value max_input_time 600
php_value max_execution_time 600
php_value post_max_size 200M
For uploading big files we have to make some changes on php configuration.
max_input_time 6000
max_execution_time 6000
post_max_size 300M
upload_max_filesize = 300M
memory_limit = 32
You can do it using .htaccess
php_value max_input_time 600
php_value max_execution_time 600
php_value post_max_size 200M
Mounting NT Server with Linux
mount -t cifs //IP/scryptionsdms /mnt/scryptionsdms -o username=apache,password=apache,uid=apache,gid=apache
Wednesday, June 17, 2009
I’ve used putty for all my ssh needs on windows for a long time now. It’s great but certainly lacks a little polish in some areas.
The one feature I really wanted was tabbed sessions. After a little searching I came across a comment on this post that mentioned an open source alternative called poderosa. I just got round to downloading and I must say that so far it looks great.
The only potential downside is that it relies on the .net framework (which I’d so far managed without) so it’s not quite as light weight as putty but good none-the-less.
The one feature I really wanted was tabbed sessions. After a little searching I came across a comment on this post that mentioned an open source alternative called poderosa. I just got round to downloading and I must say that so far it looks great.
The only potential downside is that it relies on the .net framework (which I’d so far managed without) so it’s not quite as light weight as putty but good none-the-less.
Monday, June 8, 2009
Mysql Issue
Hi All,
We are having one issue which I want to share with you.
We are using Mysql 5 Enterprise Edition from last one year.
We are heaving some confusion/problem when we are quering to our database.
We have a "client" table and there is a integer field "ID"in database.
We are searching a record using the query give below. its giving wrong result set.
"Select * from client where id='11109C'"
This type of query giving us result of record where id equal to"11109" Which should not be there in the result Set
We are having one issue which I want to share with you.
We are using Mysql 5 Enterprise Edition from last one year.
We are heaving some confusion/problem when we are quering to our database.
We have a "client" table and there is a integer field "ID"in database.
We are searching a record using the query give below. its giving wrong result set.
"Select * from client where id='11109C'"
This type of query giving us result of record where id equal to"11109" Which should not be there in the result Set
Subscribe to:
Comments (Atom)