Jump to content
The Uniform Server Community
vaalf

FastCGI for UniServer Zero XIV

Recommended Posts

Hi,

I just wonder how to set the UniServer ZeroXIV to work in "FastCGI" or "FRN" mode?  I consulted provided offline and online documentations and forum but couldn't find any clue there.

I also need to customize UniServer settings to "allow_url_fopen" or "cURL" must be enabled. (I already know that this is to be done through editing php.ini file)

The following requirements need to be met as well:

  1. OpenSSL Libraries
  2. GD Library support
  3. cURL Library support
  4. Support for mb_* functions in PHP to use multibyte strings

Thanks for your prompt support.

Ehsan

Share this post


Link to post
Share on other sites

My apologies for the delay in replying to this thread... Uniform Server by default ships with php loaded as a module and not using FastCGI, However, UniformServer is built to be modular and you should be able to update it to run PHP over FastCGI using the Apache mod_fcgid module. To do this you will need to make the following changes:

  1.  The Apache config file that loads PHP is in /core/apache2/conf/extra_us/php74.conf. Back this file up as it is using the php7 loaded as a module.
  2. Download the attached php74.conf which uses mod_fastcgi and loads php via it by mapping the .php files to the fcgid-script handler and setting the php-cgi path. You can replace the existing /core/apache2/conf/extra_us/php74.conf with the attached php74.conf after backing up the one you have.
  3.  Download the httpd-fcgid.conf file (attached) and store it in the /core/apache2/conf/extra folder. This file gives the configuration options for fcgid module in apache.
  4. Rename the  /core/php74/php-production.ini to /core/php74/php.ini. For some reason mod_fcgid only picks up the php.ini file with that specific name. The downside of doing this is that you can no longer control the php.ini using the Unicontroller which you normally can do from the PHP menu in UniController, so you will have to make any modifications to this file manually
  5. In the /core/apache2/httpd.conf file, you will need to change the Alias to ScriptAlias  [Lines 405 to 415] to allow php to run otherwise since these are outside the DocumentRoot will give you a Forbidden error for those apps like PHPMyAdmin running in us_opt1
  6. Restart the Apache server and PHP should now be running over FastCGI. You can confirm this by going to PHP->View phpInfo  from UniController and under the Server API will show CGI/FASTCGI 

To answer the 2nd part of your question: You can change the php.ini config file (which you renamed in Step 4 above) to get what you want. You normally can change this directly from UniController PHP Menu, but since it has been renamed, it needs to be done manually. 

  1. To enable cURL, openSSL etc you can do that by removing the ";" (uncommenting the line) in front of the /core/php74/php.ini for those extensions on lines 924 to 960 of the php.ini file. GD2 (line 928) and MBString (Line 934) are enabled by default. You can validate this on the  PHP->View phpInfo, Extensions page.
  2. For allow_url_fopen in specific you can change the value to On on line 868.

Please do let me know if you have any more questions or not getting PHP to run over FastCGI.

 

Note: There is one caveat though that I can't seem to figure out myself... The mod_fastcgi seems to be spawning multiple processes of php-cgi.exe and does not get terminated when the script ends or when Apache is stopped, so this keeps filling up the memory. If you or somebody can help out here, to let me know which setting needs to be tweaked to prevent this from happening would help.

php74.conf httpd-fcgid.conf

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...