Okay, I've never had to add any extensions before, but now I want my test server to use some of the extensions, like the GD library. I set the extensions_dir to point to my extensions, uncommented the proper lines to add in the extensions, and moved the contents of the /dll/ folder to my system32 folder. Then I restarted Apache and checked it.

However, not one of the extensions is loaded. I tried using dl(), but that gives me an error.

I'm using PHP as a module in Apache 1.3 running on Windows XP. Why aren't my extensions loading?

    Here's a snippet from my php.ini (note that right now, I'm just trying to get GD working; once I do that, I'll try other extensions):

    ;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; UNIX: "/path1:/path2"  
    ;include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" include_path = "." ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below doc_root = "d:\Apache\Apache\htdocs" ; The directory under which PHP opens the script using /~username used only ; if nonempty. user_dir = ; Directory in which the loadable extensions (modules) reside. extension_dir = "d:/programs/php/extensions/" ; Whether or not to enable the dl() function. The dl() function does NOT work ; properly in multithreaded servers, such as IIS or Zeus, and is automatically ; disabled on them. enable_dl = On ; cgi.force_redirect is necessary to provide security running PHP as a CGI under ; most web servers. Left undefined, PHP turns this on by default. You can ; turn it off here AT YOUR OWN RISK ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; cgi.force_redirect = 1 ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP ; will look for to know it is OK to continue execution. Setting this variable MAY ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. ; cgi.redirect_status_env = ; ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix it's paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is zero. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; cgi.fix_pathinfo=0 ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate ; security tokens of the calling client. This allows IIS to define the ; security context that the request runs under. mod_fastcgi under Apache ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; fastcgi.impersonate = 1; ; cgi.rfc2616_headers configuration option tells PHP what type of headers to ; use when sending HTTP response code. If it's set 0 PHP sends Status: header that ; is supported by Apache. When this option is set to 1 PHP will send ; RFC2616 compliant header. ; Default is zero. ;cgi.rfc2616_headers = 0 ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ;upload_tmp_dir = ; Maximum allowed size for uploaded files. upload_max_filesize = 2M ;;;;;;;;;;;;;;;;;; ; Fopen wrappers ; ;;;;;;;;;;;;;;;;;; ; Whether to allow the treatment of URLs (like [url]http://[/url] or [url]ftp://[/url]) as files. allow_url_fopen = On ; Define the anonymous ftp password (your email address) ;from="john@doe.com" ; Define the User-Agent string ; user_agent="PHP" ; Default timeout for socket based streams (seconds) default_socket_timeout = 60 ; If your scripts have to deal with files from Macintosh systems, ; or you are running on a Mac and need to deal with files from ; unix or win32 systems, setting this flag will cause PHP to ; automatically detect the EOL character in those files so that ; fgets() and file() will work regardless of the source of the file. ; auto_detect_line_endings = Off ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example, on Windows: ; ; extension=msql.dll ; ; ... or under UNIX: ; ; extension=msql.so ; ; Note that it should be the name of the module only; no directory information ; needs to go here. Specify the location of the extension with the ; extension_dir directive above. ;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed for it. ; ;extension=php_bz2.dll ;extension=php_cpdf.dll ;extension=php_crack.dll ;extension=php_curl.dll ;extension=php_db.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_dbx.dll ;extension=php_domxml.dll ;extension=php_exif.dll ;extension=php_fdf.dll ;extension=php_filepro.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_hyperwave.dll ;extension=php_iconv.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll ;extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_java.dll ;extension=php_ldap.dll ;extension=php_mbstring.dll ;extension=php_mcrypt.dll ;extension=php_mhash.dll ;extension=php_mime_magic.dll ;extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_msql.dll ;extension=php_oci8.dll ;extension=php_openssl.dll ;extension=php_oracle.dll ;extension=php_pdf.dll ;extension=php_pgsql.dll ;extension=php_printer.dll ;extension=php_shmop.dll ;extension=php_snmp.dll ;extension=php_sockets.dll ;extension=php_sybase_ct.dll ;extension=php_w32api.dll ;extension=php_xmlrpc.dll ;extension=php_xslt.dll ;extension=php_yaz.dll ;extension=php_zip.dll

      20 reads, and no responses...thanks for the answers!

      I've read at least 10 tutorials on loading extensions in Windows, and they all say I've done it right. Obviously, I haven't, or the loaded extensions would show up in phpinfo().

      I need this for a project I agreed to do, which I can't do unless I have the GD module loaded, and maybe some of the other modules (I'm still reading about some of the modules, since I've never used them, to see if there might be something hidden in them that's useful).

        Well, I was able to figure it out. For some reason, PHP was ignoring php.ini. When I moved php.ini to the Apache folder, it started working like it should.

          a year later

          Sorry, I was not here when you needed this info. I found this thread on a Google search. And just joined

          I had the same issue and found that if you use the php.ini-recommended file this well happen. Always use the php.ini-dist if you intend on adding extensions like php_gd2.dll, php_zip.dll and so on..... 🙂

            9 days later

            I'm having a similar problem, except that when Apache 2 starts, it says it can't find the php_xxx.dll files, giving the full path and filename for each, which upon examination of my system, is correct. Windows Explorer says all those files are there when I examine the directory, yet Apache says it can't find them.

            Now, sadly, I'm at work right now and don't have access to my .conf and .ini files, but I came accross this posting looking for general ideas to take home and try and thought I'd post, before I forget (not allowed external email, so I can't email myself the link home).

            I have all the php_xxx.dll files located in my C:\PHP directory, and Apache 2 says it can't find (not can't use, can't find) C:\PHP\php_xxx.dll.

            I've tried turning the slash both ways, using the dot notation, and about a hundred other things (I spent 6 hours this morning trying to make this work).

            Any ideas?

              doc_root = "C:\Program Files\Apache Group\Apache2\htdocs"

              ; The directory under which PHP opens the script using /~username used only
              ; if nonempty.
              user_dir =

              ; Directory in which the loadable extensions (modules) reside.
              extension_dir = "c:\PHP\extensions"

              This works very well for me, on win32 platform

              have something like the above in your php.ini
              It's best to keep extensions in their own folder, then they don't get muddled in system32 and makes upgrading easier

              THEN stick php.ini in c:\winnt or c:\windows (OS dependant)

                Now that I'm home, here's the excerpt from my C:\WINNT\PHP.INI file:

                doc_root = D:\httproot\phpbb2
                
                ; The directory under which PHP opens the script using /~username used only
                ; if nonempty.
                user_dir =
                
                ; Directory in which the loadable extensions (modules) reside.
                extension_dir = "C:\php\"

                It wasn't Apache generating the error. It was the PHP compiler. See Error snapshot, attached.

                  Ok, I completely started over with XAMPP (Win32), and it's still not working.

                  Here's my new PHP.INI (attached and slightly renamed).

                  Out of desperation, I even tried to use REGSVR32 to register them, but to no avail. I'm still getting the same error.

                    a month later

                    why when i try to load my gd2 extension.. apache show a warning say that entry point not found.

                      4 days later
                      Jimbit wrote:

                      why when i try to load my gd2 extension.. apache show a warning say that entry point not found.

                      Sounds like Apache 2 for Windows... And it sounds like a .DLL file is messed up. Have you tried downloading a fresh copy?

                        Write a Reply...