#1 (permalink)  
Old 11-29-2008, 12:21 PM
Registered User
 
Join Date: May 2003
Location: Tiznit (Morocco)
Posts: 152
speckados
Question Fastcgi (Fcgid) and php.ini per user

Hello.

The issue of implementing a user php.ini by using FastCGI (Fcgid) in this Cpanel me back a little bit crazy.

The question is that following the manual and the post is in these forums, not that it is applied using a php.ini per user.

According manual y use /usr/local/apache/conf/userdata/std/2/<user>/<domain>/*.conf and this work because if put any directive for managed php values, fails reload apache. Also Apache read config file put in this folder.

Weel, on this folder i put a file named php.conf with several test. On last according FCgid, put
DefaultInitEnv PHPRC=/home/censo/php

Nothing.

Imposible for me that apache read php.ini on user home.


Any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-22-2009, 02:14 AM
Registered User
 
Join Date: Feb 2003
Location: Gothenburg, Sweden
Posts: 310
internetfab
Running fcgid on one of our servers to test it out. So far it has significantly lowered the load on the machine but we're unable to use custom php.ini 's.

Is there anyone who know's how to use custom php.ini's with fcgid, eaccelerator? We've tried both using a wrapper (even if fcgid is running as the default php option) and using php.ini in each folder where php executes. Nothing seems to be helping.

Anyone?
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-28-2009, 04:21 AM
Registered User
 
Join Date: Oct 2008
Posts: 16
mikesta is on a distinguished road
Hi, I just tried a few modifications for fcgi as apache handler and thereby I found something that might be interesting for you.

For giving every account its own php.ini, I made the following.

1. Make a backup of your files

2. Within the accounts public_html folder put a .htaccess file with the following lines in it:
PHP Code:
AddHandler php5-fastcgi .html
Action php5
-fastcgi /cgi-bin/php5.fcgi 
3. Move to the cgi-bin folder within your accounts public_html folder and add two files.

--First one is the copy of your php.ini with your modifications

--The second file name php5.fcgi and add the following lines in it:

PHP Code:
#!/bin/sh
export PHP_FCGI_CHILDREN=1
export PHP_FCGI_MAX_REQUESTS
=10
exec 
/usr/local/cpanel/cgi-sys/php5 
4.Go to usr/local/apache/conf/php.conf and put the following lines in that file:

PHP Code:
# This file was automatically generated by the Cpanel PHP Configuration system
# If you wish to change the way PHP is being handled by Apache on your system,
# use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when Apache is updated.

# This file was automatically generated by the Cpanel PHP Configuration system
# If you wish to change the way PHP is being handled by Apache on your system,
# use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when Apache is updated.
 
# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 500
MaxProcessCount 1000
DefaultMaxClassProcessCount 100
IPCConnectTimeout 60
IPCCommTimeout 60
PHP_Fix_Pathinfo_Enable 1
IdleTimeout 900
IdleScanInterval 120
BusyTimeout 300
BusyScanInterval 120
ErrorScanInterval 9
ZombieScanInterval 9
ProcessLifeTime 3600
 
AddHandler php5
-fastcgi .php
Action php5
-fastcgi /cgi-bin/php5.fcgi
AddType application
/x-httpd-php .php
 
# End of autogenerated PHP configuration. 
So thats it and works fine for me. All you have to do is to add that files to all you accounts to make it work.

Also be careful of the chmod you are giving to the php.ini for example. Depending if you wish to make your customers able to change it or if you just want to be the only one to administrate it.

Only be careful, if you recompile or update your apache, the php.conf file will be overwritten and you have to rework it.

Hope it helps.

Last edited by mikesta; 01-28-2009 at 04:25 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-28-2009, 04:43 AM
Registered User
 
Join Date: Feb 2003
Location: Gothenburg, Sweden
Posts: 310
internetfab
Thanks Mikesta, gonna have a go at it now.
You can probably add those changes to:

/usr/local/apache/conf/includes/pre_virtualhost_global.conf

to keep them between easyapache updates. So leave the default info in php.conf and add your other stuff in that file.

I'll get back to you with my results
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-28-2009, 07:13 AM
Registered User
 
Join Date: Feb 2003
Location: Gothenburg, Sweden
Posts: 310
internetfab
Made a few changes:

2.
Code:
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php5.fcgi
I didnt want my .html files to be treated like php.

4. Left php.conf as it was default and added:

Code:
MaxProcessCount 1000
DefaultMaxClassProcessCount 100
IPCConnectTimeout 60
IPCCommTimeout 60
PHP_Fix_Pathinfo_Enable 1
IdleTimeout 900
IdleScanInterval 120
BusyTimeout 300
BusyScanInterval 120
ErrorScanInterval 9
ZombieScanInterval 9
ProcessLifeTime 3600
to /usr/local/apache/conf/includes/pre_virtualhost_global.conf and restarted apache.

This makes it possible for users to choose through .htaccess if they want to use custom php.ini or not instead of enforcing it on them.

Have one issue though. Custom php.ini with eaccelerator enabled in it will result in core dumps. Any idea why this happens?
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-20-2009, 05:49 AM
Registered User
 
Join Date: Feb 2003
Location: Gothenburg, Sweden
Posts: 310
internetfab
Found my old thread. The core dumps were because of mpm-worker being multithreaded and eaccelerator not. Switched to prefork instead for now - might switch back to worker later and use APC as an accelerator instead. (Magento got hooks for APC etc)
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-21-2009, 04:30 PM
Registered User
 
Join Date: Apr 2005
Posts: 1
mhodge is on a distinguished road
mikesta and internetfab. Thanks for this, it helped a lot.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-22-2009, 04:14 AM
Registered User
 
Join Date: Feb 2003
Location: Gothenburg, Sweden
Posts: 310
internetfab
Just a heads up - easyapache comments out

Code:
AddHandler php5-fastcgi .php
from .htaccess when it's done upgrading. Just noticed this a week ago and haven't had the time to play around with it (well, except using find and replace..).

If anyone know a workaround to this "feature" let me know.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-02-2009, 12:21 AM
Registered User
 
Join Date: Feb 2008
Location: Ukraine
Posts: 13
onknown is on a distinguished road
Quote:
Originally Posted by mikesta View Post
Hi, I just tried a few modifications for fcgi as apache handler and thereby I found something that might be interesting for you.

For giving every account its own php.ini, I made the following.

1. Make a backup of your files

2. Within the accounts public_html folder put a .htaccess file with the following lines in it:
PHP Code:
AddHandler php5-fastcgi .html
Action php5
-fastcgi /cgi-bin/php5.fcgi 
3. Move to the cgi-bin folder within your accounts public_html folder and add two files.

--First one is the copy of your php.ini with your modifications

--The second file name php5.fcgi and add the following lines in it:

PHP Code:
#!/bin/sh
export PHP_FCGI_CHILDREN=1
export PHP_FCGI_MAX_REQUESTS
=10
exec 
/usr/local/cpanel/cgi-sys/php5 
4.Go to usr/local/apache/conf/php.conf and put the following lines in that file:

PHP Code:
# This file was automatically generated by the Cpanel PHP Configuration system
# If you wish to change the way PHP is being handled by Apache on your system,
# use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when Apache is updated.

# This file was automatically generated by the Cpanel PHP Configuration system
# If you wish to change the way PHP is being handled by Apache on your system,
# use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when Apache is updated.
 
# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 500
MaxProcessCount 1000
DefaultMaxClassProcessCount 100
IPCConnectTimeout 60
IPCCommTimeout 60
PHP_Fix_Pathinfo_Enable 1
IdleTimeout 900
IdleScanInterval 120
BusyTimeout 300
BusyScanInterval 120
ErrorScanInterval 9
ZombieScanInterval 9
ProcessLifeTime 3600
 
AddHandler php5
-fastcgi .php
Action php5
-fastcgi /cgi-bin/php5.fcgi
AddType application
/x-httpd-php .php
 
# End of autogenerated PHP configuration. 
So thats it and works fine for me. All you have to do is to add that files to all you accounts to make it work.

Also be careful of the chmod you are giving to the php.ini for example. Depending if you wish to make your customers able to change it or if you just want to be the only one to administrate it.

Only be careful, if you recompile or update your apache, the php.conf file will be overwritten and you have to rework it.

Hope it helps.




php works as suPHP on my server, but I need to enable fcgi-php handler for one account. Can I use this guide? I can't find /usr/local/cpanel/cgi-sys/php5 file, please help......
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
fastcgi , fcgid , php.ini , virtualhost

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:02 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc