Archive for December, 2008

How do you stop spam?

I’ve got more spam in the last 2 days asking me to sign up with “Business Solutions Africa”. Michael Faust has his name at the bottom of these emails, and the link in them sends me to http://www.africa-marketing.com/. I didn’t ask for this email, so that makes it unsolicited. Unsolicited email = spam.

The problem is, there’s very little we can do about spam. I’ve replied to Michael (usually a VERY BAD IDEA to reply to spam) and asked him to stop sending unsolicited emails, but aside from that (and blogging about his site, which hopefully shows up if people google him and his company) there’s nothing I can do to stop him.

The problem with Business Solutions Africa is that they’re an internet marketing company who promise on their front page that “Internet Advertising works!” I would *never* use an internet marketing company who spams – that goes against everything that is good and true and right in the world. It’s like asking Brett Lee to open the bowling for South Africa. No.

Google replied to _enzo today with an automated message from the gmail abuse team: “What happens when you report abuse? We track spammers and inflict horrible tentacle rape on them.”

If only.

Installing, integrating and configuring Eclipse for Drupal on a Mac

This post is about how to set up a php IDE on a Mac (or windows) so that you can start debugging php code in drupal projects. This is important to me because I’ve been using textwrangler as my coding tool for years – which simply highlights php syntax. I want something a bit more powerful.

Step 1: Download the All-in-One Eclipse PDT + Zend Debugger Package by heading to http://www.zend.com/en/community/pdt. his package includes all you need in order to develop and debug PHP on your machine – the Eclipse Web Tools Platform, PHP Development Tool and the Zend Debugger Plug-in.

Step 2: Unzip it and place it in your Applications folder (or, in my case, /Users/roger/Applications/_authoring/eclipse ). You can run Eclipse immediately without having to do any “installation” stuff if you’re on a Mac.

Great! So now we have a php IDE – let’s configure it for drupal.

Step 3: Go to the Configuring Eclipse page on drupal.org and follow those instructions (it’s quick).

Our next step is integrating Eclipse into our php web environment (apache, in my case). You could always download MAMP: I use the built-in apache server on Mac OS 10.4 and downloaded and configured mysql myself (but if I had to do it all again, MAMP is the way to go). So, assuming you already have some kind of apache + php + mysql environment up and running…

Step 4: Copy the appropriate ZendDebugger.so file to the MAMP install’s PHP extension directory. The best way to find out is via the “phpinfo()” command. Create a PHP-file called phpinfo.php with the following content:

<?php phpinfo(); ?>

and then load that file in your browser.

Step 5: Edit your php.ini file and add or update the following directives:

implicit_flush = On
output_buffering = Off
eaccelerator.enable=”0″

;zend_extension=/usr/lib/php4/20020429/xdebug.so (comment out this directive if it exists)
;extension=dbg.so (comment out this directive if it exists)
;extension=php_dbg.dll (comment out this directive if it exists)

[Zend]
zend_extension=/Path/To/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1/32
zend_debugger.expose_remotely=always

Remove all other directives from the [Zend] section of the php.ini file.

Step 6: Copy the file named dummy.php in the server’s document root directory (usually /User/you/Sites). Eclipse will load it later to verify that everything is setup properly. The file is inside the “Debugger Extension” archive. If this file is not there, please download it from:

http://www.lgorithms.com/dummy.txt

Restart apache. Load up the php info.php file you created earlier, and search for “debugger”. You should get something about the Zend debugger now.

Step 7: read how to use Eclipse to debug php.

This is condensed from Using PDT : Installation : Installing the Zend Debugger and Mac PHP Debugging using Eclipse PDT and MAMP.

Step 8: configure Eclipse for drupal (very quick).

Step 9: Open Eclipse and create a new php project. Give it a name and click “next”. Then in “Source” click “Link Source…” add your drupal folder (select “ignore nesting conflicts”) you’re working with.

Step 10: Click “Run” and “Run Configurations…”. Under PHP Web Page click the “plus” icon to add a new launch configuration. Give it a name, make sure the server debugger is Zend, then click “New” next to “PHP Server.” Give your server a name and put in the url to your document root, in my case it’s http://webdev.local/~roger

Save and close that dialogue. Then under File click “browse” and select the index.php file from your drupal site. Under URL make sure you’ve put in the correct url to index.php that you call in your browser. You can then click “Apply” and “Test Debugger.” If everything works you should get a “Success!” message.

Step 11: Whew! That took a while! Now you have the Eclipse IDE up and running with the Zend debugger installed. To see it in action load up your index.php file in Eclipse, right click just to the left of the line number on a line of code and select “Toggle Breakpoints.” Then click “Run” and “Debug”. Eclipse will load your drupal site into your browser, and pause the loading of the page at the place you set a breakpoint in your code.

Take a moment to bask in the glow of your monitor. PHP coding fame is yours! To get back to the view you were just in, click Window -> Open Perspective -> PHP

If you want to get really geeky you can also:
Configure Eclipse for Remote Debugging with Zend.

 
Technorati Tags: , , , , , , ,