|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-09 17:37 UTC] samuele dot diella at gmail dot com
Description: ------------ In php-5.2.1 compiled as CGI under Apache 1.3.37, when i enter an url with a trailing slash, with no params after, i get a "No input file specified.". If i don't write the slash, or if i write a single character after the slash, the request is handled correctly. es.: http://www.myserver.com/phpinfo.php5 ---> works http://www.myserver.com/phpinfo.php5/ ---> No input file specified. http://www.myserver.com/phpinfo.php5/test ---> works In php-5.2.0, compiled with the same config, the request is handled correctly. This is my config line: ./configure --prefix=/usr --with-xsl --sysconfdir=/etc --enable-discard-path --with-config-file-path=/etc/apache/php5 --enable-safe-mode --with-openssl --with-mhash --enable-bcmath --with-bz2 --with-pic --enable-calendar --enable-ctype --with-gdbm --with-db3 --with-imap-ssl=/usr/local/lib/c-client --with-imap=/usr/local/lib/c-client --enable-dbase --enable-ftp --with-iconv --with-dom --with-exif --enable-exif --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr --with-t1lib=/usr --with-jpeg-dir=/usr --with-png --with-gmp --enable-mbstring --with-curl=/usr --with-pcre-regex=/usr --with-mysql --with-mysql-sock=/var/run/mysql --with-mysqli --with-gettext=shared,/usr --with-expat-dir=/usr --with-xml --with-tsrm-pthreads --with-mm=/usr --enable-trans-sid --enable-shmop --enable-sockets --with-regex=php --with-mime-magic --enable-sysvsem --enable-sysvshm --enable-yp --enable-memory-limit --enable-shared --disable-debug --with-zlib=/usr --with-mcrypt --with-ttf --enable-force-cgi-redirect This is my Apache configuration: AddType application/x-httpd-php5 .php5 Action application/x-httpd-php5 "/cgi-bin/php5" ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" I tryed many configuration options in php.ini and in configure command, but i was not able to get it works as before. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
I have created a small patch as a workaround. Should be checked and approved. --- sapi/cgi/cgi_main.c.org 2007-04-17 22:00:53.000000000 +0200 +++ sapi/cgi/cgi_main.c 2007-05-15 17:35:39.000000000 +0200 @@ -961,7 +961,14 @@ /* some server configurations allow '..' to slip through in the translated path. We'll just refuse to handle such a path. */ if (script_path_translated && !strstr(script_path_translated, "..")) { - SG(request_info).path_translated = estrdup(script_path_translated); + char * real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC); + if ( real_path ) + { + SG(request_info).path_translated = estrdup(real_path); + free(real_path); + } else { + SG(request_info).path_translated = estrdup(script_path_translated); + } } SG(request_info).content_type = (content_type ? content_type : "" ); SG(request_info).content_length = (content_length ? atoi(content_length) : 0);SCRIPT_FILENAME fixed. --- php-5.2.2/sapi/cgi/cgi_main.c 2007-04-17 22:00:53.000000000 +0200 +++ php-5.2.2.new/sapi/cgi/cgi_main.c 2007-05-21 12:24:31.000000000 +0200 @@ -961,7 +961,15 @@ /* some server configurations allow '..' to slip through in the translated path. We'll just refuse to handle such a path. */ if (script_path_translated && !strstr(script_path_translated, "..")) { - SG(request_info).path_translated = estrdup(script_path_translated); + char * real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC); + if ( real_path ) + { + SG(request_info).path_translated = estrdup(real_path); + script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", real_path TSRMLS_CC); + free(real_path); + } else { + SG(request_info).path_translated = estrdup(script_path_translated); + } } SG(request_info).content_type = (content_type ? content_type : "" ); SG(request_info).content_length = (content_length ? atoi(content_length) : 0);