Jump to content

mrtndimitrov

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mrtndimitrov's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry but I don't see in the documentation description of such behavior. When in the included file I print the current working directory, it is the parent's one. So, why include '2.inc.php'; is resolved?
  2. Recently I discovered the following strange behavior of 'include' on PHP 5.2 (Windows). According to the documentation and to my understanding 'include' is supposed to simply 'copy' the contents of the file into the calling one. So if we put another 'include' into the included file, the path should be relative to the root file. If you do 'echo getcwd();' from any of the files, the path is indeed relative to the root one. But I discovered that if PHP can not find the file, it searches by making the working directory the included file. Here is the directory structure I set up to test the things: test/index.php {contains: include 'func/main.inc.php';} test/func/main.inc.php {contains: include '1.inc.php'; include 'func/2.inc.php'; include '../func/1.inc.php'; test/func/1.inc.php {contains: echo '<h1>'.__FILE__.' - '.getcwd().'</h1>'; test/func/2.inc.php {contains: echo '<h1>'.__FILE__.' - '.getcwd().'</h1>'; test/func/func/2.inc.php {contains: echo '<h1>'.__FILE__.' - '.getcwd().'</h1>'; The results are: the first include in main.inc.php has no problem finding 1.inc.php the second include in main.inc.php includes test/func/2.inc.php NOT test/func/func/2.inc.php which means PHP is first trying to locate the file based on index.php's working directory the third include prints warnings as it will include './2.inc.php' Is this behavior documented? Can we rely on it? martin
  3. Hello, I have an old machine for testing that is running Fedora Core 4 with Apache 2.0.54 and PHP 5.1.6. I recently needed to use the mbstring library but received a call to undefined function. I checked the phpinfo and it seems to be parsing a file mbstring.ini. In this file the only line reads: extension=mbstring.so. I found this file right into the Apache modules folder. I should mention that in the phpinfo there is no configure command '--enable-mbstring' or '--disable-mbstring'. Googling I followed several suggestions. First, I tried 'yum update php-mbstring'. It returns 'Nothing to do'. Then I compiled PHP 5.3.0 with --enable-mbstring. But Apache still loads the old version. How to make Apache load the new one? One strange observation is that 'make install' doesn't seem to be installing a file libphp5.so. The old file is not replaced. Now I am stuck. Please, give an advice.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.