Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stovepipe Systems:
Using bitwise instead of booleans
Aug 18, 2016 @ 16:18:44

On the Stovepipe Systems blog there's a new post from Yannick de Lange that suggests using bitwose operations instead of booleans to evaluate an on/off setting.

The naive way of storing many boolean options (in a database) is to create for each option a field and storing a 0 when it is false and 1 when it is true. Which of course works, but adding options will require a new field, which might require creating a compatibility layer for your old data. There is an easier way to do this and it's even more efficient at checking fields.

This brings me to an old topic which I have to explain to all the new people at some point and even once explained not everybody understands how it actually works. So in this post I'm going to explain how to use bitwise operators and how it works internally.

He starts with a common example using the 0/1 storage method and refactors it a bit to use different values that are more compatible with bitwise operations. He includes the usage of this system and how to works to evaluate multiple potential option values.

tagged: bitwise option boolean storage enable setting tutorial

Link: http://stovepipe.systems/post/using-bitwise-instead-of-booleans

Derick Rethans:
Xdebug 2.3: Shared Secret to Enable Tracing or Profiling
Apr 07, 2015 @ 16:19:44

Derick Rethans has posted another in his series covering the latest release of the Xdebug debugging tool for PHP, version 2.3. In this new article Derick introduces the "shared secret" handling, a custom string that for the "XDEBUG_PROFILE" that can trigger the the profiler to start.

Xdebug's profiling and trace file capabilities can both be triggered by a cookie, GET or POST variable, as long as you have enabled xdebug.profiler_enable_trigger and/or xdebug.trace_enable_trigger. With these triggers enabled, basically anybody could initiate a profile run, or trace file, by simply sending the XDEBUG_PROFILE or XDEBUG_TRACE cookies with an HTTP request. Although you should not really run Xdebug in production, you can see that this is not an optimal solution. Xdebug 2.3 adds supports for shared secrets for the trace file and profiler triggers through the xdebug.trace_enable_trigger_value and xdebug.profiler_enable_trigger_value.

He points out a browser extension, The easiest Xdebug, that already has support for this new feature. He also mentions two other tools but they have yet to integrate support for these shared secrets (but will soon hopefully): Xdebug halper and xdebug-helper-for-safari .

tagged: xdebug series release secret string tracking enable production extension

Link: http://derickrethans.nl/xdebug-2.3-tracing-profiling-shared-secret.html

SitePoint PHP Blog:
Enable PhpMyAdmin’s Extra Features
Jun 13, 2014 @ 18:53:48

On the SitePoint PHP blog there's a new post introducing you to some of the extra features in the popular phpMyAdmin tool, how to enable them and their use.

PhpMyAdmin is one of the most used tools when it comes to managing your databases. By default, PhpMyAdmin does a great job. However, it comes with a lot of handy extra extensions which can be easily activated. In this article, we will activate these extensions and see what they can do for us.

Among the extra features he talks about are things like:

  • Bookmarking
  • Clickable links for relations
  • Exporting relation information to PDF
  • Adding comments to column names
  • Viewing a history of queries run through the tool
  • Working with users and groups

There's lots more he covers too, so be sure to check out the rest of the post for more details and screenshots of the UI changes that come with them.

tagged: phpmyadmin extra features enable tutorial summary

Link: http://www.sitepoint.com/enable-phpmyadmins-extra-features/

Silver Lining Blog:
How to Enable XDebug in Windows Azure Web Sites
Sep 27, 2012 @ 16:53:50

On the Silver Lining blog (a MSDN Windows Azure related site), there's a recent post showing how you can enable XDebug on your Azure instance to help with debugging your application.

In this post, I’ll cover how to run XDebug (including the profiler) in Windows Azure Web Sites. Enabling XDebug in Windows Azure Web Sites is as simple as enabling an extension. However, enabling an extension for the built-in PHP runtime is slightly different than doing so for a custom PHP runtime. I’ll cover both scenarios here.

The post is broken up into two sections - one if you're just using the built-in PHP runtime that's already in the instance and another if you're using a custom one of your own. Changes to the configuration files and some screenshots of where to make the updates are included.

tagged: xdebug enable windows azure tutorial debugging

Link:

Johannes Schluter's Blog:
Improvements for PHP application portability in PHP.next
Jul 26, 2011 @ 13:40:46

In a new post today Johannes Schluter talks about the upcoming version of PHP and three of the things it features: no more short tags, no more magic quotes and the dropping of the enable-zend-multibyte compile option.

I was writing about PHP.next before, many things improved there meanwhile. Most notably we have a committed version number: The next PHP release will be called PHP 5.4. The topic I want to talk about today is "Improved application portability" which covers multiple small changes which aim at making it simpler for developers to write applications working on any PHP setup.

The first two will be immediately familiar to any PHP developer, but the third might be a little more elusive. This option was used to compile in multi-byte encodings to use for data in an application. Unfortunately a good implementation (that didn't use mbstring) couldn't be found, so they're removing the feature.

tagged: version magicquotes shorttags enable zend multibyte configure

Link:

Leonid Mamchenkov's Blog:
Disable and enable CakePHP plugins on the fly
Apr 25, 2011 @ 16:45:17

Leonid Mamchenkov has a quick post to his blog showing how to enable and disable (well, restrict from enabling) CakePHP plugins on the fly - no need to modify config files if you only need it for a certain request.

I am currently working on a rather large project which is based on CakePHP framework. In order to simplify the task, I’ve broken down the whole application into a number of CakePHP plugins. Now, however, I want to enable/disable plugins on the fly. After a brief search around I couldn’t find how to do that. Asking a question at #cakephp IRC channel did it. RabidFire instantly replied with the link that gave me an idea. 30 seconds later I had a working solution.

Since the plugins extend the main AppController, all it took was a beforeFilter() method call that looks at a request parameter for the plugin name, checks against an "allowed" array and throws an exception of it's not found or can't load it.

tagged: cakephp plugin enable load plugin dynamic beforefilter tutorial

Link:

Leniel Macaferi's Blog:
Installing PHP on Mac OS X Snow Leopard 10.6.5
Dec 31, 2010 @ 16:57:25

On his blog today Leniel Macaferi has a new post showing how to install PHP on OSX 10.6.5, really enabling the PHP that's already installed.

I hit a pretty good tutorial to enable PHP on Mac at About.com written by Angela Bradley that gets to the point: How to Install PHP on a Mac. Along the way I had to solve only one minor thing described in the caveat section at the end of this post. You see that the title of this post has the word installing (well I thought I had to install it – that was my first reaction), but in fact it could be the word enabling because PHP is an integral part of Mac OS X Snow Leopard and we just need to enable it as you’ll see soon.

He talks about enabling the web server, enabling PHP and testing the installation with a phpinfo. There's screenshots included so you can be sure you're in the right places.

tagged: install osx snowleopard enable webserver

Link:

Make Me Pulse Blog:
PHP6, Unicode and TextIterator features
Mar 14, 2008 @ 14:32:34

On the Make Me Pulse blog, there's a look at PHP6's support of Unicode in the SPL (Standard PHP Library) TextIterator handler.

I've just install the last version of PHP6 dev and I've decided to test the famous new feature, the PHP Unicode Support. I will not explain new things about PHP6 or Unicode or TextIterator, it's just my discoveries test on this features.

He steps through the process he followed - enabling Unicode support, testing various output methods (including just an echo and using the TextIterator) as well as some of the manipulation methods (next/first/current) that can be used to get certain characters out of a string.

tagged: php6 unicode textiterator spl standard library enable

Link:

Stefan Mischook's Blog:
Turning on display_errors in WAMP - Video Tutorial
Aug 31, 2007 @ 12:55:00

Stefan Mischook has posted another video tutorial to help developers get started in their PHP travels. This time it covers how to turn on errors when using the popular WAMP installation package.

Within a WAMP installation, I ran into a little issue today when trying to change php.ini's 'display_errors' property. By default WAMP installs with 'display_errors' to 'Off' - This is a pain-in-the-ass setting when trying to write new PHP code because errors don’t get displayed in the browser window

He includes the solution in the post but links as well to the video tutorial to show you exactly how it's done.

tagged: wamp video tutorial enable error display wamp video tutorial enable error display

Link:

Stefan Mischook's Blog:
Turning on display_errors in WAMP - Video Tutorial
Aug 31, 2007 @ 12:55:00

Stefan Mischook has posted another video tutorial to help developers get started in their PHP travels. This time it covers how to turn on errors when using the popular WAMP installation package.

Within a WAMP installation, I ran into a little issue today when trying to change php.ini's 'display_errors' property. By default WAMP installs with 'display_errors' to 'Off' - This is a pain-in-the-ass setting when trying to write new PHP code because errors don’t get displayed in the browser window

He includes the solution in the post but links as well to the video tutorial to show you exactly how it's done.

tagged: wamp video tutorial enable error display wamp video tutorial enable error display

Link:


Trending Topics: