Click to See Complete Forum and Search --> : apache + php4 + win32 = satan
yes, it's true. i've, along with what seems to be many thousands of others, am unable to get php4 and apache to be happy on a windows98 machine. i SWEAR i have done and followed proper procedure on the matter.
current thoughts :
- apache is working, .html runs just fine
- php is not
the errors i get when running a .php file is as such :
- a loud annoying 'beep!'
- a long pause then timeout
errors that i've managed to get in the past while dealing with this curse of satan :
- a prompt for download of the .php file vs. the loud beep and timeout
i almost know php.ini and httpd.conf are configured properly and i copied "PHP4TS.DLL" to windows/system ("MSVCRT.DLL" is already there) i followed :
- php.net/manual/install-windows95-nt.php
- c:\php\README.TXT
- delphi oracle (this lead me here)
- various other comments i've found while trying to solve this most frustrating issue
- related phpbuilder article
the problems, as i see it, are as such :
- most all documentation is for installing php3 vs. php4 and being that the procedure is different for the two, this confuses people, especially at first.
- php4 for windows is still beta
- windows.
- when i get frustrated i start doing stupid things and get in a pissy mood but don't worry, the gun ain't loaded.
i spent a quite few hours and am giving up for a few days/weeks as if i didn't i'd end up throwing this here monitor out the window. so i'm posting this as perhaps someone knows a helpful tip to get this going. i don't need this working to live as freeBSD is my friend but i'd like to know how. anyway, later i'll reread various posts and do this from scratch with the knowledge i've gained from this experience. i'm happy for trying as learning is good and will continue.
all tips and comments welcome, even obvious ones. afterwhich i'll begin a faq/tutorial on this, one specifically for php4.
frustrated,
philip
Double check your httpd.conf make sure you've set ScriptAlias, AddHandler, and Action correctly. Also make sure everything is in the right path. If windows98 has a windows/system32 directory put PHP4TS.DLL in there. Make sure you restart your apache service too.
here are my key settings in httpd.conf :
ScriptAlias /php/ "c:/php/"
- i am running php4
- .php extension is my desire
- this is the location of my php files
AddHandler text/html .php
AddHandler server-parsed .php
- did not see this in any documentation
- is this correct , went off .shtml example
Action application/x-httpd-php "/php/php.exe"
- this should be correct
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
- this should be correct
I have :
- have DLL's in both locations (system/system32)
- php.ini is located in c:windows
It displays the .php file but does not parse it so that
in the source i see <?php echo "blah"; ?> . when
I uncomment it, it prompts for download. This means
something, but what is my question ;)
Also, FYI, in php.inc I have :
extension_dir = "C:\php"
Looks like we're getting closer. BTW, after making changes
I just restart apache, do I ever have to restart computer (like
when I modify php.ini), just curious.
All thoughts of course very welcome.
Philip
Oops... You shouldn't have any AddHandlers. Try commenting them out and restarting apache. You don't need to reinit anything after editing the php.ini file because php.exe parses it every time it is run and that is every time a script is run.
When I try to open my php files, in Netscape 4.7, it shows the source code. And in IE 5, it asks me to download. This is all the info I can think of:
PHP Folder: C:\Program Files\Php
Apache Folder: C:\ Program FIles\Php
I've added the php.ini file to the C:\Winnt directory. And the only changes I've made are:
extension_dir = C:\Program Files\php
Both the 'include_path' and 'doc_root' have no value set.
My 'httpd.conf' file looks like this:
ScriptAlias /php/ "c:/program files/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"
What I think may be the problem is that if the Action is set to "/php/php.exe", then Apache will look in C:/program files/php/php/php.exe, which does not exist =/.
I tried setting Action to "C:/program files/php.exe", but that didnt work either.
So I'm lost, cold and hungry, in the deep dark world of PHP/Apache/WinNT.I'm afraid that if I can't get this to work, I'll have to go back to ASP *shudder*:/
Any help would be greatly appreciated:/
And I really do think that they should release php/apache togther:)
cool. i didn't have those form handlers in before but i must have fixed something in the meantime as immediatly following the removel i got this error :
Not Found
The requested URL /php/php.exe/test.php was not found on this server.
which is, interesting. the link is properly placed but how php.exe got in there i do not know. the only instance of it's use is in httpd.conf here :
Action application/x-httpd-php "/php/php.exe"
and according to all documentation, this is correct. for good measure i removed the /php.exe and then got this error :
Not Found
The requested URL /php/test.php was not found on this server.
seems that is not the problem. for fun i created /php/php.exe/test.php but same error. sigh.
thoughts? /me *scratches head*
philip
Very interesting...I've done almost exactly the same thing with nearly the same results (it doesn't work) except my error message is a bit different:
Bad Request
Your browser sent a request that this server could not understand.
Invalid URI in request GET /first.php HTTP/1.0
Now...explain that one? If I make a few tiny changes in the httpd.conf file for Apache I get a file not found thing. If I try to explicitly open the file in the browser (instead of entering the URL in the location textbox) it asks me if I want to Open the file or Save the file. If I opt to Open the file I see a PHP DOS box open and scroll a whole bunch of text by and close in the space of about 800ms.
Since my first.php contains only <?php phpinfo(); ?> I'm guessing what scrolls by is the info output itself, but why in the world is it appearing in the DOS box??? Of course, it might not be that, but since I can't actually see the text that scrolls by, I really don't know it isn't.
So, I suppose I'm not contributing anything to this discussion except a "me too" statement and a silly error message...I'd be willing to try stuff out though, perhaps we can tame this daemon...
-Sam
I just give up the windows platform!
I try anything for apache + php4 + win32
especially for oracle extension. I think
the php.exe is not ok.
I change my platform to Linux+apache1.3.12+
php4.0.1pl2 and oracle is ok to connection . It's very simple to work.
Maybe I should recompiler the php4.0.lp12
for oracle ..... :(
i agree and am giving up, for now. i may try php3 sometime but more likely i'll try php4 with another webserver, just for kicks.
philip
/me sees himself waking up at 3am for another apache/php4 run
Sounds like PHP4 on windows has problems.
Have you all tried contacting the PHP.net people? I imagine they probably know of the problems, but it's not a bad idea to reinforce their knowledge.
I suggest we all go back to PHP3 where everything was safe and comfortable and check back in about a month.
Sessions? We don't need sessions.
better yet, we all can use linux where php4 is quite happy and fun!
ok where can i buy linue pls tell me
but i thought YOU were the php people! ;)
yeah, good point. i joined the php windows mailing list and will go from there, thanks everyone ... this will be solved eventually.
it's not all critical for me as i don't _need_ this working but wanted to give it the 'ol college try to see what would happen.
i pity those who depend on apache/windows.
http://www.cheapbytes.com/
because you asked "where to buy linux," i suggest corel linux but that's a whole other discussion. mandrake 7.1 is nice too, as is redhat ... and ...
if you have the bandwidth, you can download most any version of linux/unix/nix ... for free.
this thread is getting huge.
Could you followup if/when you find more info? This could help a lot of struggling windows users.
yes, will do. it's now become sort of a mission so as i wade through all this i'll organize thoughts/resources. the key here, imho, is that php3 and php4 are installed differently and people confuse the two (i did) so having a specific windows/php4 resource would/will be very nice.
it's amazing how support forums have filled up with related questions and how everyone swears they did everything 'by the book.'
which book?
Hehe, me, by the Wrox one:)
I have the same problems as you guys, trying to get Apache/PHP4 to work together. BUT, there is nothing wrong with Apache (1.3.12), it works fine. And there is nothing wrong with PHP4, it also works alright. But together? NO!
My solution was - as I needed to test PHP4/mySQL/Win98 - to swap web server to HTTPD 2. Now everything is working fine, wihtout any changes in php.ini or so!!
Of course HTTPD is a slower web server than Apache, especially when running the same CGI scripts, but it's SO easy to configure. And no all is working...
So there has to be something wrong in the "marriage" between Apache and PHP4. My guess is there errors in the documentation about the Apache conf file!
Hello
I read have of msgs but not all. I sloved my prob by removing the the fist /php/ from the action.So should have this
ScriptAlias /php/ "c:/program files/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "php.exe"
instead of
ScriptAlias /php/ "c:/program files/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"
OOzy
Everone's got the same problem with WAMP, it seems.
But there's a new glitch I've found :
(Apache, php config like yours)
Every time I invoke php.exe via my browser, the php4ts.dll (i think that's its name) crashes with an illegal access. After the crash, my Apache-DOS box is always titled "php", although it continues to work without problems.
My php.exe can be executed directly w/out any problems.
I've reproduced this error on W95OEM3 and NT4SP4
Any ideas ?
Joerg
when i remove that i am told the following :
Bad Request
Your browser sent a request that this server could not understand.
Invalid URI in request GET /test.php HTTP/1.1
at least it's a different error! hmm.
Ok, off we go:) Here\'s how I config\'ed my Win98 box to run PHP4 happily:
PHP
---------------
- for the sake of convenience, I created a folder called PHP4 and placed it in c:\\windows\\system
- with the exception of php.ini and mscrvt.dll, everything that is in the distribution goes into the /windows/system/PHP4 folder
- php.ini (placed in c:\\windows) has the extension_dir line edited to reflect the above path
ex. extension_dir = c:\\windows\\system\\php4
(note the absence of a trailing slash)
- if you download the Zend Optimizer (it does work on Win98) place ZendOptimizer.dll in c:\\windows\\system\\php4\\ and add the following lines to php.ini:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Zend Optimizer Configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
zend_optimizer.optimization_level=7
zend_extension_ts=\"c:\\windows\\system\\php4\\ZendOptimizer.dll\"
- create a folder somwhere in the apache tree to be used as an includes folder by the include() and require() functions
ex. d:/apache/htdocs/includes
- edit the include_path directive to reflect the path to the includes folder you just created
ex. include_path = d:\\apache\\htdoc\\includes\\
- if you start getting strange header outputs on your page, try commenting out any of the dynamic extension dll\'s that you\'re not using since that is usually the cause of such ugliness
- PHP4 should now be happy
Apache
--------------
- install Apache as normal
- there are three directives which need to be edited in httpd.conf: ScriptAlias, AddType, and Action
ScriptAlias
- this directive tells Apache where the php executable resides on your machine
- on my server the following is used:
ScriptAlias /php/ \"c:/windows/system/php4/\"
AddType:
- this directive specifies which file extensions are passed to the php engine for parse
- on my server, I use the following:
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
- to add support for an additional extension, simply add another line in
Action
- this directive tells Apache what to do when it reads one of the extensions specified in the AddType directive
- on my server, the following is used:
Action application/x-httpd-php \"/php/php.exe\"
After following this, you <should> have a PHP4 enabled installation of Apache. Additional dyanmic extensions, for example php_java.dll, are available from download.swwwing.com. A binary installation package of Apache 1.3.12 compiled with OpenSSL support can be downloaded from opensource.org. This distribution also includes PHP4 (I forget which version off the top of my head) which can be installed at the same time as Apache. Although this is the Apache distribution I\'m using, I didn\'t do install the copy of PHP4 included in the distribution so I have no idea how well it works. If there are any further questions, either post here or email me. Hope this helps!!!!
Cheers,
Geoff
wig@roadrunner.nf.net
// Any help would be greatly appreciated:/
Please see my other post to this thread
// And I really do think that they should release php/apache togther:)
Go to opensource.org. The kind people there have bundled Apache/mod_ssl 2.6.2/OpenSSL 0.9.5 and PHP4.0 into one distribution. Installs all in one step.
Cheers,
Geoff
yeah, that SHOULD work but ... does not for me. the difference we have is as such :
you have :
Action application/x-httpd-php "/php/php.exe"
i have :
Action application/x-httpd-php "/php/php.exe/"
when i do what you do and add the trailing slash, i get the nasty "beep and timeout errors" but without i get the :
The requested URL /php/php.exe/test.php was not found on this server.
also, where are you posting from, them extra \'s all over are rather confusing for such a delicate post, fix that! ;)
philip
i couldn't find that file anywhere on the site, location? sounds interesting.
blind,
philip
p.s. i looked everywhere and found no mention of it.
Philip,
I have no idea why the Phorum software decided to not to stripslashes() on my post, I certainly didn't tell it to do that:) If you're still gettings errors, I at a loss. The information contained in my post has fixed the problem for eveyone else I've sent it to in the past. If you want, contact my dirrectly and I'll mail you copies of my httpd.conf and php.ini.
Cheers,
Geoff
wig@roadrunner.nf.net
Opp:)
You couldn't find it cause I gae teh wrong link. Sorry about that, the link is actually:
www.opensa.org
However, I'm getting a host not found error on the site at the moment:(
Geoff
Philip,
I found a copy of the OpenSA binary on my machine. You can grab it off my ftp.
host: ftp.mithril.com
user: opensa
pass: opensa
Disclaimer:
To the best of my abilities I have adhered to the terms of the license contained in the distribution. If this is not the case, please notify me so I can make the appropriate changes.
Cheers,
Geoff
Just to add my £0.02p worth to this,
I have php3 and php4 running with apache on WinNT4 workstation (here at work) and on Win98 (at home), with no problems!
For the NT workstation, I have these lines in my httpd.conf:
ScriptAlias /php3/ "c:/php/"
ScriptAlias /php4/ "c:/php4/"
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php4 .php4
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
Action application/x-httpd-php3 "/php3/php.exe"
Action application/x-httpd-php "/php/php.exe"
Action application/x-httpd-php4 "/php4/php.exe"
So anything with .php3 extn is parsed by PHP3 and anything with .php or .php4 is parsed by PHP4 - this seems to work nicely but I have to say that I do find PHP4 substantially slower than PHP3 ... anyone else find the same?
What were you doing when PHP4 appeared slower? I don't think I've noticed any change, but then again I wasn't really looking that hard for speed differences.
If it is a little annoying, you can downloader the Zend Optimizer (http://www.zend.com/zend/optimizer) which supposedly increases speed from 40 to 100 percent.
I was wondering what the trick to get the
AddType application/x-httpd-php3-source .phps
to work, do you have to anyhting special besides put that line min the conf file?
Hey Louie,
First things first, are you using PHP 3 or 4? If you're using PHP 4, change the AddType to the following:
AddType application/x-httpd-php-source .phps
If you get it to work, the user will be prompted to either open the .phps file with an external program or save it to disk. If you want to output syntax highlighted source code to the screen (like you see at weberdev.com or px.sklar.com) you need to use the following:
<?php
show_source("/path/to/some/file.extension");
?>
where extension = any text based extension. The colour definitions for the source highlighting are found in your php.ini.
Hope this helps!!!
Cheers,
Geoff A. Virgo
Thanks Geoff, I added the AddType line but still no workie! Do I need to set up another ScriptAlias entry for php-source that points to a script that has the show_source() function in it or something? Thanks
Hey Louie,
Sorry to take so long in replying:( show_source() is a function built into PHP so no, you don't need any entries for it in your Apache httpd.conf. The only configuration settings that I am aware of that affects show_source() is the section of your php.ini where your specify the colours the function uses. The main difference between a .phps file and using show_source is the result. Linking to a .phps file will prompt the user to either choose an application to open the source file with (ie. a text editor) or save the file to their hard drive. Calling show_source() within your script will output the contents (ie. text) of the file specified in the parenthesis to the screen. This output will be syntax highlighted using the colours you specified in php.ini. For more information on show_source() check out the PHP Manual:
http://www.php.net/manual/function.show-source.php
A couple of other functions that may also serve your purposes are highlight_string() and highlight_file()
Here are the PHP Manual links:
http://www.php.net/manual/function.highlight-string.php
http://www.php.net/manual/function.highlight-file.php
Hope this helps!!
Cheers,
Geoff A. Virgo
Thanks for the info, I just wish I could figure out my old host used to just display the source automatically when .phps is used
Hey Louie,
Your comment about your previous host intrigued me so I started playing around and I think I've figured out how they did it. To implement the extension .phps as a source highlighting extension you need to do the following:
1) Change the AddType definition for .phps files from:
AddType application/x-httpd-php-source .phps
to:
AddType application/x-httpd-php .phps
and restart Apache to allow the server to detect the configuration change.
2) Place the following script into a file (preload.php for example), edit the $path variable to reflect the document root of your Apache installation, and put it in the root of your includes folder (specified in the include_path directive of php.ini):
<?php
// explode the path of the requested URL at the extension
$foo = explode(".", $REQUEST_URI);
// if the extension is 'phps'
if ($foo[1] == 'phps'){
// read Apache's document root to variable
$path = 'd:/apache/htdocs';
// construct the path to the requested source file into variable
$file = $path.$REQUEST_URI;
// highlight the file
highlight_file($file);
}
// else load the file
else{
}
?>
3) Change the auto_prepend directive of the php.ini to:
auto_prepend = preload.php
Effectively what this does is force php to evaluate the extension of every php file it is passed. If the extension of the file is .phps, the file is passed to the highlight_file() function for output. If the extension is anything else, the file is parsed and executed as normal. Hope this helps!!
Cheers,
Geoff A. Virgo
More information regarding what aspect?
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.