Solved

Installing PHP as an API or as CGI

Posted on 2003-10-28
7
334 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

815 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

13 Experts available now in Live!

Get 1:1 Help Now