Solved

Installing PHP as an API or as CGI

Posted on 2003-10-28
7
332 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

12 Experts available now in Live!

Get 1:1 Help Now