Optimalworks Ltd web design, SEO, training and consultancy 

the site completely surpassed my expectations GT, AutoDirector, we build websites that work, my website is great - I love it MP, XL Autos, reach more customers, make more sales, it's more than I ever could have expected LM, Trade Cars UK, we can help your business grow, 99% of business now comes from my website GV, Bash Events, promoting standards throughout the web industry, your contribution added a level of quality we would otherwise have struggled to achieve PS, Hemsley Fraser
  1. home
  2. Services
  3. Portfolio
  4. Contact us
  5. blog

Apache 2, PHP, caching, and relative file path problems

written by Craig, 20 July 2007

For a while, I was under the impression that TACS, our webpage template and caching system, did not work in PHP 4 when running Apache 2 on Windows. It took a while to find the real answer … when PHP 4 or 5 is running as an Apache 2 SAPI module, relative file paths passed to functions such as file_exists() may fail under certain conditions. So far, I’ve discovered that code using ob_start() to cache the page will cause the failure. Running PHP as a CGI binary or code that does not use ob_start() appears to work fine.

The relative file path problem occurs on Windows, but I’m yet to test it on Linux. I’ve found a brief mention of the problem on a PHP-Nuke message board, but there was no resolution. It’s quite obscure so I doubt many developers have come across it.

The only solution I’ve found is to check the absolute, fully-qualified, file location instead. This has now been implemented in TACS v1.1 - if an file cannot be located at the relative location, it will try the absolute path instead. It appears to work fine, but I’d be grateful to hear from anyone who experiences problems.

  • categories: php, web servers
  • tags: apache, php
  • trackback: http://www.optimalworks.net/blog/2007/web-development/php/apache-php-relative-path/trackback
  • bookmark: del.icio.us, digg, facebook, reddit, Furl, Spurl, Blinklist, Slashdot, Technorati, Yahoo!
add your comments
please enter your name
please enter your email address - it will not be published anywhere
please enter your website address
please enter your comments (all are moderated and checked for spam)
  • next article: How to run PHP 4 and PHP 5 at the same time on Apache for Windows 
  • previous article: JavaScript in-place document updates 
search
  • all popular (5)
  • courses (1)
  • general (3)
  • hardware (1)
  • software (24)
    • free download (6)
    • web browsers (9)
    • web servers (2)
  • web development (31)
    • accessibility (4)
    • ajax (1)
    • css (2)
    • graphic design (4)
    • html (1)
    • javascript (7)
    • php (4)
    • seo (1)

tags

  • accessibility
  • ajax
  • apache
  • award
  • computing
  • css
  • design
  • developers
  • dom
  • download
  • editor
  • firefox
  • funny
  • graphics
  • hardware
  • html
  • ie
  • javascript
  • opera
  • php
  • portfolio
  • review
  • safari
  • seo
  • server
  • software
  • ssl
  • standards
  • wordpress
  • xml
  1. site map
  2. home
  3. Services
  4. Portfolio
  5. Contact us
  6. blog
  7. RSS feed
  8. project survey

XHTML 1.0 | CSS 2.1 | WAI AAA | printer-friendly

©2008 Optimalworks Ltd, Devon, UK. Registered in England and Wales No. 5922205.

This page can be viewed at http://www.optimalworks.net/blog/2007/web-development/php/apache-php-relative-path