I used the Windows installer I got for PHP at http://php.weblogs.com/easywindows and it installs ok, but then everytime I try to run a PHP page I get this error: "One of the library files needed to run this application cannot be found."

How am I supposed to know what library file it is or where it's supposed to be? I guess there's only a few core files, but the install program did the configuration.

Can anyone please help me?

Thanks,

Sonny

    Well..

    Explore your php.ini file, comment all libs and after that, uncomment them one by one to see where the problem is.

    E.g:
    ;extension=php_mysql.dll
    (commented, so not used)
    extension=php_mysql.dll
    (uncommented, so in use)

      Does PWS even use ISAPI or can you only use CGI? There's really no instructions for setting up CGI, just says to copy the php4isapi.dll to the right directory, etc. Anyhow, what is really necessary to configure in the INI file anyhow? Do you HAVE to configure doc_root, user_dir, etc? If you don't configure doc_root, does PHP just look in the directory you set your webserver to, or if some other directory, then what directory?

      -sonny

        For PWS your only way to go is php4isapi.dll. I have installed php4isapi.dll onces, it crashed a few times (exception error in php4isapi.dll) and I quickly changed from PWS to Apache's Win32 webserver for Win9x/NT/2000

        The readme (I don't know how that is now) back then clearly said php4isapi.dll was not yet fully stable.

        So; if you want CGI (which I can highly recommend) use Apache, or install on Win NT.

        I've been running PHP4 on Win98 using Apache for quite some time now, and it has proven to be very stable!

        I can't quite remember which additions I made to the php.ini file when I briefly tried the ISAPI for PWS. I remember it worked, and like with Apache, I didn't really have to change anything regarding to document roots in php.ini. Only my MySQL didn't work until I changed a setting in php.ini to point to "localhost".

        Remember, you register a registry addition for PWS which is included in the distribution (a .reg file). This makes PWS aware of PHP, in the reg file you include your paths.

        So it's not PHP that's looking for YOUR doc_root, it's PWS that's looking for PHP.

        For apache you need to change some conf settings, which is explained on many sites, http://www.alt-php-faq.org for one.

        Some people preferred Omnihttpd for Win98 instead of PWS, but I can't help you on that, never tried it. I kind of fell in love with Apache.

        The url for omnihttpd is http://www.omnicron.ab.ca/httpd/index.html

        I also recommend a search on PHPbuilder itself, I've seen many posts regarding these particular installations.

        Hope this helps you further!

          Hi,

          I finally got Apache (for Windows) and I installed it, set the directory to my working directory. but the php files aren't getting parsed. i put this directive on the first line of my php file:

          #!c:/windows/system/php

          php.exe is in c:\windows\system

          what configuration do i have to do to php.ini..i couldn't really find any answers to that. i mean, i'm still running on windows and all.

          thanks again,

          sonny :-)

            You don't need the directive on the first line.

            Place your .php files in your htdocs, in my case that's:

            c:\program files\apache group\apache\htdocs

            I created several directories there, where my .php files reside.

            First check to see if Apache itself is running. Use the shortcut in your startmenu to start Apache. A dos box will open titled "APACHE". Now go to your browser and enter:

            http://127.0.0.1/
            or,
            http://computername/
            http://localhost/

            If you see that message, at least you know Apache is up and running.

            Now check what you entered in the following .conf file:

            \Apache Group\Apache\conf\httpd.conf

            At the <b>bottom</b> of this file I added these lines:

            ScriptAlias /php/ "c:/php/"
            AddType application/x-httpd-php .php
            AddType application/x-httpd-php .phtml
            Action application/x-httpd-php "/php/php.exe"

            That was all I needed to get it running.

            In php.ini I edited this:
            extension_dir = c:\php\extensions

            If you then uncomment one extension be sure it also exists that way in c:\php\extensions, I found some inconsistancies with the DLL's name in php.ini and the "real" name in the extension dir.

            My "debugger.host" value in php.ini is "localhost".

            mysql.default_host = localhost
            (needed that before MySQL worked)

            If you checked all that, create a file with extension .php in your htdocs root.

            In this simply place:

            <?
            phpinfo();
            ?>

            Now if you put in, example:

            http://localhost/filename.php

            You should see PHP's settings and information. If you have that, then congratulations! Everything is working.

            As you can see, I've configured the .conf file to look for php.exe; not for php4isapi.dll, just like Windows NT, if you set it to php.exe instead of php4isapi.dll, you run PHP in CGI mode.

            There is indeed one situation where people need to put the directive on every first line, I don't remember when that was needed. But since you have the same configuration as me, this should just work perfectly without it.

            BTW; I've downloaded my PHP4 from http://www.php4win.de they offer pre-compiled PHP with (almost) all the extensions available.

              BTW;
              There is no real need to put PHP in your c:\windows(\system) directory. As long as the .DLL's php requires are available to him; e.g. they should be in c:\windows\system

              I just installed PHP in c:\php, and put php.ini in c:\windows\

              Anyway, there's no problem putting them where you put them, as long as you change the httpd.conf example accordingly, as well as the extension_dir example in php.ini

                Thanks for the advice Martin. I put in these lines into the config file:

                ScriptAlias /php/ "c:/windows/system/"
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .phtml
                Action application/x-httpd-php "/php/php.exe"

                (i also changed the doc_root and other directory, but that's trivial since my files are there and the change works.)

                but it still doesn't parse the file when i request it. i really don't know what's wrong here. <sigh> i created the sample file with the phpinfo function you suggested and it launched php.exe in a new dos window and did nothing. when i ran the php file i previously wrote it just didn't parse it. either way php didn't work with pws and now it doesn't work with apache. maybe this is why people use asp? ;-)

                -sonny

                  it doesn't work with apache. maybe this
                  is why people use asp? ;-)

                  Or perhaps it is why people use Linux instead of Windows 98 ;-)

                  But anyway, it's not just simply adding those lines at the end of httpd.conf (btw; I failed on the first try, and somehow it worked when I put it ALL THE WAY down at the very end of httpd.conf, but the first attempt might have been a typo I'm not sure) It's also important to look at httpd.conf at a whole, e.g. check all the settings.

                  For instance, check your ServerName setting in httpd.conf mine is "localhost".

                  Check path settings, e.g. DocumentRoot.

                  Also be sure to check your error.log which you can find in Apache's logs directory.

                  This might shed some light on what's wrong.

                  The fact that calling a .php file opens a new (dos)window and just open PHP means the mime types are not working right.

                  Apache doesn't handle your .php call, and IE thinks it needs to start this.

                  Might be because of your previous attempts to install it for PWS. Make sure you don't have any mime-types set in Windows that influence this.

                  Ofcourse obvious, but just to be sure; Apache need to be started first before any attempt of loading a php file. The PHP files need to be within the htdocs directory.

                  Other than that, you could try to put a .php file in your c:\ root directory and (WITHOUT Apache loaded, so webservices down) double click the file.

                  Windows should open the "OPEN WITH" window, and let you choose which program to use to open this with.

                  If that's NOT the case, then it's definitely a mime-type problem.

                  If it does show you the "open with" window, e.g. Windows doesn't know how to handle this. Double check your Apache httpd.conf, just for the fun of it put the addition for PHP all the way down, and re-check all your paths.

                  Really... it SHOULD work fine!!! ;-)

                  I guess you could also try to remove the traces of the work previously done for PWS. That means manually removing the registry key you supposed to have previously installed for PWS.

                  If all fails and you get a reasonable error in your error.log from Apache, report it back here perhaps it will tell us more about the reason...

                  If you don't get any error logs from Apache, and you've done and checked all of the above, try posting the problem again here, but also in alt.php (newsgroup).

                    Let me ask about the MIME types you mentioned. So a php file should NOT be associated with any program in Windows? How come? It was for my directory, so I deleted the association between php files and PHP.exe which was present. I also deleted the stuff in the registry I had put there for PWS.

                    Guess what. The very simple PHP page I wrote before actually got parsed! However, the one containing the phpinfo function didn't get parsed. What library do I need for that function?

                    Thanks a bunch. I'm finally getting there thanks to you.

                    -Sonny

                      Right, a PHP file should not be associated. The only thing that has anything to do with it, is your webserver, may it be PWS, IIS or Apache, omni or whatever. They are the only ones concerned with .php files.

                      Let me remind you, PHP is not created by Microsoft ;-) And associating PHP with Microsoft, (even as a mime-type) is perhaps an insult to the PHP scene ;-))

                      So yeah, obvious it went wrong.

                      The reason why:
                      <?
                      phpinfo();
                      ?>

                      Doesn't work is at the very least... strange. This is the very basic testing method to see if you have php abilities. Making that script work should be your #1 priority. It tells you PHP is up and running and also gives you information about version, modules, extensions whatever.

                      Check your apache log files for traces and clues on this. Is it in the same path as your other script is? What version of PHP are you using?

                      Anyway, I warmly welcome you in the world that's called PHP. If your learning curve is as steep as mine was, you'll be in for alot of fun. I'm glad I got you there, at least one converted ;-)

                      I've been using ASP for quite a while and got the hang of PHP within a month. I can't live without PHP anymore ;-)

                      Alot of questions will come to you; like "I used to do this and this in ASP can that be done in PHP" and I can only say, stick to phpbuilder it's a nice community ;-)

                      Next step is to put Visual Interdev aside and download Allaire Homesite from www.allaire.com, but hey... that's just a personal taste..

                        Got it. I had my doc_root and everything in the apache config file ok but it was the doc root in the php.ini file was wrong. whew. homesite has some support for php tag syntax i heard..any other recommendations are definitely appreciated.

                        i never really used asp. what i did was make a comparison of asp, jsp, and php before i chose a language to write my middleware...and i chose php. step 2 was to actually set it up. maybe i can actually use it for something now. :-) btw, do you know how to set a default document in apache?

                        -sonny

                          Ehh.. Have to check that, but I believe such things can be set in your .conf files found within the apache directory.

                          I know I've come across such files.

                          Let me quess, you want to enable index.php as default document ;-)

                            a year later

                            Now - it's my turn. I keep getting a "400" error. i check my log file and it says bad request. i'm running php with apache, both on win2k. i've been at this for 3 day so far. i really would like to make this work.

                              Write a Reply...