Merry Christmas folks!

In the spirit of New Years and because I'm going to be relying more heavily on my PHP skills for a living in 2009, I've made a commitment to becoming a better programmer.

One of the elements of becoming 'better' is using a real PHP IDE. After playing with PDT Eclipse, Komodo and Zend Studio for Eclipse...I find Zend Studio 'best' in terms of power, features, flexibility.

I'm having some issues adapting it to the way I have worked up to this point though. I am starting to think that I might have to change the way I do things.

Here's an example:
I get a new project to work on. So, I create a directory for it (Users/me/web_work/client_name/project_name/). Inside that directory, the website/application will live in ./httpdocs. (there's also a ./resources, ./docs, ./invoices)

The first file that goes in .httpdocs is index.php, which just as <?php phpinfo()

Open httpd.conf and /etc/hosts, add a virtualhost for the new project...something like 'project_name.localhost.com', set 'project_name.localhost.com' to resolve to 127.0.0.1

Restart Apache.

Open [url]http://project_name.localhost.com[/url] and there's my php info.

So now I have a workspace (not to be confused with the Eclipse meaning of that word) set up and a server to work on.

The first thing I do is create ./httpdocs/includes and add init.php. This file will:
1. Use if/else or switch/case to figure out whether we're on my local dev server, my partners local dev server or the production server.
2. set paths accordingly
3. include everything we need for this project. (PEAR classes, project classes stored in /httpdocs/classes/, any other function files, etc)
4. set any other required variables, depending on the server (DSN string) and create the MDB2 object that will be used everywhere in the project.

So then, I add a .htaccess file to /httpdocs with this line:
php_value auto_prepend_file /path/to/init.php

Presto-bingo, only one file in my whole project uses include() or require() and by editing that one file, I can insure that the entire project has every resource it needs.

So, those of you who use Eclipse can see a problem:

The debugger could care less what's in .htaccess. The debugger also fails to evaluate the if/else or switch/case statement in init.php to make sure we're including files from the correct path.

Result: debugging functionality that doesn't really work.

So, I feel like I need to re-design the way I do things to better use my tools and create better portability in my applications.

I'm open for suggestions from the good folks here (especially those of you using PDT/Zend Studio Eclipse to create large-ish OOP applications with lots of libraries/frameworks/classes that have to be included) on how to set things up and how to manage the required libraries and files for each app you do.

Point me in the right direction, let me get a little experience/confidence and I'll even come present my findings at a meeting.

Hope everyone had a great Christmas and is looking forward to a terrific 2009!

    23 days later

    this is my first post on here for about ten years... apologies for the absence. I even had to re-register to post on this forum - the audacity!

    Did you find a solution around your eclipse debugging setup?

    I'm on a small dev team, and we're going to be installing and interfacing with a Joomla CMS. Just wondering:
    What are the main differences between running:
    Eclipse/Zend Studio
    and running
    Zend Studio on its own...
    ??

    ta

      I'm only aware of 'Zend Studio for Eclipse'...which is Zend's modification of Eclipse and a really good IDE. I've used it almost exclusively without having much time with Eclipse/PDT, so I can't really speak to the differences.

      The solution I came up with was to just point http://localhost at my ~./workspaces directory and then put each individual project in that directory.

      It works!

        Write a Reply...