View previous topic :: View next topic |
Author |
Message |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri May 04, 2007 6:26 pm Post subject: Running PHP in FastCGI Server Mode! |
|
|
Hello Everyone,
I'm here today to bring you a tutorial on installing PHP5 on Windows as a FastCGI Server. Recently Aprelium has release v2.4.0.3 of Abyss Web Server. This new version of Abyss, allows you to run FastCGI externally using the "FastCGI (Remote - TCP/IP sockets)" option.
First thing you need is PHP5 (Zip Archived package). You can download the latest version from
www.php.net (PHP 5.2.2 is the newest and recommended).
Step 01.
Unzip the contents from the Zip Archive file that you downloaded from php.net to a new folder C:\PHP5 (You need to create the PHP5 folder yourself.)
Step 02.
Open a command line (Start -> Run -> cmd.exe) and change to your PHP5 folder "cd C:\PHP5"
Step 03.
Type this command "php-cgi.exe -b 127.0.0.1:2700" in the command line. This will start the server (By the way, it's multi-threaded!)
Step 04.
Now that we have our server runnning, let's configure Abyss Web Server to connect to it. Open your abyss console and click Configure for the Host you wish to configure. Go to "Scripting Parameters" and click "Add" in the Interpreters table (Click the Edit icon if your following the "PHP FastCGI Backup System" tutorial). Copy the following settings
Interface: FastCGI (Remote - TCP/IP sockets)
Remote Server IP Address: 127.0.0.1
Port: 2700
Type: PHP Style
Now click "Add" in the "Associated Extensions" table and type "php" without the quotes. Note: You shouldn't need to do this if you're following the tutorial for "PHP FastCGI Backup System". Link: http://www.aprelium.com/forum/viewtopic.php?t=12766
Save your settings!
Click "Add" in the "Environment Variables" table and add the following settings.
Name: REDIRECT_STATUS
Value: 200
Note: You only need to do this part if you don't have it already listed.
Apply your settings and restart Abyss Web Server.
It's time to test it!
Create a new file in your htdocs folder and call it "phpinfo.php". Add the following code to that file.
Code: | <?php phpinfo(); ?> |
Save the code run it from your browser "http://localhost/phpinfo.php".
Now, instead of multiple FastCGI processes, you can run your PHP scripts from a multi-threaded FastCGI server! Enjoy!
Note: The address for the FastCGI server can also be remotely accessed by other servers unless you keep it at "127.0.0.1".
Note: You can also create a batch file so that the FastCGI server can be runned at startup.
Example batch code: fastcgi_server.bat
Code: | @echo off
echo The FastCGI Server is started!
C:\PHP5\php-cgi.exe -b 127.0.0.1:2700 |
I hope everyone liked the tutorial.
Last edited by TRUSTAbyss on Wed May 16, 2007 4:22 pm; edited 1 time in total |
|
Back to top |
|
 |
gctmpr -
Joined: 28 Apr 2007 Posts: 18
|
Posted: Wed May 16, 2007 4:03 pm Post subject: |
|
|
can i use php 521 ?
because PHP 5.2.2 i use, my side become error..
install back php521,site become normal _________________ wap site-
arunothai.myvnc.com/registered
username-abyss
password- free
web site
[url]arunothai.myvnc.com[/url] |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Wed May 16, 2007 4:22 pm Post subject: |
|
|
PHP 5.2.2 is the only version that has the FastCGI Server. Unless you're on a Mac/Linux/FreeBSD OS. |
|
Back to top |
|
 |
gctmpr -
Joined: 28 Apr 2007 Posts: 18
|
Posted: Wed May 16, 2007 5:22 pm Post subject: |
|
|
after delete php 522, back to php 512...
all setting is o.k...
but web site just can connect with local net
cant connect to my side ,help _________________ wap site-
arunothai.myvnc.com/registered
username-abyss
password- free
web site
[url]arunothai.myvnc.com[/url] |
|
Back to top |
|
 |
JaturontThan -
Joined: 29 May 2008 Posts: 3
|
|
Back to top |
|
 |
luka8088 -
Joined: 24 Feb 2009 Posts: 2 Location: Rijeka, Croatia, Europe
|
Posted: Tue Feb 24, 2009 1:45 pm Post subject: it is not multi-threaded ... |
|
|
php-cgi is not multi-threaded ....
try this code:
<?php
sleep(10);
phpinfo();
?>
and then open 3 browser tabs, and call open that script from all 3 at the same time... you will see that first will finish after 10 seconds, second after 20, third after 30... and that is single-thread....
or am I wrong ?? |
|
Back to top |
 |
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Feb 24, 2009 6:02 pm Post subject: |
|
|
You're right. PHP is only a single threaded application, hence the behavior your seeing |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Mar 13, 2009 4:44 pm Post subject: Re: it is not multi-threaded ... |
|
|
luka8088,
You are running a single instance of php-cgi and it is not multithreaded hence the behavior you are getting.
It is recommended to set the FastCGI mode with local pipes/local TCP/IP as it allows Abyss Web Server to launch as many instances as required and you won't get that behavior (Abyss can manage several instances of PHP and load balance processing between them). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
luka8088 -
Joined: 24 Feb 2009 Posts: 2 Location: Rijeka, Croatia, Europe
|
Posted: Fri Mar 13, 2009 5:01 pm Post subject: Re: it is not multi-threaded ... |
|
|
aprelium wrote: | luka8088,
You are running a single instance of php-cgi and it is not multithreaded hence the behavior you are getting.
It is recommended to set the FastCGI mode with local pipes/local TCP/IP as it allows Abyss Web Server to launch as many instances as required and you won't get that behavior (Abyss can manage several instances of PHP and load balance processing between them). |
yes, I know.... but I just wanted to correct:
Quote: |
Step 03.
Type this command "php-cgi.exe -b 127.0.0.1:2700" in the command line. This will start the server (By the way, it's multi-threaded!)
|
|
|
Back to top |
 |
 |
|