php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38307 PHP cannot find extensions in updated PATH
Submitted: 2006-08-03 08:25 UTC Modified: 2006-08-03 16:36 UTC
From: abel dot online at xs4all dot nl Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 5.2.0RC1 OS: Windows 2k, XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: abel dot online at xs4all dot nl
New email:
PHP Version: OS:

 

 [2006-08-03 08:25 UTC] abel dot online at xs4all dot nl
Description:
------------
Part of the new strategy of PHP is that you do not need to place files in the c:\windows or other "global" scattered directories. This does not yet work for extensions:

Changes to the PATH environment variable are not available for PHP. Only the original PATH (before having updated the PATH) appears to be visible to PHP. 

If you want to load an extension, say php_mysql.dll, and this extension needs something from the new path, say libmysql.dll, you are out of luck.

Reproduce code:
---------------
1. Install Apache 2.0 or 2.2
2. Install PHP using default instructions
3. Add PHP path to the PATH (system wide)
4. Configure Apache to use PHP
5. Place php.ini in configs/apache
6. Test Apache with PHP --> success
7. Test PATH in command prompt --> success
8. Uncomment php_mysql.dll extension line
9. Copy php_mysql.dll to extension_dir
10. Restart Apache --> error occurs

Note: for these instructions to work, it is best to leave as much of the original settings in place.

Workaround: place the offended files (php_mysql.dll and libmysql.dll) in the root location of Apache.

Expected result:
----------------
I expect that after installing PHP, it will look for the PATH locations and locations mentioned in php.ini. The extension location is not searched by default (for linked dlls), so that is not an option.

If you do not have the luxury to restart a server, you will have to place some needed dll files manually to these scattered locations.

Actual result:
--------------
The result of steps 1-10: Apache cannot be restarted. PHP raised an error. In the Event Logs of Windows you will find:

Type: Information
Source: Application Popup
Category: None
Event ID: 26
Description:
Application popup: httpd.exe - Unable To Locate DLL : The dynamic link library LIBMYSQL.dll could not be found in the specified path C:\Program Files\Apache Software Foundation\Apache2.2\bin;.;
C:\WINNT\system32;C:\WINNT\system;C:\WINNT;C:\WINNT\system32;
C:\WINNT;C:\WINNT\System32\Wbem;D:\Program files\Sun\AppServer\jdk\bin.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-03 08:53 UTC] tony2001@php.net
>Changes to the PATH environment variable are not available
> for PHP. Only the original PATH (before having updated
> the PATH) appears to be visible to PHP. 

Because you need to reboot for that.
Not PHP problem.
 [2006-08-03 16:36 UTC] abel dot online at xs4all dot nl
I understand that a reboot solves the problem. But why is that needed for PHP? Other programs don't have that issue. Changing to the PATH is visible upon restarting the application.

Programs like Tomcat and Perl, or any of the Apache modules have no trouble whatsoever with changes to the PATH. The web server only needs a restart to see the changes. Not the machine. PHP is (imo) the only exception here.

Why would this be important? 
Well, mostly because servers, especially advanced monitored servers, cannot be shut down easily. Upgrades to programs need to be done through Remote Desktop or Telnet. Scheduling a real system restart may take days, if not weeks. That is not acceptable in production environments (and that's where I used it).
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Sep 24 22:05:52 2022 UTC