PDA

View Full Version : Wordpress, permissions, mod-php, suphp


voidzero
2nd September 2009, 00:05
Hello,

On one of my sites I'm running Wordpress. It is also configured with an FTP user.
Wordpress has the ability to update files from its admin panel. But here's the problem: suPHP is much slower than Mod_PHP. Mod_PHP is much faster, but it runs everything as user www-data! So when using mod-php I have to chmod the dir to www-data:www-data and everything runs fast BUT I can't update the software and I can't login with FTP, but with Suphp the site is so slow that it actually locks down....

Guys, I need your advice on this! What should I do?

Thanks!
Mark

till
3rd September 2009, 11:49
Use php-fcgi + suexec.

voidzero
3rd September 2009, 14:01
Well that's still using php-cgi and it's still too slow!

But I have solved it in a different way: by using ACL.
The webroots of these sites are set to user:group www-data:www-data with an ACL entry u:web29:rwX,g:client5:rX and it includes a default.

What I did was, I created a script to do all of this for me hourly through a cronjob. Here it is, I hope it will benefit others with the same problem:

#!/bin/bash
# Fix permissions for webroots that are using mod-php and wordpress.

chown -R www-data:www-data /var/www/site.org/web
setfacl -bR /var/www/site.org/web
setfacl -Rm u:web29:rwX,g:client5:rX,d:u:web29:rwX,d:g:client5 :rX /var/www/site.org/web

# Repeat this for all the sites that need it. Crontab it for your own convenience.
# New files will automagically inherit these permissions.

till
3rd September 2009, 14:05
Well that's still using php-cgi and it's still too slow!

No, it is not using php as cgi if you selected fcgi. How do you know that its using php-cgi, as phpinfo is always showing identical results for cgi and fcgi. if you want to test it, you will have to check it with ps aux. fcgi is as fast as mod_php, you can test it with apache bench. Also be aware that you have to wait a minute until you test again.

So the solution is still to use php-fcgi, you hack is not nescessary and its highly recommended to not use it!

To further speed up php scripts, intall eaccelerator or xcache.

voidzero
5th September 2009, 15:40
No, it is not using php as cgi if you selected fcgi. How do you know that its using php-cgi, as phpinfo is always showing identical results for cgi and fcgi. if you want to test it, you will have to check it with ps aux. fcgi is as fast as mod_php, you can test it with apache bench. Also be aware that you have to wait a minute until you test again.

Just to be sure.. we are talking about Fast-CGI here?

So the solution is still to use php-fcgi, you hack is not nescessary and its highly recommended to not use it!

To further speed up php scripts, intall eaccelerator or xcache.

I will try that out. I was using memcache/memcached, which one would you recommend out of the two you mentioned? Thanks for the help - to me this part of ispconfig is still a bit new.

Reginald
6th September 2009, 11:13
Try to install apache2-mpm-itk +mod_php and configure the creation of new sites.
see http://www.howtoforge.com/forums/showthread.php?t=25918 for more details

voidzero
6th September 2009, 20:14
No, it is not using php as cgi if you selected fcgi. How do you know that its using php-cgi, as phpinfo is always showing identical results for cgi and fcgi.

From top:
14023 web28 20 0 123m 53m 26m S 6.7 2.6 0:03.26 /usr/bin/php-cgi

This is what I meant with 'still using cgi' - I selected FastCGI so that's why I wanted to make sure that we are talking about the same thing.. are we?

till
7th September 2009, 09:56
Just to be sure.. we are talking about Fast-CGI here?

Yes.

From top:
14023 web28 20 0 123m 53m 26m S 6.7 2.6 0:03.26 /usr/bin/php-cgi

This is what I meant with 'still using cgi' - I selected FastCGI so that's why I wanted to make sure that we are talking about the same thing.. are we?

Thats the binary which is used by fastcgi and cgi, ss the above line does NOT maen that it is running as cgi!

Ify ou want to know if it is running as cgi or fastcgi, just look in the vhost configuration file.

I will try that out. I was using memcache/memcached, which one would you recommend out of the two you mentioned? Thanks for the help - to me this part of ispconfig is still a bit new.

memcache is someting different, it is a fast object cache and does not speed up the processing of php code.

voidzero
14th September 2009, 17:33
Thanks Till, I have updated it to FastCGI and it does indeed work just as fine. One question remaining though: when I use mod-php and xcache, I can see that php is using xcache from the xcache admin page. However when I use FastCGI I see no web page in xcache's database. Could you help me with this so that xcache does use FastCGI-websites?

voidzero
14th September 2009, 17:51
My problem is known on this page, too:
http://forum.lighttpd.net/topic/16734
Might there be some solution at hand for ispconfig?

voidzero
20th September 2009, 12:25
Till, I still couldn't solve the xcache issue. Have you any idea how we can fix this?

thibotus01
26th October 2009, 12:03
Problem still there... I confirm that xcache doesn't work with php in FastCGI. Php-Mod is ok.

Any solution ? :cool:

till
26th October 2009, 12:13
Have you asked the xcache developers for help?

thibotus01
26th October 2009, 12:18
It will be hard if their website is down ;)

thibotus01
26th October 2009, 12:22
Exact same problem on the official forum : http://forum.lighttpd.net/topic/100377
answer : use Mod_PHP..... :rolleyes::(

voidzero
26th October 2009, 13:27
Exact same problem on the official forum : http://forum.lighttpd.net/topic/100377
answer : use Mod_PHP..... :rolleyes::(

Yeah, and that's no option for me - wordpress doesn't work too well then.

till
26th October 2009, 14:22
Have you tried eaccellerator instead of xcache?

thibotus01
26th October 2009, 14:23
This is not the solution. Xcache must work with FastCGI.

till
26th October 2009, 14:25
Then send your complaints to the xcache devs if you dont want to try eaccelerator which is a replacement for xcache.

thibotus01
26th October 2009, 14:29
By seaching on google, fastcgi should works with xcache. I think it's more a problem with ispconfig 3. Regarding this topic : http://forum.lighttpd.net/topic/100377#19774, another person has the same problem with a debian lenny + ispconfig 3 + apache.

till
26th October 2009, 14:34
ISPConfig is just writing a standard vhost, it is not interfering with apache, php and xcache in any way.

That somone has the same problem does not mean that its related to ispconfig when its related to apache + xcache and fcgi.

thibotus01
26th October 2009, 14:42
I know but I will be interested to see if someone can make it work with the same config, and by enabling FastCGI in ispconfig panel.

till
26th October 2009, 14:48
Then ask the xcache developers on how to enable xcache successfully in apache. All successful reports that I found are related to lighty, as xcache belongs to the lighttpd project and php fcgi on apcahe and lighty works a bit differntly (apache does not reuse connections if I remember correctly). So better try eaccellerator or ask the xcache devs on how to configure apache and php-fcgi so that xcache works with apache too.

As I told you already above, this problem is not a ispconfig problem. It wold be the same as if you ask how to enable xcache on a Inter processor because your server has a intel processor. ISPConfig does not interact with apache - php-fcgi and xcache, ispconfig just writes a standard apache config file.