PDA

View Full Version : *that string* on home computer


aza
4-22-02, 02:42 PM
Is there any way to install PHP on my home computer (WinME, Apache Webserver) so I can add that string without any notice?

MannInc
4-22-02, 08:48 PM
Yes, you can indeed install PHP under the Apache Server. Try heading over to http://php.net and downloading PHP. PM me if you run into any problems and I should be able to assist, as I have PHP and Apache running on my win98 computer.

Mirzabah
4-22-02, 09:00 PM
Originally posted by MannInc
Yes, you can indeed install PHP under the Apache Server. Try heading over to http://php.net and downloading PHP. PM me if you run into any problems and I should be able to assist, as I have PHP and Apache running on my win98 computer. I think aza was specifically asking how to install PHP in CGI mode so that his home environment matches powweb's - specifically in it's requirement of the #!/usr/local/bin/php line at the top of each directly requested PHP file.

In most cases you don't need to install PHP in CGI mode. When it sees the #!/usr/local/bin/php line, PHP will spit it out to the client which in most cases will ignore it... or perhaps it is mangled into a blank line somewhere along the way, I'm not sure. Whatever happens to it, it does no harm (under IIS & PWS anyway, I don't know about Apache) The only problem comes when you try to set cookies or perform other HTTP header trickery. Upon seeing the #!/usr/local/bin/php, PHP or maybe the HTTP server consider it the end of the HTTP headers and the start of the HTML. Any attempt to send headers after this point results in an error.

MannInc
4-22-02, 09:05 PM
I have PHP installed on top of the Apache server. I run PHP pages with the #!/usr/local/bin/php line at the top of the page and it doesn't show when I access it.

PHP 4 for windows includes the ability to set it up as either in CGI mode or api mode.

aza
4-23-02, 06:31 PM
2Mirzabah: yep, that's the problem, I'm afraid :rolleyes:

Thinking about some good solution to this problem and nothing comes to mind. A lot of people around here assert that this string is not a problem at all for creating PHP strings ... but it is for me!

I create PHP script file, test it on my home computer, than add that string and only then upload to server ... after 30 minutes I get another idea in my scull about that script - so I delete that string and edit my PHP script file on home computer, test it, add that string -> upload to the server .... :rolleyes: .... The problem is that I get new ideas quite often. :rolleyes:

So I thought I'm not alone in this and someone has already found way how to put that string and just forget about it without any notice while testing on home computer.

Mirzabah
4-23-02, 09:54 PM
Originally posted by aza
2Mirzabah: yep, that's the problem, I'm afraid :rolleyes:

Thinking about some good solution to this problem and nothing comes to mind. A lot of people around here assert that this string is not a problem at all for creating PHP strings ... but it is for me!And for me too, but that's the way it is and we just have to live with it. If powweb installed PHP properly now, it would probably break innumerable scripts that currently work.

Originally posted by aza
I create PHP script file, test it on my home computer, than add that string and only then upload to server ... after 30 minutes I get another idea in my scull about that script - so I delete that string and edit my PHP script file on home computer, test it, add that string -> upload to the server .... :rolleyes: .... The problem is that I get new ideas quite often. :rolleyes:

So I thought I'm not alone in this and someone has already found way how to put that string and just forget about it without any notice while testing on home computer.As I said, you may find that you can get away with leaving that string in there on your home system for most cases - try it and see what happens. An alternative strategy is to wrap your scripts. For instance, you put the bulk of your code in a file called index.inc.php and include it in a file called index.php which contains nothing but the include statement. That way you can have a different index.php on your home machine and on powweb.

aza
4-24-02, 01:50 AM
Yes! That what I was looking for!.. Include file! - empty one on home machine and with that string on PowWeb server.

Thank you for help. This one is really beautiful and most convinient solution to the problem, I suppose.