Can I debug PHP files under Eclipse PDT without using Apache? - php

I have just installed Eclipse PDT 3.0.2 (I don't know what Eclipse base this is, Galileo or Helios), and have been enjoying the step up from NetBeans. In getting more serious about my PHP development (I have recently expanded from only ASP.NET), I decided to move from editing my PHP files directly under my Xampp Apache doc root (htdocs), and have created a workspace under my usual source location, c:\development.
It seems to me, from what I have been able to quickly glean from all the horribly disparate resources on debugging PHP files under PDT, that the files need to be debugged under Apache, and thus copied to htdocs. Is there a local debugging option that doesn't require deployment or a PHP server, and how do I get closer to using this type of debugger?

I know nothing about Eclipse but I have a strong feeling that you simply want to be able to configure more than one site with Apache, so you can work on a private copy of your project while you host a live release in the same computer.
I suggest you have a look at the Name-based Virtual Host Support chapter in the Apache manual. You can create local domain names in your system's hosts file. Additionally, you can use different local IP addresses (127.0.0.1, 127.0.0.2, 127.0.0.3...) or different ports.
You also mention you've been coding ASP.NET in the past. It's worth nothing that PHP runs fine in almost all web servers, including IIS. You don't need to install Apache and I'm pretty sure that Eclipse doesn't care about your server's vendor.

It seems to me […] that the files need to be debugged under Apache, and thus copied to htdocs.
No, you can do what I (and probably thousands of other developers, as the other answers indicate) do:
Leave your development files in your home directory, where they belong, and configure your local Web server so that the DocumentRoot for a name-based virtual host is your development root (or a subdirectory of it).
The minimum Apache configuration would look like so:
<VirtualHost *:80>
ServerName localhost
ServerAlias 127.0.0.1
DocumentRoot C:/development/
<Directory "C:/development">
# helpful if you want to browse your files
Options +Indexes
</Directory>
</VirtualHost>
The line
127.0.0.1 localhost
should be in your hosts file already, so you should not need to make any changes there. (However, if you think you need another hostname alias, just go for it. I have currently defined 3 additional ones for testing purposes.)
The Apache manual and other default Apache resources should still be available then by default (here: http://localhost/manual/ etc.). For example (I am on Debian GNU/Linux here, so I do not know the exact XAMPP paths):
Alias /manual "C:/Program Files/XAMPP/apache/manual/"
<Directory "C:/Program Files/XAMPP/apache/manual/">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
AddDefaultCharset off
</Directory>
(It says so – in Linuxese, of course – in my default /etc/apache2/conf.d/apache2-doc.) See the excellent XAMPP documentation for details.
Is there a local debugging option that doesn't require deployment or a PHP server, and how do I get closer to using this type of debugger?
I do not understand that question. There is no "PHP server". There is Zend Server – do you mean that?
If you want to debug PHP scripts for a Web server like Apache, you need to run PHP on that server. In the case of Apache, either as an Apache module, as a CGI handler, or under FastCGI. You only do not need a server if you are developing CLI-PHP scripts. The XAMPP installer should have set that up for you already.
Assuming from your posting that you want to debug PHP scripts that should run on Apache with the PHP module (run a PHP script with <?php phpinfo(); to be sure; I just do not have active PHP debugging experience with anything else), you can configure PDT so that it uses Remote Debugging with the above local virtual host. For that, you also need a server-side debug module for PHP, for example Xdebug or Zend Debugger (the debug clients for both are included in PDT). I had been using Zend Debugger before, but now I am using Xdebug (with PDT 3.0.0v20110516-… in Eclipse 3.7.1 ["Indigo" SR1, released September 2011]¹) because it is free software, packaged with Debian, and highly configurable and capable even though it is for free as well.
This article helped me in particular: PHP remote debugging with Xdebug and Eclipse PDT.
See the Xdebug documentation for more (e. g., independence of client IP addresses).
However, a wealth of information about PDT and debugging with PDT can be found at the PDT Downloads site.
Bottom line: If you are debugging on localhost, you do not have to deploy your code because you have deployed your code already, just by having it in or below the DocumentRoot. Eclipse PDT does not care where the remote code is located; it only accesses a resource via an HTTP URI. If that starts with http://localhost/, so be it :)
(Copying the resources around carries with it the risk of inconsistencies and accidentally overwriting Apache files, so do not do that.)
¹ There is no PHP package for Eclipse Indigo, but you can start e. g. with Eclipse 3.7.1 Classic and install PDT on top of it using the Update Manager. Just select the "Indigo" (or whatever) repository, then "PHP Development Tools" under "Programming Languages". Dependencies should be resolved automatically. See also PDT/Installation.

I don't remember if Eclipse has a local PHP debugging option or not. But I think Zend Studio (which is based on Eclipse PDT) comes with its own PHP binaries. I've never tried to use them though.
Your best bet is to create a new workspace, which I explained how to do here: publishing php files from eclipse to apache htdocs
If you need to setup vhosts (Virtual Hosts) on your XAMPP installation, this is a great and easy to understand tutorial.
If you want suggestions to alternative IDEs then I would go with Zend Studio ($299) or Rapid PHP 2011. While I've never used Rapid PHP 2011, it does look somewhat promising, has many of the same features as many popular IDEs including debugging. Note that in my opinion, it appears to be not quite as professional as Eclipse/Zend (which, again, is why I always recommend those two above others).

I assumed the question was more about 'can I debug in PDT a CLI script'. If that's the case then, yes, you can.
All you have to do is edit the PHP.INI file that your CLI is using and make sure that XDebug is enabled for the CLI and that xdebug.remote_autostart is set to 1. It's quite possible that the CLI PHP is using a different INI file from Apache, so be sure that you're using the correct one.
Finally, in PDT click 'Debug Project' and debug it as a web script, even if it isn't. The important thing is that you essentially are telling PDT to start listening. Once that's done, you should be able to run the script from the CLI and have PDT kick in at the appropriate time. The xdebug.remote_autostart is key, though.

Related

Debugging php applications on folders different than 'xampp/htpdocs' with PhpStorm

I know this may be a long and general question but I am struggling with it for the past two days and have achieved nothing.
I am a C# .net developer and I use Visual Studio IDE for my development which does all the back-end work for me when creating projects, setting virtual hosts, publishing the project and etc.
Now for some reasons I have to do a project in PHP and I chose PhpStorm as my IDE. I installed XAMPP and the Apache server is working ok, and I set its' php executable as an php interpreter in PhpStorm.
I don't want all my projects to be in xampp/htpdocs so I choose another location (d:\projects\phpStorm\<name of the project>) as my working space when I first created a project.
I installed xdebug using the tutorial it gave me:
Download php_xdebug-2.4.0rc4-5.6-vc11.dll
Move the downloaded file to C:\xampp\php\ext
Edit C:\xampp\php\php.ini and add the line
zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.dll
Restart the webserver
And I can confirm that it is installed using phpinfo() in a php file located in xampp/htpdocs.
My problem is with the debugging. When I click Run->Run in an opened php file in PhpStorm, it uses a free port and opens the php file with a url like this: localhost:port_number/<name of the project> and everything is ok.
Now I followed this tutorial to configure the xdebug. In step two, when I go to Run->Web Server debug validation, fill the Path to create validation script with d:\projects\phpStorm\<name of the project> and Url to validation script with localhost:port_number/<name of the project> (as mentioned above) and click validate I get this information (and an error in the last line):
Server Name: PhpStorm 10.0.3
Loaded php.ini: C:\xampp\php\php.ini
No debug extension is loaded
Follow this links to configure Xdebug or Zend Debugger. If you have
already configured debug extension in php.ini file check possible
reasons why it was not loaded:
You forgot to reload web server after changes in php.ini file.
You are configuring debug extension in the wrong php.ini (see the
loaded php.ini files below).
There are errors on attempt to load debug extension, e.g. version
incompatibility.
I want to know what should I do?
I really really want to set my projects in another location other than xampp/htpdocs to organize them properly, just like I do it in Visual Studio. So please don't suggest solutions involving me changing my working directory.
Thanks in advance.
P.S.: In JetBrain's tutorial, I see that the xdebug's IDKEY is PHPSTORM whereas mine is my pc's username, it it ok?
I really really want to set my projects in another location other than xampp/htpdocs to organize them properly, just like I do it in Visual Studio. So please don't suggest solutions involving me changing my working directory.
Well you're really going to hate this then, but unfortunately Apache (which is what php runs on) only recognizes htdocs (or public_html, or www, depending on what specific server you are running, but anyhow in your case only htdocs) as a valid directory for php execution. Sooooo...
That doesn't really mean this is hopeless, but you might have to jump through some silly hoops to get it to work this way.
Option 1
You may have some luck creating a symbolic link from .htdocs to your projects folder from the command line:
ln -s C:xampp/htpdocs d:/projects/phpStorm
If you're on windows, this probably won't work. It also likely won't work between drives. It also may not work depending on your Apache configuration in XAAMP.
PROS: If it works, will do exactly what you want.
CONS: Probably won't work, if it does, will require nightmarish levels of config fiddling
Option 2
Use a remote development server, and sync over FTP with your IDE. I'm not super familiar with PhpStorm, but I can pretty easily do this in Netbeans or Eclipse. This is a good option when you need a local archive of a project retained. You might be able to set up an FTP server on your machine and accomplish this, however you are going to wind up with two copies of your project; one in your projects folder and the other in htdocs.
PROS: Your projects stay organized where you want them without much issue.
CONS: File duplication, they will have to be in htdocs anyhow for Apache to run php
Option 3
Accept that the technology is not designed to work this way and just put everything in htdocs where it belongs. Resisting the way technology works because you are used to a different workflow is how design flaws and really bad bugs happen. Use it the way it was meant to work and don't be scared of learning new things.
PROS: No conflicts with the XAAMP stack whatsoever
CONS: You specifically stated you don't want to do it this way, but this is really the best way
Option 4 (Don't do this)
Install PHP as a globally accessible command line utility across your entire system, and consequently get all kinds of crazy viruses and errors that you may not be able to fix ever.
PROS: Minor alleviation of aggravation with foreign workflows
CONS: All of the things. The worst things.
Option 5 (probably not going to work)
Try using VirtualHosts. There's a bunch of caveats with this though. First, doing this between different drives is nearly impossible to configure correctly due to security policies in your operating system that are difficult to overrule. Second, if you're on Windows (I assume you are if you are using XAAMP), you need to do all of the following:
-In apache.conf, you need to enable your hosts file.
-In the vhosts file, you need to create a new vhost.
-In the windows hosts file, you also need to create a host, because for whatever reason windows likes to arbitrarily add redundant steps. On every other OS, this step is not neccessary. Also, you need to run your text editor as administrator to even do this at all.
-Restart apache when it's all set up
-Pray your machine will let you do this between drives (C: -> D:), or not take a million years to enable.

How to install multiple XAMPP versions OR Multiple PHP versions on MAC OS X 10.7 Lion

I need to do some work on a legacy system that requires PHP 5.2
I already have XAMP 1.7.3 installed but this version has PHP 5.3.
Since this a work I might do for a couple of times in the next months, I was thinking about installing a XAMP version that runs PHP 5.2
At the same time I'm involved into some work that requires me to use PHP 5.3, so I just can`t uninstall my current XAMP version and install one that uses PHP 5.2
On XAMPP Download Website it's pretty clear that on installing any XAMPP version it will remove previous one. I've done some research but couldn't find a way to get around this.
I managed to find phpswitch under /Applications/XAMPP/xamppfiles/bin/ and using it's list action showed me that I only have PHP 5.3.1 installed and active. I tried to figured out on how to download/install/activate PHP 5.2 using phpswitch but had no success.
So what I'm looking for is a way to install multiple XAMPP or installing PHP 5.2 and activating it for XAMPP (either through phpswitch or another way)
You can install parallel versions of XAMPP - one for each major version of PHP. Just don't run both at the same time.
Install each instance of XAMPP in it's own folder.
I do this under a folder called
XAMPPInstalls/XAMPP182-PHP54
/XAMPP183-PHP55/
In each XAMPP folder, you'll find an .exe to launch the controller for that specific XAMPP stack. I've created shortcuts to those, renamed them to 'XAMPP182-ControlPanel' and 'XAMPP183-ControlPanel' and placed those on my desktop.
When I need to run local site on PHP5.4, I click on XAMPP182-ControlPanel and fire up the Apache and MySQL servers.
When I need to switch a local site to PHP5.5, I click on XAMPP182-ControlPanel and shut down the Apache and MySQL servers, then I click XAMPP182-ControlPanel and fire up the Apache and MySQL servers in that stack.
This takes just a few seconds.
Also, I use 'soft-linking' so that I do all my configuration for my local web sites in one folder - then create a 'junction' (i.e. a source folder that replicates itself in the Apache configs for each XAMPP stack).
There is a really good article on this called 'Practical Development 2: Working Environment' by Marco Dings in the Joomla! Community Magazine on how to set up your work environment to run multiple local XAMPP installs, multiple local web sites using 'name based hosting,' and how to keep it all organized.
I don't use Ding's set-up exactly - I've tweaked to get my local web projects even more organized and streamlined - but my set-up is based on Ding's approach.
NOTE: The article, while in the Joomla! Community Magazine, is not specific to Joomla!, so you can use this set-up for whatever PHP/Apache/MySQL projects you are working on.
Now there are lots of ways to do this (e.g. using Oracle's VM Virtual Box), but that might be overkill unless you need to replicate your remote hosting environment 'exactly.' For example, if you are running a 'dedicated host' and want to closely replicate dedicated host's environment and set up as closely as possible, then you'd go with VM Virtual Box Set-Up - this allows you to run multiple VM's (i.e. different set-ups) and then clone the exact set-up to your live server. Again, overkill if most of your projects are going to 'shared hosting' environments as you don't have much control over the set-up anyways.
Parallel installation of multiple instance of XAMPP is much much much simpler and you can set it up as per Ding's article. It should cover your requirements.
I've mentioned Oracle VM VirtualBox because you should at least know about it as an option.
You could always use VirtualBox (or similar) to create an instance with 5.2 on it and then when you're done with old work, just dump the VB instance with no ill affect on your current system.
You have a couple of options. Either use a virtual box to run virtual environments: one with PHP 5.2 and another with PHP 5.3. Or, if you're comfortable with installing PHP you could install the various version of PHP you need, and set up a symbolic link to the version you want to use at that time.
I don't know anything about Apache or PHP, but I find MacPorts helpful for installing multiple versions of software that is usually difficult to install multiple versions of, such as python or GCC.
port search php
shows that MacPorts can provide PHP 5.2, 5.3, and 5.4. Such installations are put into /opt, so they will leave any other PHP installations alone.
I just want to add in case you run any os (mine is Yosemite) do the same but working on the xamppfiles folder inside the main XAMPP folder (so the path to work with is different), you can both then change configure.ini and possibly file related (complicated) or (easy but dirty) name the version you want to use xamppfiles and the other whatever, and then create 2 separate alias for the manager to start (one for each xampp version). Like this is a little confusing but if someone needs it I can describe both approaches step by step.
Previous answers didn't work well for me, but there's a rather elegant solution over on the Apache Friends Forum, though it took me a bit to get things working properly. Some highlights:
By installing multiple versions of XAMPP, you can get various versions of the PHP CGI module. That said, keep in mind that your config files and databases may need to be restored if you run multiple installers, so backup and plan accordingly.
Make sure that those CGIs are allowed to do their thing by adding a block something like this in your httpd-xampp.conf file (I put mine at the end):
<Directory "/Applications/XAMPP/xamppfiles/bin">
Require all granted
Options +ExecCGI
</Directory>
Keep in mind that depending on the version of Apache that XAMPP is using, your syntax may vary a bit.
Now find this section in your httpd.conf file and make sure the corresponding Include is uncommented, like so:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
You can now add entries in your httpd-vhosts.conf file for each version of PHP that you want to use, something like this:
<VirtualHost test54.yourdomain.com:80>
ServerName test54.yourdomain.com
....
ScriptAlias /xampp-bin /Applications/XAMPP/xamppfiles/bin
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
Action application/x-httpd-php /xampp-bin/php-cgi-5.4.31
....
</VirtualHost>
<VirtualHost test55.yourdomain.com:80>
ServerName test55.yourdomain.com
....
ScriptAlias /xampp-bin /Applications/XAMPP/xamppfiles/bin
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
Action application/x-httpd-php /xampp-bin/php-cgi-5.5.35
....
</VirtualHost>
....
(In the version of XAMPP that I use, there also happens to be a symbolic link in that bin directory called simply php-cgi which points to the most recent CGI installed, and I add a block for that, too.)
Add corresponding entries to your hosts file, like so:
127.0.0.1 test54.yourdomain.com
127.0.0.1 test55.yourdomain.com
That should do it. I love the resulting flexibility, and the fact that the various versions of PHP that I have configured as simply available when I need them.
We can use Xampp-VM for multiple xampp installation. I wanted to use multiple php versions for older and new projects without changing or wasting my time in configuration.
So If your Xampp is already installed. Install new Xampp-VM from here
https://www.apachefriends.org/download.html
This will guide you, how to setup Xampp-Vm.
https://www.apachefriends.org/blog/new_xampp_20170628.html

PHP 5.3 - getting it to run on Apache server?

I've set up my own Apache server; with MySQL, PHP and PHPMyadmin.
It used to work previously when I did it before on various computers; but that was the older versions I dealt with, not the latest. However, it's been a while since I've updated my PHP version, so that's why I'm asking this.
What configuration changes do I need to make to get 5.36 to work properly with Apache?
Currently any .htm files can display properly in http://localhost, but no .php ones.
All I see is a text file, so what's gone wrong with this?
The server is not public - in fact, it's on a Windows Vista Home Edition install, and it's a development one. I don't need to worry about anything else just yet, as this is a totally new install.
What config changes do I need to make?
I tried:
# mod_php5
Include conf/extra/suite-php5.conf
but that didn't work, so what's the solution with PHP 5.36?
Should I re-enable the above line (it's currently commented out with the # symbol).
So far the server works; but it's not serving up PHP pages, which is strange.
Anyone got any ideas why? I would gladly appreciate your help!
Won't post the httpd.conf since it's being developed right now though.
No more VC6 versions of PHP 5.3.x?
From the release announcement:
Windows users: please mind that we do no longer provide builds
created with Visual Studio C++ 6. It
is impossible to maintain a high
quality and safe build of PHP for
Windows using this unmaintained
compiler.
For Apache SAPIs (php5_apache2_2.dll), be sure that you
use a Visual Studio C++ 9 version of
Apache. We recommend the PHP builds as
provided by ApacheLounge. For any
other SAPI (CLI, FastCGI via mod_fcgi,
FastCGI with IIS or other FastCGI
capable server), everything works as
before. Third party extension
providers must rebuild their
extensions to make them compatible and
loadable with the Visual Studio C++9
builds that we no longer provide.
Check your config files for http and php. I haven't done this in a while, but you need to add the file type .php to list of files types that you want Apache to serve. READ the config file carefully.
Also, inside your http config file there should be some additional lines that tell Apache where to find php, vis-a-vis the php.ini file. You need to set up your path information inside the config file and in the environment/system variables section of your Microsoft OS.

How to get Visual Studio Development Server to work with PHP?

I'm a .NET specialist working with a PHP/Flash programmer to deliver an app via IIS. After jumping through 17 hoops of fire and defeating a gargoyle in a gruesome battle to the death, I managed to get my IIS 7.5 server to cooperate with PHP, and now if you browse to my public web site, you can see the Flash objects happily doing their behind-the-scenes stuff with PHP, whatever that may be.
But... when I'm debugging my app using the VS Development Server, that still apparently doesn't know how to cope with PHP: I'm getting the same HTTP 405 (Method Not Allowed) errors that I was getting on IIS before aforementioned gargoyle breathed its last ("The HTTP verb POST used to access path '/php/blah.php' is not allowed.").
So, what do you have to do to get the VS Dev Server to play nice with PHP?
My PHP Debugging Setup
I'm a .NET developer who has been swimming in the PHP pool for the past few months.
Spoiled by the VS.NET IDE, debugger, and strongly typed platforms, I was determined to create a PHP development environment that closely resembles my .NET debugging experience.
NOTE: It may be easy to setup PHP debugging in IIS for new PHP applications. However, the steps listed below break down some very involved steps as I found required to debug in WordPress and Joomla. Only follow these steps if you aren't having any luck with getting debugging to work.
Disclaimer:
The full set of steps to complete this setup are quite involved. I'm throwing this together ad hoc in hopes it will help others in need of setting up a professional development environment with little background in Linux based systems.
These steps are not guaranteed to work and may be very sensitive to environment settings. I spent a lot of time going through the effort of trial and error until I got this working.
Along the way, I have to give credit to a few good online resources you should review to get started. These do not address debugging or development setup. I'll provide details below.
Step by Step Guide: Installing XAMPP and WordPress on Windows
Since I'm new to posting here, I can't add more than one link. Just Google the following references:
- Google: sixrevisions tutorials web-development-tutorials using-xampp-for-local-wordpress-theme-development
Securing Your XAMPP Installation
Google: robsnotebook xampp-builtin-security
DEVELOPMENT SETUP
WAMP Stack vs IIS for PHP:
First, I did not use IIS to host my PHP application. I wanted to keep these web servers separate and use one of the available WAMP Stacks to develop against. This allowed me to manage and study configuration settings that would be used on Apache and Linux. If I was deploying the PHP App to a Windows host, I would have chosen an IIS setup. Again, this was a choice based on creating similar configured environments with a Linux host.
What is WAMP Stack?
For those unfamiliar, a WAMP Stack stands for a distribution package of Apache, MySQL, and PHP running on Windows. Other flavors include LAMP (for Linux), MAMP (for MAC), and others. There are several flavors within the community that provides WAMP Stacks to work with. I originally found BitNami interesting to work with. However, I was not happy with the Control Panel used to manage the different services within the Stack.
Selecting XAMPP for Windows
At the end of the day, I went with a package called XAMPP (Cross Platform Apache, MySQL, PHP, and PERL). The second P in XAMPP provides PERL support that is lacking in the other WAMP Stacks (WAMPServer, bitnami, and a few others). I also like XAMPP because it has what appears to be a more active community and the stack has been very stable for me. Additional standout features of XAMPP to consider is support for hosting an FTP Server, apache based mail server. The option to run MySQL and Apachi as services or local running app is easily toggled with a click of a button.
Setting Up XAMPP for Development
Setup of XAMPP is straight forward. My experience is with the previous release 1.7.3. They just released 1.7.4. Go to:
Google: apachefriends xampp-windows
and scroll down the page till you see the install links. If you want to work with a release that has matured with some time, you can still find 1.7.3 at the following link:
Build Link: www (dot) apachefriends (dot) org (/) download (php) ?xampp-win32-1.7.3.exe
Installing XDebug for PHP Debugging
This applies to installing PHP on WAMP with Apache or on IIS. Selecting the correct version of this dll isn't straight forward.
First, go to:
Google: xdebug org download (php)
and review the various versions available.
The versions are not very intuitive to parse. Follow this guide to understand it:
Breakdown of XDebug Name: [php_xdebug-2.1.0-5.3-vc6.dll]
- XDebug version 2.1.0
- Compatible with PHP 5.3
- VC6: Use for Apache ver 1 or 2
- VC6 indicates compiled with legacy Visual Studio 6 Compiler
- VC9: Use for IIS
- VC9 indicates compiled with Visual Studio 2008.
- NTS (not listed in the name above) indicates Non Thread Safe.
- The version listed is thread safe.
PHP.ini Config Setting
NOTE: Since I've not set this up on IIS, I'm not sure what the specific settings are to apply. However, this is document throughout the web.
For WAMP/XAMPP:
Locate \php\php.ini file.
Comment out line by adding semi colon to start of line.
;zend_extension = "php\ext\php_xdebug.dll"
Locate [XDebug] Section
Use settings similarly listed below and set to your path:
[XDebug]
;Common Settings
zend_extension = "P:[Fully Qualified Path]\xampp\php\ext\php_xdebug-2.1.0-5.3-vc6.dll"
xdebug.profiler_enable = 1;
xdebug.profiler_output_dir = "P:[Fully Qualified Path]\xampp\tmp"
xdebug.profiler_output_name = "xdebug_profile.%p";
xdebug.remote_enable = 1;
xdebug.remote_host = "127.0.0.1";
xdebug.remote_port = 9000;
;Make sure your IDE setup on port 9000. Some will default to 7870.
xdebug.trace_output_dir = "P:[Fully Qualified Path]\xampp\tmp";
;************
;Needed for IDE Support
;************
xdebug.idekey = "vsphp";
;This value can be arbitrary or may require something specific for your IDE.
xdebug.remote_autostart = 1;
xdebug.var_display_max_depth = 5;
Debugging with IDE
I use 2 IDEs to develop in PHP:
phpDesigner7
Google: mpsoftware phpDesigner
VS.PHP (a PHP plugin for VS.NET 2010).
Google: jcxsoftware vsphp
I want to love VS.PHP in VS.NET 2010, however, it's not the greatest experience in step through debugging. phpDesigner7 has been much better for debugging and access to local variables, intellisense, and using running eval commands during debugging. VS.PHP is so close to being great, but you will be frustrated if you have little patience. I still prefer it as my development editor of choice, even for PHP.
Regardless of IDE, most IDEs provide internal debugging support without any of the extra steps I listed above. However, these applications will launch the php app in a private webserver using IDE specific php.ini settings.
I'm doing a lot of custom integration with WordPress, Joomla, and .NET applications. Therefore, I need the debugger to use the php.ini settings for my various platforms. For me to debug these platforms, I configure my IDEs to essentially run in remote debug mode. The IDE and web server coordinate run time execution with the help of XDebug acting as a broker and providing the necessary debugging symbols to the IDE debugger.
Configuring IDE for Debugging
Final step is to configure your IDE so the debugger can connect to the web server.
The 3 settings to look for are as follows:
PHP-CGI: P:[Fully Qualified Path]\xampp\php\php-cgi.exe
PHP.INI: P:[Fully Qualified Path]\xampp\php\php.ini
Listen Port: 9000
Different IDEs may label these settings differently and require additional settings. These should be the most important ones to look for.
NOTE: Use [php\php-cgi.exe], not [php\php.exe] for debugging. The php-cgi.exe is required to run php.exe on windows.
I hope this gets you started with attaching your IDE to the web server, setting breakpoints, and doing a lot with line by line debugging.
You will not be able to make Visual Studio Development Server work for PHP. However you can easily use IIS Express (http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx) which will not only give you PHP, but also install WinCache, URL Rewrite and other features that are super important for PHP development.
Also, note that other platforms like Classic ASP are supported as well, where in Cassini they are not.
One option is to not run cassini and instead just get IIS installed on your dev box and run everything through there.

Best methodology for PHP+APACHE+MYSQL Development

I want to start learning PHP. I have had a look at the various options available to install the PHP+MySQL+Apache combination. But it all seems too cumbersome and a lot of editing to the CONF files always leads to one problem or the other. So I had a couple of questions to ask:
1) How will something like WAMP help me? If I install WAMP, will that be enough?
2) Isn't there some Eclipse like IDE ( coming from a Java Background ), that allows WAMP to be integrated with it? ( Or is typing on Notepad the only option available )?
Please help me out by explaining things a little elaborately. Thank you so much for your time and patience.
i personally use xampp and netbeans for my local web development. you can actually set up the netbeans project wherever you want, so you can just place all your files in the htdocs folder of xampp (at C:\xampp) and edit the files in the folder directly. This will allow you to immediately see any changes you have made by reloading the web page.
xampp allows you to run apache (with mod_php installed and configured) and mysql on your local machine and even includes a handy panel to let you start and stop them at any time.
netbeans has a lot of tools for easy development and support for frameworks like Zend. You can also use it for many other languages should you wish to expand.
I prefer WAMP because it doesn't try to do anything fancy with configurations... when you install it, you get PHP, Apache, MySQL, and phpMyAdmin with each of their default configurations and extensions loaded. It's the same as installing them separately, only they're all in one convenient directory, and you get the handy tray icon to restart services and enable/disable extensions.
As for an IDE, I use Eclipse PHP Development Tools (PDT), but I've heard good things about Netbeans too. Eclipse can do everything Scott described Netbeans being able to do as well. You also might want to look into Aptana which was branched from Eclipse PDT but is now maintained by a different team.
you can go ahead and install xampp from apachefriends, it comes with an apache web server, mysql database, phpmyadmin and a control panel for both servers, and installs fairly quick and with the default settings you will be pretty much set. Not sure what integration you'd want between the editor and the webserver though. if you mean code folding, autocomplete and all that stuff, eclipse has a php-friendly version, and so does netbeans (these 2 are the most popular choices as far as i've seen)

Categories