benluteijn / cherokee

Automatically exported from code.google.com/p/cherokee
0 stars 1 forks source link

ln -sf /bla /bla effect in admin #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. situation; you have directory on your system you want to use it as
document root
2. set it up as list and send, for the sake of humanity add a php script to it
3. place this rule before/after your default php extention you will observe
that php will result in a 404, because it will look for the actual php file
not in the document directory of the list and send, but in the actual
document root of the server. 

The behavior I would like to have is:

ln -sf /applicationdirectory /serverroot/application
(this works)

And the most strange thing; observer the 'local_directory' is just '/opt'
now my normal root is '/opt/cheroke/var/www/'

      connection.c:2024 (cherokee_connection_open_request):
web_directory='(null)' request='/magento/test.php' local_directory='/opt/'
    handler_fcgi.c:0711 (    cherokee_handler_fcgi_init): Init: connect
          socket.c:1273 (       cherokee_socket_connect): connect type=2
          socket.c:1329 (       cherokee_socket_connect): successful
connect (type=2)
source_interpreter.c:0330 (cherokee_source_interpreter_connect_polling):
Connected successfully fd=17
    handler_fcgi.c:0732 (    cherokee_handler_fcgi_init): Init: send_headers
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=17
len=1392 ret=0 written=1392
    handler_fcgi.c:0545 (                       do_send): sent remaining=0
    handler_fcgi.c:0460 (              add_empty_packet): empty packet
type=5, len=8
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=17 len=8
ret=0 written=8
    handler_fcgi.c:0545 (                       do_send): sent remaining=0
    handler_fcgi.c:0755 (    cherokee_handler_fcgi_init): Init finishes
          socket.c:0726 (          cherokee_socket_read): Socket read error
fd=17: 'Resource temporarily unavailable'
          socket.c:0993 (       cherokee_socket_bufread): read fd=17
count=8192 ret=5 read=0
          thread.c:2153 (cherokee_thread_deactive_to_polling):
conn=0x1a32410(fd=16) (fd=17, rw=0)
          thread.c:2111 (    reactive_conn_from_polling): conn=0x1a32410(fd=16)
          thread.c:0597 (    process_active_connections): thread
(0x19eb7f0) processing conn (0x1a32410), phase 8 'Add headers'
          thread.c:0653 (    process_active_connections): conn on phase
n=8: Add headers
          socket.c:0993 (       cherokee_socket_bufread): read fd=17
count=8192 ret=0 read=136
    handler_fcgi.c:0192 (                read_from_fcgi): 136 bytes read,
buffer.len 111
handler_cgi_base.c:0824 (                  parse_header): CGI header:
'Status: 404 Not Found
X-Powered-By: PHP/5.2.6-pl7-gentoo
Content-type: text/html
'
          thread.c:0597 (    process_active_connections): thread
(0x19eb7f0) processing conn (0x1a32410), phase 6 'Setup connection'
          thread.c:0653 (    process_active_connections): conn on phase
n=6: Setup connection
          thread.c:0876 (    process_active_connections): Setup connection
begins: request="/magento/test.php"
          thread.c:0877 (    process_active_connections): Connection
0x1a32410 info
        |          Request: '/magento/test.php' (17)
        | Request Original: '' (0)
        |    Web Directory: '' (0)
        |  Local Directory: '/opt/' (5)
        |         Pathinfo: '/magento/test.php' (17)
        |         User Dir: '' (0)
        |     Query string: '' (0)
        |             Host: 'srv1.dogodigi.net' (17)
        |         Redirect: '' (0)
        |     Redirect num: 0
        |        Keepalive: 500
        |            Phase: Setup connection
        |      Range start: 0
        |        Range end: 0
        |     Option bits: log_at_end
        \_
    handler_fcgi.c:0312 (    cherokee_handler_fcgi_free): fcgi handler
free: 0x1a333e0

Original issue reported on code.google.com by ste...@konink.de on 22 Nov 2008 at 11:22

GoogleCodeExporter commented 9 years ago
Sorry, but I don't quite understand the issue. Could you attach a conf snippet? 
I'm
not seeing where does the directory -specified as root for the rule- get into 
the game.

Original comment by tah...@gmail.com on 24 Nov 2008 at 8:52

GoogleCodeExporter commented 9 years ago
Lets say you have a web app you want to install in: /home/magento/public_html
You want to publish it as: http://servername.com/magento
Magento is a PHP application.

Now the problem is; what would be the configuration, that has able torun PHP 
from
/home/magento/public_html.

Original comment by ste...@konink.de on 24 Nov 2008 at 10:15

GoogleCodeExporter commented 9 years ago
The rule "Directory /magento, Document Root = ~magento/public_html, Handler = 
common" would do it.

Original comment by alobbs on 24 Nov 2008 at 10:20

GoogleCodeExporter commented 9 years ago
common = List & Send right?

Now that is not working; static files as .html no problem. PHP is not able to 
figure
out where that file is. (see the above trace)

Original comment by ste...@konink.de on 24 Nov 2008 at 10:27

GoogleCodeExporter commented 9 years ago
I have just added a new QA entry (qa/193-PHP-documentroot.py) to test it out.  
It works alright.
Stefan, could you please test if it works at your end?

Original comment by alobbs on 30 Nov 2008 at 5:52

GoogleCodeExporter commented 9 years ago
Still no go :(

It still tries to fetch the /magento/* php files in the servers document root.

Original comment by ste...@konink.de on 30 Nov 2008 at 8:46

GoogleCodeExporter commented 9 years ago
I haven't touched anything in the source code.. I wrote the QA to try to 
reproduce the issue, but it worked just 
fine for me. That's why I wanted you to run it at your end.

Could you please run it and let me know whether it success?

  cd qa ; ./run-tests.py 193-PHP-documentroot.py

Original comment by alobbs on 30 Nov 2008 at 9:32

GoogleCodeExporter commented 9 years ago
Success.

Original comment by ste...@konink.de on 30 Nov 2008 at 9:36

GoogleCodeExporter commented 9 years ago
That's an issue: that QA implements the case you exposed here - as far I have 
understood it.

Could you please that a look at it, and try to get it to fail. That's the best 
way to allow me to reproduce the issue 
(I didn't manage to do it by hand either).

Original comment by alobbs on 30 Nov 2008 at 9:43

GoogleCodeExporter commented 9 years ago
vserver!10!rule!600!encoder!gzip = 1
vserver!10!rule!600!handler = fcgi
vserver!10!rule!600!handler!balancer = round_robin
vserver!10!rule!600!handler!balancer!source!1 = 1
vserver!10!rule!600!match = extensions
vserver!10!rule!600!match!extensions = php
vserver!10!rule!600!match!final = 1
vserver!10!rule!500!document_root = /home/magento/public_html/magento
vserver!10!rule!500!encoder!deflate = 0
vserver!10!rule!500!encoder!gzip = 0
vserver!10!rule!500!handler = common
vserver!10!rule!500!handler!allow_dirlist = 1
vserver!10!rule!500!handler!allow_pathinfo = 0
vserver!10!rule!500!handler!date = 1
vserver!10!rule!500!handler!group = 0
vserver!10!rule!500!handler!iocache = 1
vserver!10!rule!500!handler!size = 1
vserver!10!rule!500!handler!symlinks = 1
vserver!10!rule!500!handler!theme = firefox3
vserver!10!rule!500!handler!user = 0
vserver!10!rule!500!match = directory
vserver!10!rule!500!match!directory = /magento
vserver!10!rule!500!match!final = 1
vserver!10!rule!500!only_secure = 0
vserver!10!rule!400!document_root = /opt/cherokee/lib/cgi-bin/
vserver!10!rule!400!handler = cgi
vserver!10!rule!400!match = directory
vserver!10!rule!400!match!directory = /cgi-bin
vserver!10!rule!400!match!final = 1

Original comment by ste...@konink.de on 30 Nov 2008 at 9:43

GoogleCodeExporter commented 9 years ago
So if I change the rule order I do get my php file served as 'downloadable' 
script.
But the extension handler clearly doesn't want to get my php file from the
document_root...

Original comment by ste...@konink.de on 30 Nov 2008 at 9:45

GoogleCodeExporter commented 9 years ago
I can reproduce it.

Original comment by skar...@gmail.com on 5 Jan 2009 at 9:34

GoogleCodeExporter commented 9 years ago
Well, after some tests, I think that I have found the "problem" (a
misconfiguration)... Stefan, could you please test setting php rule as 
no-final?.

vserver!10!rule!600!match!final = 0

It works for me.

Original comment by skar...@gmail.com on 5 Jan 2009 at 4:09

GoogleCodeExporter commented 9 years ago
I can confirm this indeed fixes the issue. We need to have some documentation 
for
this imho.

Original comment by ste...@konink.de on 20 Jan 2009 at 3:38

GoogleCodeExporter commented 9 years ago
Stefan, patchs and additions to doc/* are more than welcome :-)

Original comment by alobbs on 21 Jan 2009 at 8:45