Today I spent 3 hours trying to setup a new dev environment with debugging on my MacBook, consisting of Eclipse, PDT (PHP Development Tools), and MAMP. Not exactly fun.
The critical part of what I wanted to set up was Xdebug. There are quite a few web designers/developers out there, who simply write code, save, refresh their PHP in the browser, and do a quick visual check. That might work for pretty simple stuff, but it can be hard to find tricky bugs when the web app achieves some level of sophistication. So Xdebug (or any other debugging tools like Zend) is a must for me.
First, you have to set up Eclipse to handle PHP. There are quite a few options here. You can download the many different IDEs based on Eclipse, download Eclipse with PDT, or install PDT as a plugin to an existing Eclipse installation. Since I already Eclipse installed, I decided to install it as a plugin.
In Eclipse, go to Help -> Install New Software.
Select the drop down menu for Work with:
Select Helios – http://download.eclipse.org/releases/helios.
Find the Programming Languages option, expand it, scroll down and select PHP Development Tools (PDT) SDK Feature.
Hit next, agree with the license, etc, etc.
Next, time to set up Xdebug in php.ini. If you installed MAMP in /Applications in Mac OS X, and assuming you want to use PHP 5.3, the php.ini is in /Applications/MAMP/conf/php5.3.
Find the [xdebug] section towards the end of the file, and update it to:
[code][xdebug]zend_extension=”/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so”xdebug.profiler_output_dir = “/tmp/xdebug/”xdebug.profiler_enable = Onxdebug.remote_enable=Onxdebug.remote_host=”localhost”xdebug.remote_port=9000xdebug.remote_handler=”dbgp”xdebug.idekey=ECLIPSE_DBGP[/code]
Unfortunately, the Xdebug that comes with MAMP didn’t work for me, so I needed to get a more recent version. There are Windows binaries on xdebug.org, but no Mac OS X ones. Turns out Komodo, another IDE, has already compiled binaries of the new versions of Xdebug. Download the Xdebug binaries from Komodo and update the zend_extension path above or replace the xdebug.so.
We need to let Eclipse know it should be using MAMP PHP. Go into Preferences -> PHP -> PHP Executables. Edit the default. Change the executable path to the MAMP PHP, something similar to /Applications/MAMP/bin/php5.3/bin/php. Make sure PHP debugger is Xdebug.
Below PHP Executables is PHP Servers. Lets update this to work with MAMP. MAMP’s default Apache port number is 8888, we’ll set the URL to http://localhost:8888.
Let’s make sure that Xdebug is working with MAMP. Create a test PHP file to spit out phpinfo, which lists configuration settings:
Go to Run -> Run As -> PHP Web Page. Scroll down a bit in the browser and you should see a reference to Xdebug:
The Xdebug version that comes with MAMP is 2.0.x.
For the Web Dev Fools podcast, I was taking behind the scene pictures of the intros that were recorded. I ended up with about 20 that I wanted to look at on my MacBook.
There are 4 options of transferring photos from the iPhone to a computer: text message them to an email address, import using iPhoto, email them using the iPhone Mail app, or sync with iTunes. I don’t have a text message plan, so I didn’t want to pay to text myself the pictures. You can’t select multiple pictures to email yourself through the iPhone Mail application. I don’t use iPhoto regularly, so thats a no go. And I don’t sync with iTunes, and I didn’t want to start now.
iTunes not being able to do it natively is irritating. It lets you grab music and movies off the iPhone directly, but not photos. The only option with iTunes is to sync:
But, Mac OS X does come with the perfect tool to get photos off the iPhone. Its called Image Capture. Simply plug in your iPhone to your Mac, and start Image Capture.
You will see your iPhone on the left panel, select it and you will see all the photos on the iPhone. You can select individual photos or import all of them. And it gives you the option of selecting a folder where the photos will be placed.
Photo courtesy of Fred.
I spent pretty much all today wiping a desktop, and installing Windows 7, Visual Studio, and SQL Server Express 2010 on it. Talk about some form of hell.
The WIndows 7 install went fine, The Visual Studio install went fine. The SQL Server Express install went fine. Thought I was in heaven.
So I fire up SQL Server Management Studio and this is what I see:
Makes sense, I hit the Connect button. After about 5 seconds, I see get an error:
Of course the information is correct, I’m on my local box, how can you not connect to it? Bah.
Turns out, I got the server name wrong. It should be either <MACHINENAME>SQLEXPRESS or .SQLEXPRESS.
Then it all works like magic.
I ran into an interesting Mac OS X Perl issue the other day. Since @runlevelmedia hosts websites for clients, its a good idea to have a backup strategy. Hoping and prayer is not really strategy.
We have been working on updating our backup plan to make it more efficient. Basically, the script could be run from different machines, so we have multiple copies as a starting point.
Testing out the script on my Macbook threw me for a surprise. Apparently, I mostly use the basic Perl modules pre-installed with Mac OS X and I’d never run across any issues.
[code]jeebus:~ nali$ ./backup.pl —config testconfig.iniCan’t locate Config/IniFiles.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at ./backup.pl line 3.BEGIN failed—compilation aborted at ./backup.pl line 3.[/code]
(Yes, my Macbook name is jeebus). Quick Googling found people complaining about the Perl version installed by Mac OS X. The problem is that its not the best idea to yank out the pre-installed version because a lot of apps and systems related processes expects it all work in a certain way. One example I saw was how iTunes used a string comparison behavior that got changed in the more recent versions of Perl. So lots of folks end up installing a bunch of different versions of Perl, which is beyond confusing and unmanageable.
Turns the following command makes it pretty easy to install specific CPAN modules:[code]sudo perl -MCPAN -e ‘install Config::IniFiles’[/code]
Another option is to kick off a CPAN shell and install that way:[code]sudo perl -MCPAN -e ‘shell’Terminal does not support AddHistory.cpan shell — CPAN exploration and modules installation (v1.9205)ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)cpan> install Config::IniFilesCPAN: Storable loaded ok (v2.18)Going to read /Users/nali/.cpan/Metadata….[/code]