Saturday, February 28, 2009

Eclipse for PHP Development

Eclipse is a very good IDE provide by eclipse.org for all the platforms. It also supports PHPIf you are working on big PHP Applications it is a very helpful tool for you.
There are many good features in this for developers. It also supports many add-ons and plugins to make life easier.
2 of my very favorite add-ons are XDebug and SVN.
The thing I miss in this is and HTML editor like Dreamweaver, but looking at the positive things it is a great tool

XDebug for PHP debugging

XDebug is an excellent debugger for PHP applications. It gives a good descriptions of error which occur during development.

Another good feature of XDebg is that it easily integrates with IDE's like Eclipse PDT.

I'll be adding more on configuring XDebug on your server and with Eclipse in my next posts. You can visit www.xdebug.org to know more about this tool.

Which PHP.INI am I using?

You edit some things in your php.ini but they are not reflected on your site. You restart Apache but no change and it makes you frustrated.
It happens because there are many php.ini's in the system based on the packages you are using. To know exactly which php.ini is current do the following:
make a new php file, call it info.php. in this write the following:
phpinfo();
?>
save it and run it. It will display details about your server, PHP and extensions etc.
find string Loaded Configuration File in the file. It will display the path of loaded php.ini in the system.
Now make changes to it and it will reflect on your site.

Sometimes when you run PHP from command prompt your find problems in extensions which are enabled in your php.ini. It happens becasue if you are running PHP commands from command prompt the php.ini used is different. It is stored in the directory of your operating system for example c:\windows\php.ini. Make chagnes here if you are runing PHP from command prompt.

Changing PHP version in XAMPP

This a a very good feature of XAMPP. You can easily switch the version of PHP between 4 and 5 in it. Although PHP 4 is not provided in XAMPP 1.7.0, but in previous versions you can use this feature. To do this in windows go to start> run and type cmd in the box and click ok.
here change drive to \xampp\
Now run command php-switch.bat
It will ask to stop apache first to do that run apache_stop.bat
Now run command php-switch.bat
it will display the version of PHP you are running and a menu showing options to change the version or x for exit.
If you are running version 5, type 4 to change the version to PHP 4 and click enter. It will change your PHP version to php 4.
Do not forget to restart apache by running apache_start.bat
Now you are using PHP 4 on your PC.
Follow the same steps to switch back to PHP5.
If you find any problem please feel free to contact me.

XAMPP the fast and convenient LAMPP installer

XAMPP is a package which contains all applications required to build open source application on your computer. It contains PHP, MySql, Apache, PERL, SSL Support, Mod Rewrite, PEAR and many other utilities to make the installation easier.

It also provides phpMyAdmin in a virtual directory outside htdocs to manage MySql data.

The package comes for Windows, Linux and other OS like Mac, Solaris etc.

If you are installing it on windows, it is preferable to install it on non os partition of your pc. It will store all the data there and you can format your OS partition anytime you want.

All the web contents will go in htdocs folder of your installation. The path for this will be /xampp/htdocs

One good feature is that you can easily switch your PHP veriosn in it from 5 to 4 or 4 to 5. It really helps to test applications on both the versions. To do this all you need to do is to run /xampp/php-switch.bat. /xampp folder provides many other utilities like apache_start.bat, apache_stop.bat, mysql_start.bat, mysql_stop.bat etc.