user_dir not working as documented?

From: Date: Mon, 13 Nov 2000 07:54:37 +0000
Subject: user_dir not working as documented?
Groups: php.install 
Request: Send a blank email to php-install+get-746@lists.php.net to get a copy of this message
user_dir doesn't work like the manual says. From <URL:http://www.php.org/manual/security.php> >Case 3: setting doc_root or user_dir >[doc_root docs elided] >Another option usable here is user_dir. When user_dir is unset, only >thing controlling the opened file name is doc_root. Opening an url like >http://my.host/~user/doc.php3 does not result in opening a file >under >users home directory, but a file called ~user/doc.php3 under doc_root >(yes, a directory name starting with a tilde [~]). > >If user_dir is set to for example public_php, a request like >http://my.host/~user/doc.php3 will open a file called doc.php3 >under the >directory named public_php under the home directory of the user. If the >home of the user is /home/user, the file executed is >/home/user/public_php/doc.php3. But even though I have my user_dir set to "php3", PHP still serves it out of the user directory. If I hit <URL:http://www.daft.com/~genjoe/index.php3>, it serves up the file which is really at /home/genjoe/web/index.php3. If I hit <URL:http://www.daft.com/~torin/index.php3>, it gives me a 404 since the file I'm trying to serve here is /home/torin/php3/index.php3 Here's my config: Linux 2.2.16 Server Version: Apache/1.3.9 (Unix) Debian/GNU PHP/3.0.18 Module Name: mod_php3.c Content handlers: application/x-httpd-php3 , application/x-httpd-php3-preprocessed, application/x-httpd-php3-source, text/html Configuration Phase Participation: Create Directory Config, Merge Directory Configs Request Phase Participation: none Current Configuration: php3_engine on php3_expose_php off php3_extension_dir /usr/lib/php3/apache php3_doc_root /usr/local/lib/php3-docs php3_user_dir php3 php3_include_path /usr/local/lib/php3-inc php3_auto_prepend_file prepend.php3 php3_error_log /var/log/apache/php3.err php3_error_reporting 15 php3_log_errors on php3_display_errors on php3_track_errors on php3_short_open_tag on php3_asp_tags off php3_track_vars on php3_magic_quotes_gpc on php3_safe_mode on # note I've tried both on and off php3_max_execution_time 60 php3_memory_limit 8388608 php3_last_modified on (debian package php3 3.0.18-0potato1) PHP Version 3.0.18 Extensions +-------------+-----------------------------------------------------------+ | Extensions | Additional Information | +-------------+-----------------------------------------------------------+ |PHP core |CFLAGS= | | |HSREGEX= | +-------------+-----------------------------------------------------------+ Configuration Configure command: ../configure '--with-apxs=/usr/bin/apxs' '--disable-debug' '--with-filepro' '--with-config-file-path=/etc/php3/apache' '--with-zlib' '--without-gd' '--enable-sysvsem' '--enable-sysvshm' '--with-yp' '--with-gettext' '--with-ftp' php3.ini file path is set to: /etc/php3/apache +-----------------------+----------------------+--------------------------+ | Directive | Master Value | Local Value | +-----------------------+----------------------+--------------------------+ |arg_separator | & | & | +-----------------------+----------------------+--------------------------+ |asp_tags |0 |0 | +-----------------------+----------------------+--------------------------+ |auto_prepend_file |  | prepend.php3 | +-----------------------+----------------------+--------------------------+ |auto_append_file |  |  | +-----------------------+----------------------+--------------------------+ |browscap | none | none | +-----------------------+----------------------+--------------------------+ |cgi_ext | none | none | +-----------------------+----------------------+--------------------------+ |debugger.host | none | none | +-----------------------+----------------------+--------------------------+ |debugger.port |0 |0 | +-----------------------+----------------------+--------------------------+ |define_syslog_variables|1 |1 | +-----------------------+----------------------+--------------------------+ |display_errors |1 |1 | +-----------------------+----------------------+--------------------------+ |doc_root | /usr/local/lib/php3 | /usr/local/lib/php3-docs | +-----------------------+----------------------+--------------------------+ |enable_dl |1 |1 | +-----------------------+----------------------+--------------------------+ |engine |1 |1 | +-----------------------+----------------------+--------------------------+ |error_log | none | /var/log/apache/php3..err | +-----------------------+----------------------+--------------------------+ |error_append_string | none | none | +-----------------------+----------------------+--------------------------+ |error_prepend_string | none | none | +-----------------------+----------------------+--------------------------+ |error_reporting |7 |15 | +-----------------------+----------------------+--------------------------+ |extension_dir | /usr/lib/php3/apache | /usr/lib/php3/apache | +-----------------------+----------------------+--------------------------+ |gpc_order | GPC | GPC | +-----------------------+----------------------+--------------------------+ |ignore_user_abort |0 |0 | +-----------------------+----------------------+--------------------------+ |include_path |  | /usr/local/lib/php3-inc | +-----------------------+----------------------+--------------------------+ |isapi_ext | none | none | +-----------------------+----------------------+--------------------------+ |last_modified |0 |1 | +-----------------------+----------------------+--------------------------+ |log_errors |0 |1 | +-----------------------+----------------------+--------------------------+ |max execution time |60 |60 | +-----------------------+----------------------+--------------------------+ |magic_quotes_gpc |1 |1 | +-----------------------+----------------------+--------------------------+ |magic_quotes_runtime |0 |0 | +-----------------------+----------------------+--------------------------+ |magic_quotes_sybase |0 |0 | +-----------------------+----------------------+--------------------------+ |memory limit |8388608 |8388608 | +-----------------------+----------------------+--------------------------+ |nsapi_ext | none | none | +-----------------------+----------------------+--------------------------+ |open_basedir | none | none | +-----------------------+----------------------+--------------------------+ |precision |14 |14 | +-----------------------+----------------------+--------------------------+ |safe_mode |1 |1 | +-----------------------+----------------------+--------------------------+ |safe_mode_exec_dir |  |  | +-----------------------+----------------------+--------------------------+ |sendmail_from | me@localhost.com | me@localhost.com | +-----------------------+----------------------+--------------------------+ |sendmail_path | /usr/sbin/sendmail -t| /usr/sbin/sendmail -t | +-----------------------+----------------------+--------------------------+ |short_open_tag |1 |1 | +-----------------------+----------------------+--------------------------+ |smtp | localhost | localhost | +-----------------------+----------------------+--------------------------+ |sql_safe_mode |0 |0 | +-----------------------+----------------------+--------------------------+ |track_errors |0 |1 | +-----------------------+----------------------+--------------------------+ |track_vars |1 |1 | +-----------------------+----------------------+--------------------------+ |upload_max_filesize |2097152 |2097152 | +-----------------------+----------------------+--------------------------+ |upload_tmp_dir | none | none | +-----------------------+----------------------+--------------------------+ |user_dir | php3 | php3 | +-----------------------+----------------------+--------------------------+ |warn_plus_overloading |0 |0 | +-----------------------+----------------------+--------------------------+ |xbithack |0 |0 | +-----------------------+----------------------+--------------------------+ |browscap | none | none | +-----------------------+----------------------+--------------------------+ |y2k_compliance |0 |0 | +-----------------------+----------------------+--------------------------+ |highlight_comment | #FF8000 | #FF8000 | +-----------------------+----------------------+--------------------------+ |highlight_default | #0000BB | #0000BB | +-----------------------+----------------------+--------------------------+ |highlight_html | #000000 | #000000 | +-----------------------+----------------------+--------------------------+ |highlight_string | #DD0000 | #DD0000 | +-----------------------+----------------------+--------------------------+ |highlight_bg | #FFFFFF | #FFFFFF | +-----------------------+----------------------+--------------------------+ |highlight_keyword | #007700 | #007700 | +-----------------------+----------------------+--------------------------+ PHP Variables +---------------------+---------------------------------------------------+ | Variable | Value | +---------------------+---------------------------------------------------+ |PHP_SELF |/~genjoe/index.php3 | +---------------------+---------------------------------------------------+ ------------------------------------------------------------------------------- Apache Environment +--------------------+----------------------------------------------------+ | Variable | Value | +--------------------+----------------------------------------------------+ |DOCUMENT_ROOT |/web/www.public  | +--------------------+----------------------------------------------------+ |HTTP_ACCEPT |text/*, image/*, audio/*, application/*  | +--------------------+----------------------------------------------------+ |HTTP_ACCEPT_LANGUAGE|en; q=1.0  | +--------------------+----------------------------------------------------+ |HTTP_HOST |www.daft.com  | +--------------------+----------------------------------------------------+ |HTTP_USER_AGENT |w3m/0.1.9  | +--------------------+----------------------------------------------------+ |PATH |/bin:/usr/bin:/sbin:/usr/sbin  | +--------------------+----------------------------------------------------+ |REMOTE_ADDR |204.122.30.2  | +--------------------+----------------------------------------------------+ |REMOTE_PORT |4875  | +--------------------+----------------------------------------------------+ |SCRIPT_FILENAME |/home/genjoe/web/index.php3  | +--------------------+----------------------------------------------------+ |SERVER_ADDR |204.122.30.2  | +--------------------+----------------------------------------------------+ |SERVER_ADMIN |webweaver@daft.com  | +--------------------+----------------------------------------------------+ |SERVER_NAME |www.daft.com  | +--------------------+----------------------------------------------------+ |SERVER_PORT |80  | +--------------------+----------------------------------------------------+ |SERVER_SIGNATURE |  | +--------------------+----------------------------------------------------+ |SERVER_SOFTWARE |Apache/1.3.9 (Unix) Debian/GNU PHP/3.0.18  | +--------------------+----------------------------------------------------+ |URL_COUNT |1  | +--------------------+----------------------------------------------------+ |URL_COUNT_DB |/etc/apache/counts/page-counts.dir  | +--------------------+----------------------------------------------------+ |URL_COUNT_DINDEX |index.html index.htm default.html default.htm | | |index.php3  | +--------------------+----------------------------------------------------+ |GATEWAY_INTERFACE |CGI/1.1  | +--------------------+----------------------------------------------------+ |SERVER_PROTOCOL |HTTP/1.0  | +--------------------+----------------------------------------------------+ |REQUEST_METHOD |GET  | +--------------------+----------------------------------------------------+ |QUERY_STRING |  | +--------------------+----------------------------------------------------+ |REQUEST_URI |/~genjoe/index.php3  | +--------------------+----------------------------------------------------+ |SCRIPT_NAME |/~genjoe/index.php3  | +--------------------+----------------------------------------------------+ -- <torin@daft.com><http://www.daft.com/~torin/> <torin@debian.org><perl@slut.org> Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-206-ELF-LIPZ @ Make a little hot-tub in your soul. @

« previous php.install (#746) next »