Postcards From My Life

Lint I find in my mind's belly-button.
  • EPK
  • Consulting
  • Resume
  • Nerd Herding
  • Talks
  • Flex
  • Zend Framework

Posts Tagged ‘set_include_path’

set_include_path() failing

Thursday, February 14th, 2008

Dear Reader,

The title of this post will confuse most of you but I chose it on purpose. I hit a wall last night and couldn’t find anything on the web to help me over it.

The Problem

<?PHP
var_dump(set_include_path('./'));

Drop this little piece of code into a file and place it on your web server. What you SHOULD get back is a string describing your old include path. If you get false, you have hit the problem I hit last night. I went so far as to recompile 2 difference versions of Apache thinking (almost correctly) that it was something that had changed in my Apache config files.

The Solution

Like most Apache installs, my development server has a single config file for each domain. (In my case they are all *.dev domains, I don’t host any live domains on my cable modem) In each config file, I set not only Apache settings but some defaults for things like php’s include path for that domain. Here’s an example for my development are for calevans.com

<virtualhost 192.168.0.99:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /home/calevans.com/public_html
    ServerName www.calevans.dev
    ServerAlias www.calevans.dev calevans.dev
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
    php_value include_path /usr/local/lib/php:/home/phpinc/:/home/calevans.com/phpinc
</virtualhost>

As you can see, I use php_value to set the default include path. However, for some reason, I had started using php_admin_value to set it and other settings. After 4 long hours of banging my head on this, my friend Davey Shafik popped into #phpwomen (yes, I hang out there…its like taking “Home Economics” in high school, you do it because it’s where all the girls are) and said:

[22:54] Davey: I know what it is ;)
[22:54] Davey: php_admin_value include_path
[22:54] Davey: you have that somewhere
[22:55] Davey: you *cannot* override php_admin_value settings

Son-of-a-gun if he wasn’t right. For some reason I had started using php_admin_value instead of just php_value. php_value can be overridden in your code, however, php_admin_value tells PHP not to allow the value to be overridden.

Why is this important

If you are working with Zend Framework, then this is VERY important. Zend_Loader temporarily modifies the include_path when including things like Controllers. If it can’t do so, your apps will fail in a most spectacular way.

Wife 1.24 (The lovely and talented Kathy) says that now I know how everyone else feels when I walk over and solve problems. (I have a tendency to do that and am usually pretty snarky about it when I do)

Until Next Time,
(l)(k)(bunny)
=C=

Tags: Apache, Davey Shafik, Kathy Evans, PHP, php_admin_value, php_value, set_include_path, virtualhost
Posted in Apache, PHP | 3 Comments »

 
  • Event Registration Online for Day Camp 4 Developers : Soft Skills

  • Team Based PHP Training

  • Tags

    adobe API article Cal Evans codeworks community conference cw09 Derick Rethans developers devzone elizabeth naramore Exim flex fun IBuildings Kathy Evans linkedin Management Marketing microsoft MySQL Nashville open source phar PHP phparchitect php developers podcampnashville podcast Programming Quickies respect Sebastian Bergmann Silly-Con Valley sixty second tech software development terry chay twitter upgrade video windows wordpress zend zend framework

  • RSS PHP Podcasts

    • JSClasses, JSMag, PHP Alpha 1, PHP strict typing, IndieConf – Lately in PHP podcast episode 4
    • SitePoint Podcast #76: Wicked WordPress Themes with Allan Cole and Jeffrey Way
    • DPCRadio: Designing for Reusability
    • SitePoint Podcast #75: Awesome Overkill
    • DPCRadio: Technical Debt
    • SitePoint Podcast #74: WordPress Themes with Nathan Rice and Cory Miller
    • SitePoint Podcast #73: Cease and Desoup
    • DPCRadio: APC & Memcache the High Performance Duo
    • APC & Memcache the High Performance Duo
    • SitePoint Podcast #72: Web Video and Social Media with Gregory Ng and Wayne Sutton

  • Me

    • Best web design company
    • Cal Evans Dot Com
    • Cheap Wine Diary
    • Cyrano’s Apprentice
    • Evans Internet Construction Company
    • My Life as a Child
    • PHP Podcasts
    • Sixty Second Tech

  • Categories

    • Apache
    • BlogBling
    • Blogging
    • codeworks
    • Entertainment
    • Entrepreneurship
    • Flex
    • Humor
    • JavaScript
    • Long Form
    • Management
    • Marketing
    • Me
    • PHP
    • podcasting
    • Programming
    • SQL
    • Technology
    • Web 2.0
    • wordpress
    • WordPress Plugins
    • writing
    • zend framework


Postcards From My Life is proudly powered by WordPress
Entries (RSS) and Comments (RSS).