php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51299 PHP defaults to C:\PHP5 folder when loading extension
Submitted: 2010-03-14 22:40 UTC Modified: 2010-03-14 22:46 UTC
From: mariusads at helpedia dot com Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 5.3.2 OS: Windows 2003 / Doesn't matter
Private report: No CVE-ID: None
 [2010-03-14 22:40 UTC] mariusads at helpedia dot com
Description:
------------
I've reported this some time ago for another version of PHP.

Tried installing PHP 5.3.2 on Windows 2003. 
Extracted contents to C:\PHP
Copied php.ini-development to C:\Windows\php.ini and remove the ";" from some extensions
Rebooted Apache.
PHP pops error messages saying it can't load C:\PHP5\ext\php_mysql.dll and so on.

"C:\php5" seems to be hardcoded in php5ts.dll, as "c:\php5\pear" is.

I believe this is wrong behavior.

First of all, PHP is configured to load PHP using this config. entry:

LoadModule php5_module "C:/php/php5apache2.dll"

Using File Monitor from SysInternals, I can see C:\php\php5ts.dll is loaded next, and C:\Windows\php.ini is used.

In the php.ini the default text for both development AND production is this:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"

As these are commented by default, I believe a regular user would assume PHP would look for the extensions in [folder where php5ts.dll is] \ ext or more precisely "C:\php\ext", or in the worst case "C:\php". 

Nowhere in the documentation or in the ini file, there is any mention of "c:\php5"

Of course, if I un-comment the setting and specify it as :
extension_dir = "ext"
php will report the following error: 
PHP Startup: Unable to load dynamic library 'ext\php_bz2.dll" and so on, so the default value is wrong.

I think the version ".\ext" should be accepted as "." signifies the current folder - but it's not, the only accepted version is to write the full path, "C:\php\ext"




Expected result:
----------------
When the extension_dir is commented out (the default in php.ini), the php library should look for the extensions in the EXT folder inside the folder where the library resides. Not a hardcoded C:\PHP5.

On Windows, if there's no drive letter or network path at the start of the value, it should be assumed it means a sub-folder in the folder where the library resides.

As it is right now in the php.ini, if the value "ext" is there and php5ts.dll resides in "C:\php" or for example "c:\program files\php", php should look for extensions in "c:\php\ext" or "c:\program files\php\ext"

Also this is probably unrelated or reported as another bug, but php_exif.dll does not load, even if it's in c:\php\ext  I don't know if it depends on something.

Actual result:
--------------
Extensions shouldn't be loaded from a hardcoded folder, as I already said.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-14 22:46 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2010-03-14 22:46 UTC] pajoye@php.net
Already a report about this change request.
 [2010-03-14 22:54 UTC] mariusads at helpedia dot com
OK.

Fyi... the php_exif.dll problem I solved after a Google search.
Apparently, the solution is just to move the line with php_mbstring.dll before the line with php_exif.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 19:01:28 2024 UTC