Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php.exe vs php-cgi.exe Ver 5.1.1

Status
Not open for further replies.

KarterJK

Programmer
May 11, 2004
27
0
0
US
Hi to all,

I installed PHP 5.1.1 .zip file on a Windows 2003 server, while I initially was using the php5isapi.dll, unfortunately to change configurations using windows registry the .dll ignores any registry entries and would need to run in CGI mode to use these.

In reading the install.txt it refers to using either the php.exe and/or the php-cgi.exe (which both are included in the .zip version)

I do have PEAR installed,
So my question is which should I use php.exe or php-cgi.exe and what are the differences.

Thanks ahead of time
 
i have never had a problem with the isapi module on a win 2003 server (and use a few of them). i always set the registry and the environment variable for the php.ini and have not had problems with them. I am running the 5.1.1 build on at least two of my servers.

if you are running php to power web applications i would really recommend using the sapi module and not the cgi.

to answer your question: i use php-cgi when i am using php in cgi mode, and php.exe when i want to run scripts from the command line.

 
Thanks for the reply,

Ummm, I did go back and check the manual, it didn't mention anything about cgi mode and the registry. I am uncertain now as to where I read this information.

But, the fact remains its not reading my value.

For my php.ini, my pathing is set using the system enviroment not via the registry.

What I am trying to accomplish is to have each web site have its own individual include_path

I entered this into the registry
Example:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\Per Directory Values\C\domain1\httpdocs]
"include_path"="C:\\PHP\\includes\\domain1"

where c:\domain1\httpdocs
is the entry point for this particular website
and the entry properly exists within the registry
however, it doesnt point to this when I do a phpinfo() on the site.

Any suggestions?
Thanks





 
Here is where I got the idea registry is only goof for CGI

The configuration file

The configuration file (called php3.ini in PHP 3, and simply php.ini as of PHP 4) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI version, it happens on every invocation.
 
i haven't got a handle on what you want to do yet. at a guess i think what you want is to create virtual directories or multiple sites with different php.ini directives for each site. is this right?

If so, cgi is one route. but you can still use sapi modules too. see this article which should set you on the right track:
 
Thanks jpadie for the reply

And sort of is the answer to your question.

I realize that by using the application process you can assign different php versions (copies) to run for each site.

But what I didn't want to have to do is install seperate copies(versions) for each web site.

Essentially, I want to use PHP 5.1.1 or whichever is the latest version for all sites and then have each site have its own unique include directory

example:
domain1.com c:\php\include\domain1
domain2.com c:\php\include\domain2....
etc.

Thats why I thought the registry method Per Directory value
was the answer. However, it is turning out to be more complicated than I first thought.






 
i know you can do this for cgi. i don't know that the registry is important though. from dim memory on an apache server you just had to make sure that there was not a php.ini in either windows or system32 directories. it would then first look for php.ini in the root of the website that was calling the directory.

of course it's much easier to do altogher on apache if you are ok leaving IIS and moving (in fact you never say you are on IIS - i'm just assuming it from the fact that you say windows 2003 server).
 
Well
okay after some playing around here is what I finally came up with to resolve my situation

Phew!!!
in IIS6 anyway you have the
Web Sites Branch the main one not Default Web Site
* on Web Sites
* I mapped the .php .php3 .php4 extensions to point to c:\php\php5isapi.dll and applied it to all of my sites

what this did was load the *.dll extensions and default settings for each site....it reads no php.ini

with just this set... each site has PHP with default settings

then I had to copy
php-cgi.exe
php.ini
into each directory homepage

and then mapped the .php .php3 .php4 extensions to read
c:\inetpub\and
c:\inetpub\ .... etc

for each individual site
what this did then was to read the php-cgi.exe and load that domains particular php.ini

I hope that makes sense....

So thank you for all of the help
:)
Don
PDX Oregon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top