Sunday, April 17, 2011

How to : Free php development environment for windows pcs

Before we can start working right, we should set ourselves a suitable development environment (IDE). Although this is not mandatory, but the work much easier. The development of PHP scripts and web pages can also be done using simple text editors, but we do not give up convenient functions and features of development environments.

As an IDE for PHP, HTML, JavaScript and CSS we will use Eclipse. Eclipse is free, is updated regularly and has many features with it. For our project must be equipped with the Eclipse PDT extension. PDT stands for PHP Development Tool ". The PDT does so in a proper Eclipse PHP development environment.

INSTALL

To install Eclipse, the latest version of Java is required. Java is now installed on almost all systems. If on your PC, this is not the case, you'll Java here and install it.

We come straight to the point, we will have a version pre-installed with Eclipse PDT began. These can be directly from the Zend Web site download. When you download the all-in-one package (Eclipse + PDT) mode.

After downloading, unzip the archive and start eclipse.exe. When you first start Eclipse asks for the path of the workspace. I choose the best "htdocs" directory of XAMPP. XAMPP was installed in the second part of the tutorial and set up. This has the advantage that the projects can be created directly debugged without having to continually specify in the Apache configuration, the path of the PHP scripts must have.

Eclipse set

Before we build the first project, we should make a few settings in Eclipse. We click on Window -> Preferences. In the category of PHP -> PHP Executables we must add the path to our php.exe. With the click on "Add" to open the input screen. Enter any name, select the path and as a PHP Debugger XDebug "option. The completed entry form should look like this:
The drive letter must correspond to your course, depending on where XAMPP is installed. The settings with OK. Then must be our entry under the PHP executables be shown:

In the second step, we give Eclipse yet known to the local Web server. Simply click on PHP server, also in the category and add PHP to New new server. When we enter http://localhost URL and enter a name:

 So that we can debug with Eclipse, we need to set the debugger. The settings can also be found under PHP. If we choose PHP debugger XDebug, with server and PHP executables we choose you what we have just set.


If selected "Break at the First Line", Eclipse automatically sets the first breakpoint on the first line in the PHP script.

Have all your settings, we can create a new project and test the debugger.

Debugging Projects

When debugging with Eclipse, we must distinguish between two types of projects. This is a stand-alone are PHP scripts. These scripts can be executed directly. On the other hand, there are scripts that are not only running. They need to run such as a Content Management System (CMS) to be able to. These include WordPress Plugins and Themes, Joomla modules and components, etc. This distinction is important because you have to make debugging different settings.

First we will create a new project. We click on File -> New -> Project, select PHP Project and click Next. Then enter the name and click Finish.


If Eclipse asks if you want to go to the PHP perspective, simply press Yes.


The new project is created, then we should add a PHP file. Click the right mouse button on the project folder and New -> PHP File menu. Enter name (index.php) and click Finish.

For testing we take a very simple script which only one variable is incremented and dumps the contents.

For the script now needs a debug configuration can be created by clicking on the arrow next to the Beetle, and then click "Debug Configurations .." button.


It opens a new window, which manages all the debug configurations. Since we now want to debug a stand-alone script, we click the right mouse button on "PHP Script" and select New to create new configuration.

Set Eclipse "In the chapter we have already made global settings that are used as the basis for each project.

The settings should actually be on, if not, we provide the following:

When we use XDebug debugger and PHP executables we select XAMPP. In PHP file we need to select the file, we want to debug. Then click Apply to save the configuration. If you also want to start debugging immediately, click on Debug.

Now the script is ready to be debugged. Just click on the beetle. Eclipse will now go into the debug perspective, and the execution of the script we started. The execution is stopped in the first line if it has been selected in the configuration "Break at First Line."

The script can now be easily debugged.

The difference for debugging stand-alone script is only in the Debug configuration. Here I create a configuration for PHP script, but for PHP Web Page.

When debugging of WordPress plugins do you choose among the index.php file of WordPress, breakpoint in the plugin PHP file and starts the debugging process.

Well, everyone should be able to debug PHP script, website, etc. with Eclipse on Windows.

No comments:

Post a Comment

LinkWithin

 
coompax-digital magazine