473,545 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3067
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.ne t | 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.ne t | 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.digise rv.net>,
ia*@WINDOZEdigi serv.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.

--
"Notwithstandin g 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
1651
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 file format is crucial. The file is made on a linux box and as to be parsed on a windows box by a commercial software (so I cannot play with the code...
2
1299
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 successfully did this using Python 1.5.2. Recently, we decided to upgrade the app to use Python 2.3.2. Unfortunately, we've just discovered a nasty...
3
6533
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 should run on a Unix box I have. Both scripts run ok, except for the part when Windows try's to call out the Unix script. I have it set up where the Unix...
0
3033
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 to create GUI in C# windows application and call that C program using Shell script so first I have to call unix shell script from C#. Please guide me...
1
295
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 same system, actually in the same script by combining bits and pieces. But whatever I try my windows tabs get converted to spaces when I transfer...
2
6975
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 to write a perl script on windows box which can trigger both, the batch file on B and the script on A Would you please help me...
7
2058
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 member.txt properly i think. The password and usernames i am using are at the bottom of this post. Each time i go to login on the unix server, it clears...
4
3772
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, when I input data and enter "enter" so fast, the Windows console is freezed, I don't know why, does anybody know?Thank you very much. My code...
15
1787
by: Logician | last post by:
I want to use UNIX to develop c# applications, does anyone have any details of compatibility issues?
0
7496
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7452
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7784
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6014
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3485
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1039
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.