PDA

View Full Version : Drupal and suPHP Problem


dschmid
29th November 2007, 18:04
Hello I'm running Gutsy Perfect Setup with Drupal on it. My first problem was that enabling clean-urls results in an error I had fixed the problem by creating this .htaccess file described by falco (thanks):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</IfModule>


The other problem was when I uploaded files with a module the owner of the file was always www-data. I searched in the forums and found a link to another excellent Howto: http://www.howtoforge.com/suphp_debian_etch_ispconfig

I followed the instructions and I only had a little problem with the /etc/suphp.conf file. Because it is in one line in the tutorial. After manual editing the suphp.conf file the Internal Server Error was gone.

Everything seems to work fine. But creating new Content was now not possible. By hitting the Submit button the same page loads again without an error and the content isn't created.
Because it's only an test page I deleted the whole web folder and the database, after that I created new one and unzipped the drupal folder and replaced the .htaccess file with the above one.

By trying to install drupal the "Database Configuration" screen loads like normal when I open the webpage but when I insert my database information and hit "Save configuration" the screen loads again with no error message.

Under the comments of the tutorial toolwizard wrote that php5-mysql isn't enabled after suphp installation. So I reinstalled it like with apt-get php5-mysql --reinstall

In the error.log files are no errors.

Now I have no idea what problem could be. Thx for any help

Hans
29th November 2007, 18:26
I host lots of individual Drupal sites on my ISPConfig server with suphp enabled, which has been setup according my howto here: http://www.howtoforge.com/drupal_ispconfig and http://www.howtoforge.com/suphp_debian_etch_ispconfig.

The only thing i put within the Apache Directive field of the Drupal site is this:

<Directory /var/www/mydrupalwebsite.tld/web/>
Options +Includes +FollowSymlinks -Indexes
AllowOverride All
Order allow,deny
Allow from all
<Files ~ "^\.ht">
Deny from all
</Files>
</Directory>

It should work then. I do not use the .htaccess file you describe.

dschmid
29th November 2007, 20:30
Thanks Hans but don't works for me I'm using Drupal 5. Are you using Ubuntu on some servers too? I have deleted all again including the database and created a new one with isp config. Then I puted in the Apache Directives and saved again. And then untared the drupal 5 again and deleted the included .htaccess. I had to do a
chown web1_myuser:web1 web -R
and then the page pops up. But when I give in my credatials in and hit "save configuration" the page loads again.

Hans
29th November 2007, 21:20
To make sure the ownership has been setup correctly, you can execute this command within your webX:
chown -R -v -f webX_admin:webX web/*

(webX_admin is the account admin and webX your webnumber, as created with ISPConfig).

By the way, i use Debian (Etch on the moment).

dschmid
29th November 2007, 22:02
Hi i tried your command and
ownership of `web/update.php' retained as web1_myuser:webX
...
comes. But still the same. Normaly when somethings wrong with the database connection an error message in the top of the page should pop up. But nothing comes.
My phpinfo file shows this:

...
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php5/cgi
Loaded Configuration File /etc/php5/cgi/php.ini
Scan this dir for additional .ini files /etc/php5/cgi/conf.d
...
Registered PHP Streams zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*
...
allow_call_time_pass_reference On On
allow_url_fopen On On
allow_url_include Off Off
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 6135 6135
expose_php On On
extension_dir /usr/lib/php5/20060613+lfs /usr/lib/php5/20060613+lfs
file_uploads On On
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/share/php:/usr/share/pear .:/usr/share/php:/usr/share/pear
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no value no value
max_execution_time 1000 1000
max_input_nesting_level 64 64
max_input_time 1000 1000
memory_limit 128M 128M
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 2048M 2048M
precision 12 12
realpath_cache_size 16K 16K
realpath_cache_ttl 120 120
register_argc_argv On On
register_globals Off Off
register_long_arrays On On
report_memleaks On On
report_zend_debug On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 1024M 1024M
upload_tmp_dir no value no value
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
zend.ze1_compatibility_mode Off Off
...
Active Persistent Links 0
Active Links 0
Client API version 5.0.45
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
...
Environment
DOCUMENT_ROOT /var/www/webX/web
GATEWAY_INTERFACE CGI/1.1
HTTP_ACCEPT text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT_LANGUAGE de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
HTTP_CONNECTION keep-alive
HTTP_COOKIE SESSf7a942eda524b5d4d0b6e6ca13bf911f=d025ff935a71e fe7eb35c2171ab033d5; SESSb56328779a490748facdafb0135b63d0=be773bb0b9fb4 5f8b971a33f3e3991d5
HTTP_HOST www.mydomain.de
HTTP_KEEP_ALIVE 300
HTTP_USER_AGENT Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
PATH /bin:/usr/bin
QUERY_STRING no value
REDIRECT_STATUS 200
REMOTE_ADDR xx.xx.xx.xx
REMOTE_PORT 22110
REQUEST_METHOD GET
REQUEST_URI /info.php
SCRIPT_FILENAME /var/www/webX/web/info.php
SCRIPT_NAME /info.php
SERVER_ADDR xx.xx.xx.xx
SERVER_ADMIN webmaster@mydomain.de
SERVER_NAME www.mydomain.de
SERVER_PORT 80
SERVER_PROTOCOL HTTP/1.1
SERVER_SIGNATURE <address>Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 mod_ssl/2.2.4 OpenSSL/0.9.8e Server at www.mydomain.de Port 80</address>
SERVER_SOFTWARE Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 mod_ssl/2.2.4 OpenSSL/0.9.8e

PHP Variables
_SERVER["DOCUMENT_ROOT"] /var/www/webX/web
_SERVER["GATEWAY_INTERFACE"] CGI/1.1
_SERVER["HTTP_ACCEPT"] text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
_SERVER["HTTP_ACCEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7
_SERVER["HTTP_ACCEPT_ENCODING"] gzip,deflate
_SERVER["HTTP_ACCEPT_LANGUAGE"] de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
_SERVER["HTTP_CONNECTION"] keep-alive
_SERVER["HTTP_COOKIE"] SESSf7a942eda524b5d4d0b6e6ca13bf911f=d025ff935a71e fe7eb35c2171ab033d5; SESSb56328779a490748facdafb0135b63d0=be773bb0b9fb4 5f8b971a33f3e3991d5
_SERVER["HTTP_HOST"] www.mydomain.de
_SERVER["HTTP_KEEP_ALIVE"] 300
_SERVER["HTTP_USER_AGENT"] Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
_SERVER["PATH"] /bin:/usr/bin
_SERVER["QUERY_STRING"] no value
_SERVER["REDIRECT_STATUS"] 200
_SERVER["REMOTE_ADDR"] xx.xx.xx.xx
_SERVER["REMOTE_PORT"] 22110
_SERVER["REQUEST_METHOD"] GET
_SERVER["REQUEST_URI"] /info.php
_SERVER["SCRIPT_FILENAME"] /var/www/webX/web/info.php
_SERVER["SCRIPT_NAME"] /info.php
_SERVER["SERVER_ADDR"] xx.xx.xx.xx
_SERVER["SERVER_ADMIN"] webmaster@mydomain.de
_SERVER["SERVER_NAME"] www.mydomain.de
_SERVER["SERVER_PORT"] 80
_SERVER["SERVER_PROTOCOL"] HTTP/1.1
_SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 mod_ssl/2.2.4 OpenSSL/0.9.8e Server at www.mydomain.de Port 80</address>
_SERVER["SERVER_SOFTWARE"] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 mod_ssl/2.2.4 OpenSSL/0.9.8e
_SERVER["PHP_SELF"] /info.php
_SERVER["REQUEST_TIME"] 1196365849
_SERVER["argv"]
_SERVER["argc"] 0
_ENV["DOCUMENT_ROOT"] /var/www/webX/web
_ENV["GATEWAY_INTERFACE"] CGI/1.1
_ENV["HTTP_ACCEPT"] text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
_ENV["HTTP_ACCEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7
_ENV["HTTP_ACCEPT_ENCODING"] gzip,deflate
_ENV["HTTP_ACCEPT_LANGUAGE"] de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
_ENV["HTTP_CONNECTION"] keep-alive
_ENV["HTTP_COOKIE"] SESSf7a942eda524b5d4d0b6e6ca13bf911f=d025ff935a71e fe7eb35c2171ab033d5; SESSb56328779a490748facdafb0135b63d0=be773bb0b9fb4 5f8b971a33f3e3991d5
_ENV["HTTP_HOST"] www.mydomain.de
_ENV["HTTP_KEEP_ALIVE"] 300
_ENV["HTTP_USER_AGENT"] Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
_ENV["PATH"] /bin:/usr/bin
_ENV["QUERY_STRING"] no value
_ENV["REDIRECT_STATUS"] 200
_ENV["REMOTE_ADDR"] xx.xx.xx.xx
_ENV["REMOTE_PORT"] 22110
_ENV["REQUEST_METHOD"] GET
_ENV["REQUEST_URI"] /info.php
_ENV["SCRIPT_FILENAME"] /var/www/webX/web/info.php
_ENV["SCRIPT_NAME"] /info.php
...


I hope that helps.

Hans
29th November 2007, 22:11
Do you see anything related within the log file of the website itself (not the global logfile within /var/log/) ?

dschmid
29th November 2007, 22:35
This was the last entry in /var/www/webX/log/error.log:
[Thu Nov 29 19:17:37 2007] [error] [client xx.xx.xx.xx] SoftException in Application.cpp:351: Mismatch between target UID (10001) and UID (1080) of file "/var/www/webX/web/index.php"
[Thu Nov 29 19:17:37 2007] [error] [client xx.xx.xx.xx] Premature end of script headers: index.php
My last entry in the web.log was about 17:00. Since the no more entry and I have rebootet the system and have many times tried to install drupal.:confused:

Hans
30th November 2007, 11:28
It looks like a owner/permission problem to me.
Are you really sure that you've created a user with administrative rights within ISPConfig for that website?

dschmid
30th November 2007, 13:17
Hi I reinstalled the website with ispconfig and recompiled suphp but still the same problem. I wrote a small php script that connects succesfully to my database. So php5-mysql is running. But still don't get drupal up and running. The new account that I created has Admin rights.
My /var/log/suphp.log only got normal entrys:
[Fri Nov 30 11:57:43 2007] [info] Executing "/var/www/web2/web/connect.php" as UID 10002, GID 10002
[Fri Nov 30 11:58:28 2007] [info] Executing "/var/www/web2/web/connect.php" as UID 10002, GID 10002
[Fri Nov 30 11:59:18 2007] [info] Executing "/var/www/web2/web/index.php" as UID 10002, GID 10002
[Fri Nov 30 11:59:18 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
[Fri Nov 30 11:59:18 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
[Fri Nov 30 11:59:43 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
[Fri Nov 30 12:01:35 2007] [info] Executing "/var/www/web2/web/index.php" as UID 10002, GID 10002
[Fri Nov 30 12:01:35 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
[Fri Nov 30 12:01:35 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
[Fri Nov 30 12:03:49 2007] [info] Executing "/var/www/web2/web/install.php" as UID 10002, GID 10002
But strange is that /var/www/web2/log/error.log only got entrys when I try to open a file that doesn't exist like this:
[Fri Nov 30 11:52:11 2007] [error] [client xx.xx.35.xx] File does not exist: /var/www/web2/web/i
[Fri Nov 30 12:00:58 2007] [error] [client xx.xx.35.xx] File does not exist: /var/www/web2/web/ins
Shouldn't exit a /var/www/web2/log/web.log file ??

dschmid
30th November 2007, 13:33
The permissions on /var/www/web2 are 777 www-data:web2
and on /var/www/web2/web 755 web2_myadminusername:web2
The log folder has 755 web2_myadminusername:web2

Hans
30th November 2007, 14:10
Why is your /web owned by www-data, if you use suPHP?

I think you should do this:
chown -R -v -f webX_admin:webX web/*

(webX_admin is the account admin and webX your webnumber, as created with ISPConfig).

dschmid
30th November 2007, 14:13
Thank you for your help. I try to reinstall the server with Etch and then post when it works. I hope it was only an issue with ubuntu.

dschmid
30th November 2007, 14:18
Oh I see you answered me at the moment. I thinked you meaned the chown command was on the folder /var/www/web2/web and not /var/www/web2.
I try this


***EDIT by Hans***
Yes i mean /var/www/web2/web

Hans
30th November 2007, 14:20
Sorry, but i don't think that it's because you've installed Ubuntu.
I think it is a permission/ownwer problem. Another example:
php-scripts expect that the webdir has chmod 755, otherwise it is possible they can not be executed.

Maybe Till/Falko has another hint for you to solve your problem..

dschmid
30th November 2007, 14:39
I changed ownership on the whole folder recursively for web2 but still the same. I be instrested if other people are running gutsy with ispconfig, suphp and drupal and had similar issues.
I have another problem with this messages
[Fri Nov 30 13:16:56 2007] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)

everytime I restart apache. I had read in your other posts that it's a known bug in Apache 2.2.3. But I think my apache installation is a bit buggy.

dschmid
30th November 2007, 18:32
You were right Hans I installed etch and first everything was fine. I followed the perfect setup howto and then the suphp howto. I compiled then ffmpeg too. I created then a site with your apache directives and drupal installation was succesfully. :) Then I tried to activate clean-urls but the test was not succesfully. I copied in this .htaccess and bang the clean urls where fine and i can created pages: :)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</IfModule>
I uploaded some other modules like views cck and video. But the video module shows me only a possible upload size from 2MBs. So i started vi and changed the lines in /etc/php5/cgi/php.ini with this ones:

upload_max_filesize = 1024
post_max_size = 2048
max_execution_time = 1000
max_input_time = 1000


Without suPHP enabled this was no problem. I restarted apache and video module gives me the correct possible 1GB upload. I uploadet one video file
and the upload stop after one minute to the same screen. In my files is no file. And creating any content or changing settings fails too. I didn't know whats going on and I deleted all my drupal files and tables try to reinstall and got the same error like with ubuntu:eek: The page loads and loads again after submitting.

So I changed the entrys in the php.ini back and the site worked again. Now I know what was the problem only in four hours work. Only because of this four little changes *lol*

But here my question whats the best and securest way to change the upload limit with suPHP??? I tried to add these values to my .htaccess file but that resolves in an Internal Server Error 500

php_value upload_max_filesize "30M"
php_value post_max_size "35M"
php_value max_execution_time 1200
php_value max_input_time 1200

Hans
30th November 2007, 20:38
Great that you're a step further now.
You can try to add that values within the apache directives field of the site in stead of the .htaccess file.

By the way, I think you have to make the modifcations within these two files:
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini

What do you see if you execute these commands:

cd /
grep -R upload_max_filesize *

dschmid
9th December 2007, 03:50
Sorry for my late replay Hans. I had solved the problem by changing the post_max_size to 2000 and the upload_max_filesize to 1000 in my /etc/php5/cgi/php.ini. Now I can upload 1GB and thats enough for me. I think it could be because I only got 2Gigs of RAM but that should be 2048 too:confused:
Im using the openpackage video module and the conversion worked very well and creates the thumbnails and flv files but I had the problem that the tumbnail was not showing up and the flowplayer didn't play the flvs. The problem was that the module created every time submitting a video node an .htaccess file in my files folder. I solved this by replacing that with that one of my web root folder. Now video upload and converting works very well with clean-urls. Thank you for your help :)