473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

unix and Windows php script compatibility


I'm a php novice and am developing a shopping cart application for a
client who is hosted on a unix server. The hosting service requires that
each php file have #!/usr/local/bin/php at the top. When I test these
pages on my developer Windows php installation I get errors because
Windows does not recognize the bang command so it is passed on as
content to the php server.

Any suggestions on hiding the first line from windows while still having
unix see this?

Any help would be appreciated. This is driving me bonkers.

Michael
Jul 17 '05 #1
9 3056
On Wed, 17 Sep 2003 17:36:32 +0000, Michael Appelmans wrote:
The hosting service requires that
each php file have #!/usr/local/bin/php at the top.

My first suggestion is to get a new hosting service...a shebang is only
required in Perl scripts from my experience. Have you tried executing PHP
scripts on this hosting service without the shebang and just using <?PHP
to open the script?

--
Jon Trelfa
Registered Linux User #164332
There 10 kinds of people in this world...
Those who understand binary and those who don't
Jul 17 '05 #2
On Wed, 17 Sep 2003 17:43:01 -0400, Jon Trelfa wrote:
a shebang is only required in Perl scripts from my experience.

Nope.. if you write a PHP cmdline script, you need to include a shebang
line, unless of course, you exec it as: 'php foo.php'.

Sounds like the hosting server is running PHP in CGI mode rather than as a
module, hence the requirement of the shebang line as this is then
interpreted in the same way a Perl script is.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #3
On Wed, 17 Sep 2003 21:41:21 +0000, Ian.H [dS] wrote:
Sounds like the hosting server is running PHP in CGI mode rather than as a
module, hence the requirement of the shebang line as this is then
interpreted in the same way a Perl script is.


I stand corrected. I've always run PHP as an Apache Module so I never
encountered the need for it.

Thanks!

--
Jon Trelfa
Registered Linux User #164332
There 10 kinds of people in this world...
Those who understand binary and those who don't
Jul 17 '05 #4
Michael Appelmans wrote:
I'm a php novice and am developing a shopping cart application for a
client who is hosted on a unix server. The hosting service requires that
each php file have #!/usr/local/bin/php at the top. When I test these
pages on my developer Windows php installation I get errors because
Windows does not recognize the bang command so it is passed on as
content to the php server.

Any suggestions on hiding the first line from windows while still having
unix see this?

Any help would be appreciated. This is driving me bonkers.

Michael


It looks like they only want you to use PHP as CGI (a Bad Thing (tm)).
If this hosting provider is advertising that they allow PHP on their
servers, they're only half right (IMO).

I would get a new provider or tell them that you want PHP parsing done
within the HTTP stream (ie. put the correct settings in their web
server's config). If very many people are running PHP on their server,
it will also alleviate some load since running CGI PHP is more
resource-intensive than running PHP in module form (based on my
experience with Apache).

If there's no way around this, look up using PHP as CGI (chapter 3 in
the manual: "Servers-CGI/Commandline," or, better yet, try Google: "php
cgi").

HTH,
Zac

Jul 17 '05 #5
On Wed, 17 Sep 2003 19:15:49 -0400, Jon Trelfa wrote:
I've always run PHP as an Apache Module so I never
encountered the need for it.

I do too Jon.. never have tried CGI mode.. just picked up snippets of info
along the way =)


Thanks!

No probs.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #6
Well there you have it, I've inherited another can of worms, a site on a
web hosting service (XO.com) running PHP in cgi mode (shades of the dark
ages,eh?). I guess I can comment and uncomment the directive based on
which OS but a pain in the derriere. Would be cool to have a script to
automate that. Maybe I'll have to dust off my Rebol.

Thanks for the comments.

Michael

In article <pa****************************@hybris.digiserv.ne t>,
ia*@WINDOZEdigiserv.net says...
On Wed, 17 Sep 2003 17:43:01 -0400, Jon Trelfa wrote:
a shebang is only required in Perl scripts from my experience.

Nope.. if you write a PHP cmdline script, you need to include a shebang
line, unless of course, you exec it as: 'php foo.php'.

Sounds like the hosting server is running PHP in CGI mode rather than as a
module, hence the requirement of the shebang line as this is then
interpreted in the same way a Perl script is.

Regards,

Ian

Jul 17 '05 #7
Zac Hester <ne**@planetzac.net> writes:
I would get a new provider or tell them that you want PHP parsing done
within the HTTP stream (ie. put the correct settings in their web
server's config). If very many people are running PHP on their
server, it will also alleviate some load since running CGI PHP is more
resource-intensive than running PHP in module form (based on my
experience with Apache).


Maybe this hosting provider does some kind of cgiwrap thing to have the
PHP scripts run under the user's own id. If so, I can understand why
they'd want to do it that way.

--
"Notwithstanding fervent argument that patent protection is essential
for the growth of the software industry, commentators have noted
that `this industry is growing by leaps and bounds without it.'"
-- US Supreme Court Justice John Paul Stevens, March 3, 1981.
Jul 17 '05 #8
The stupid but easy way to do this is to use something like EditPad
Plus or something like that. You can do something like <!-- PHP
Location --> on windows and then do find and replace in all files.
EditPad does global replace.

- Bogdan
Jul 17 '05 #9
Bruce Lewis wrote:
Zac Hester <ne**@planetzac.net> writes:

I would get a new provider or tell them that you want PHP parsing done
within the HTTP stream (ie. put the correct settings in their web
server's config). If very many people are running PHP on their
server, it will also alleviate some load since running CGI PHP is more
resource-intensive than running PHP in module form (based on my
experience with Apache).

Maybe this hosting provider does some kind of cgiwrap thing to have the
PHP scripts run under the user's own id. If so, I can understand why
they'd want to do it that way.


Indeed, it would be understandable. Doing some kind of setuid scheme
with the PHP CGI binary would have security advantages over having the
PHP scripts running under the web server's user (as an Apache module).

However, in favor of efficiency, I would rather just run my web server
as an unpriveledged user and let everyone run PHP as a preprocessor
instead of CGI (which is how we do it where I work--ISP with a good bit
of web hosting to throw around).

I guess it depends on who's trying to hack your web server (outside
attacks (like DoS) or people who have purchased your service and have an
account on your server). Then, one method would clearly be better than
the other in only one case.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olivier Laurent | last post by:
Hello, I guess it's a bit off topic but my script is written in PHP so I guess somebody out there could help me. I'm facing the well known issue between windows and UNIX related OS. The...
2
by: Mike Kent | last post by:
I need to deploy a Python app on both SCO Unixware and old SCO Unix boxes. We freeze the app under Unixware, and set the compatibility flag ('elfmark -t udk') on the resulting executable. We...
3
by: dpackwood | last post by:
Hello, I have two different scripts that do pretty much the same thing. The main perl script is on Windows. It runs and in the middle of it, it then calls out another perl script that then...
0
by: Aashif | last post by:
I want to call Unix Shell script which is available in other Server (Unix server) from windows application using C#. Currently the shell script runs the C program but the GUI is not good, So I want...
1
by: Ben | last post by:
Hi, I have a python script on a unix system that runs fine. I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. I now want to run them on the...
2
by: sunilsn | last post by:
Hi, I am newbie to perl, I hope you guys will help me resolve the challenge I am facing. I have a unix shell script on one UNIX machine say A, and a batch file on windows machine say B. Now I want...
7
by: programming | last post by:
Hi all, i have been having trouble with a login script that works on my windows machine, however when i upload it to the Unix server through VPN, the same script won't work! It won't parse...
4
by: jane007 | last post by:
Hello everybody: I am having a problem. On Unix platform, there is a script that need user to input data from console, then when I call Unix perl script from Windows, these is an issue occurs,...
15
by: Logician | last post by:
I want to use UNIX to develop c# applications, does anyone have any details of compatibility issues?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.