Solved

Installing PHP as an API or as CGI

Posted on 2003-10-28
7
333 Views
Last Modified: 2006-11-17
I have an Apache server with php installed but i am not sure which way I should have it running, either as an API or as CGI.

Please tell me the pro's and con's.

Thanks.
0
Comment
Question by:TaintedGod
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:scully00000
ID: 9641180
This is from the PHP install.txt

----------------

PHP 4 for Windows comes in two flavours - a CGI executable (php.exe),
and several SAPI modules (for exapmle php4isapi.dll). The latter form
is new to PHP 4, and provides significantly improved performance and
some new functionality. However, please note that the SAPI modules
are *NOT* yet considered to be production quality.
In particular, with the ISAPI module, you are likely to encounter serious
reliability problems especially on platforms older than W2K - you may
witness a lot of server 500 errors and suffer from other server modules
such as ASP also failing. You have been warned!

The reason for this is that the PHP SAPI modules are using the
thread-safe version of the PHP code, which is new to PHP 4, and has
not yet been tested and pounded enough to be considered completely
stable, and there are actually a few known bugs. On the other hand,
some people have reported very good results with the SAPI modules,
and there a few reports of problems with the Apache module version.
In short - your mileage may vary; If you need
absolute stability, trade the performance of the SAPI modules
with the stability of the CGI executable.

--------------

Basically, the API modules are still not considered 'production quality' i.e. doubts about their stability, BUT they're much faster than the CGI executable. If you need mission-critical stability, CGI, fast performance, API

Hope that helps
0
 
LVL 2

Author Comment

by:TaintedGod
ID: 9644918
I believe that should be enough but I heard that there are some functions and scripts and stuff that dont work with one or the other, i wanted to know which one is more portable.

Thanks
0
 
LVL 2

Accepted Solution

by:
scully00000 earned 125 total points
ID: 9649099
TaintedGod

Any script should theoretically work with the API or the CGI. The only time they don't is if you write a script containing PHP functions from a library that isn't usually included with the production release (for example, PDFLib which allows PHP to write PDFs). However, if you are using these kind of functions you will have to check any webserver you deploy the script on - regardless of whether it's using CGI or API.

Hope that helps

Cheers
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:TaintedGod
ID: 9653216
Then i shall stick with CGI. Thanks.
0
 
LVL 2

Expert Comment

by:scully00000
ID: 9653691
TaintedGod

Thanks for the points. Out of interest, why the CGI version?

Cheers again
0
 
LVL 2

Author Comment

by:TaintedGod
ID: 9660480
Well under phpinfo() it says fast CGI and I am using windows so the more stable the better.
0
 
LVL 2

Expert Comment

by:scully00000
ID: 9660721
Fair enough. Good luck.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now