Archive for November, 2008

Enabling Xdebug under Mac OS X Leopard

Tuesday, November 25th, 2008

Xdebug is the most popular debugging and profiling tool available for PHP, and one we use here internally quite a bit during the development process. Available as an extension for PHP, it is easily installed on PHP for Windows by dropping in the the correct dll into the PHP extensions directory and adding it to the php.ini file, or on most Unix systems by using the pecl install xdebug command. For those setups, the instuctions on the Xdebug website will get you up and running in no time.

However, if you wish to get Xdebug running on the PHP installation included with Mac OS X Leopard, the pecl install xdebug command won’t work. The problem was earlier illustrated on this developer’s blog post, where the command line PHP version is built for 32-bit, while the Apache module is 64-bit. So for this we’ll need to build the extension as a 64-bit extension and create a seperate php.ini file just for Apache to use. Here’s how we do that:

  • Download xdebug from http://xdebug.org, and unzip it.
  • cd to the xdebug-x.y.z directory in the archive, then run the following commands to build the extension
$ phpize
$ MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe
-no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc
-arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-xdebug
$ make
$ sudo make install
  • Now we need to copy our original php.ini to one we’ll use exclusively for Apache.
$ sudo cp /etc/php.ini /etc/apache2/php.ini
$ sudo echo "zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so" >>
/etc/apache2/php.ini
$ sudo echo "PHPIniDir /etc/apache2" >> /etc/apache2/other/php5.conf
$ sudo apachectl restart

You should now be up and running; you can confirm by checking the output of phpinfo(); in the browser.

As for debugging tools, we’ve used both the tools included in the Eclipse PDT project as well as MacGDBp. For profiling, we use MacCallGrind.

Managing the PHP external cache

Wednesday, November 19th, 2008

With the introduction of 5.1.0a, there are now some additional configuration options available for your Sugar installation with regards to utilizing PHP external caches.  The new options to add to your config_override.php file are:

  • external_cache_disabled_zend
  • external_cache_disabled_memcache
  • external_cache_disabled_apc

Note that by default, these are all set to false.

Prior to Sugar 5.1.0a, the application would check for the existence of functions or extensions to determine which external cache to use (in order):

  • zend (tested by existence of the output_cache_get() function)
  • memcache (tested by the existence of the memcache extension)
  • apc (tested by the existence of the apc_store() function)

If you had all three installed and activated, you would match the check for zend first and thus be using zend.  If you had just memcache and apc installed, you would be using memcache since it is first in the check order.

With these new settings, you now have more granular control over which external cache is used.  For example, if you installed memcache for the purpose of storing your PHP sessions and wanted to use APC as your external cache, you would need to set ‘external_cache_disabled_memcache => true’  in your config_override.php file–it would also be wise to set external_cache_disabled_zend to true for good measure as well.

A recommendation when utilizing an external cache is to disable all of the possible caches you don’t intend to use to ensure that the proper one is being used.

For more information on the particular caches, please visit this Sugar Wiki article on using PHP accelerators with SugarCRM.

Sugar, Custom Relationships and You

Tuesday, November 11th, 2008

Sugar 5.1 brought many improvements to the Sugar application framework.  In this release, we introduced a new method for creating custom relationships in Studio and Module Builder called the Relationship Editor. This new editor consolidates the functionality of the old “relationship fields” which worked as basic one-to-many relationships as well as the many-to-many relationships that are produced from creating relationships in the 5.0 Module Builder.

As there have been questions regarding how to use this new editor and how exactly it works, this article will cover the inner workings of the Relationship Editor.

(more…)

Have feedback for us? Drop us a line.
Terms & Conditions | Privacy | Trademark Info | Contact Info | FAQs | SugarCRM Inc.© 2004 - 2009 All rights reserved.