Re: [Mod-fcgid-users] mod_fcgid, php-fcgi and PHPRC

2008-06-13 Thread Tobias Wiersch
Hi Igor,

Igor R. schrieb:
 But I don't want to make a new wrapper and change PHPRC variable after each
 new user creation. 
   

I patched suexec to do this (to get rid of the wrapper-script). My
suexec is allowed to only call the php-exe and nothing else.
In addition, I put in PHPRC and PHP_FCGI_MAX_REQUESTS.

To do this, I replaced the function call of clean_env with:
static void clean_env(const char *uname)

In clean_env I added some env-vars:
sprintf(pathbuf, PHP_FCGI_MAX_REQUESTS=%s, 250);
cleanenv[cidx]=strdup(pathbuf);
cidx++;
sprintf(pathbuf, PHPRC=/home/%s/config/, uname);
cleanenv[cidx]=strdup(pathbuf);
cidx++;

And I call clean_env with the current user:
target_uname = argv[1];
pw = getpwuid(atoi(target_uname));
actual_uname = strdup(pw-pw_name);
clean_env(actual_uname);

As you can see, the PHPRC for a any user is: /home/xxx/config/
Where xxx is the username.

Hope this helps ...

Greetings ... Tobias


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users


Re: [Mod-fcgid-users] mod_fcgid, php-fcgi and PHPRC

2008-06-13 Thread Igor R.
Hi All,

Thanks to all who responded regarding my issue. I solved it with the help of
writting the wrapper with the following content: 

#!/bin/bash
USER=`id -un`
export HOME=`/usr/sbin/pw user show $USER | awk -F : '{print $9}'`
export PHPRC=$HOME/public_html/php.ini
export PHP_FCGI_CHILDREN=0
exec /usr/local/cpanel/cgi-sys/php5.bin

the code was created for  FreeBSD, that's why it will be requiered to
correct this code in for $HOME varible processing for Linux, for instance in
such a way:

HOME=`/bin/cat /etc/passwd | grep $USER: | awk -F : '{print $6}'`

--
Regards,
Igor R.
Technical Support Teamleader
WebHostingBuzz.com
 



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users


Re: [Mod-fcgid-users] mod_fcgid, php-fcgi and PHPRC

2008-06-12 Thread [EMAIL PROTECTED]
On Wed, 11 Jun 2008 18:44:15 +0300
Igor R. [EMAIL PROTECTED] wrote:

 Hello All,
 
 Havng read a lot of articles about FastCGI, I decided to use this
 module to speed up processing of php and RoR applications.
 I use CPanel as a hosting  panel. And I use Apache with suexec
 support as a web server. After compilling apache php and mod_fcgid 
 I faced the problem of determination PHP directives for our server
 users. Tasks of PHP directives don't work with .htaccess file, 
 I wouldn't change the variables in global php.ini file. 
 I have looked through the documentation and I discovered that the way
 to php.ini file can be pointed via variable PHPRC. 
 I've wrote wrapper which installs PHPRC before php execution.
 Everything works perfect if the full path to php.ini file in PHPRC is
 set up, e.g.: 
 
 [ttyp0:hr4] [13:17] [EMAIL PROTECTED] cat /usr/local/cpanel/cgi-sys/php5
 #!/bin/bash export PHPRC=~ssitest/public_html/php.ini
 exec /usr/local/cpanel/cgi-sys/php5.bin
 
 But I don't want to make a new wrapper and change PHPRC variable
 after each new user creation. 
 Is it able to get such data as user's DOCUMENT_ROOT to use this data
 for PHPRC var value, e.g.:
 
 export PHPRC=$DOCUMENT_ROOT/php.ini
 exec /usr/local/cpanel/cgi-sys/php5.bin
 
 --
 Regards,
 Igor R.
 WebHostingBuzz.com

My solution for running apache+php-cgi+suexec+mod_fcgid was to create a
special directory for each user (e.g. fastcgi-bin or fcgi-bin) which
would contain a php wrapper script and a php.ini. Nothing needs
customizing, I invoke the php.ini from within the wrapper with this:

PHPRC=`/bin/pwd` (path may differ on your os)

and it works very well, to be frank it works very god darn well both in
terms of performance and security (websites actually feel snappier
than with mod_php).

If you can automate somehow the copying of this directories and the 2
files in each user's home (or wherever you call it from httpd.conf from)
then you're all settled.

 
 
 -
 Check out the new SourceForge.net Marketplace.
 It's the best place to buy or sell services for
 just about anything Open Source.
 http://sourceforge.net/services/buy/index.php
 ___
 Mod-fcgid-users mailing list
 Mod-fcgid-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users