Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73909 invoked from network); 17 Jul 2008 06:49:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2008 06:49:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.168 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 66.249.92.168 ug-out-1314.google.com Received: from [66.249.92.168] ([66.249.92.168:28160] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/0A-54589-58BEE784 for ; Thu, 17 Jul 2008 02:49:42 -0400 Received: by ug-out-1314.google.com with SMTP id h3so620878ugf.29 for ; Wed, 16 Jul 2008 23:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=JqMJgm019LiLu65dUsjoqqmAhwLELs5Edhrr2V8P8Ik=; b=B1eYam8FGhswysQaFeIb4T+Hgciq68Iiv35hYu++TLZ/mlVtKpmKNLw8c3ZjCTFlSJ n6apwG+DaUsVCwozbXgjo0n7BQImaHSBQTTe2we0XfzTqflGhcjqhSz40mc+F24k1WSk F72Qesaasc80zxhqUjtfcjiQi1B39itZwuHgM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=xY9mZnRZ6o2QZKHXLuO1RDoKDMCRP2nLMl6sPBh78Ff4rEmW/TpRod+pwtI6Qo86C/ /xfTkbK2pBPrOKJ/wJ0B1pahmPHFwHP1pcAYNYJ6Gxf0bR33fytDQvJEsO3+2htfAkxG HJL0/NFAkwPfMktmUyHJBy7WS3pQwSTiYO9fw= Received: by 10.67.89.8 with SMTP id r8mr2389553ugl.87.1216277378336; Wed, 16 Jul 2008 23:49:38 -0700 (PDT) Received: by 10.67.96.8 with HTTP; Wed, 16 Jul 2008 23:49:38 -0700 (PDT) Message-ID: <9b3df6a50807162349s4893d8d0ue7d02c0e8046bb96@mail.gmail.com> Date: Thu, 17 Jul 2008 09:49:38 +0300 To: "Rasmus Lerdorf" Cc: "Amir Hardon" , "Oleg Grenrus" , "PHP Internals List" In-Reply-To: <487E2051.70000@lerdorf.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_57639_16467529.1216277378366" References: <1216133436.6875.35.camel@amirh> <487CEF26.7030802@lerdorf.com> <1216159988.28846.12.camel@localhost> <487D22AE.20109@lerdorf.com> <5a2b1bf10807152247r563092a6l88d555d2389506e4@mail.gmail.com> <9b3df6a50807160340w578d7490xb6f2810652e1bb47@mail.gmail.com> <487DFB86.3030404@lerdorf.com> <1216224862.20625.33.camel@amirh> <487E2051.70000@lerdorf.com> Subject: Re: [PHP-DEV] lstat call on each directory level From: arvids.godjuks@gmail.com ("Arvids Godjuks") ------=_Part_57639_16467529.1216277378366 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Yesterday I made some tests on my site with strace to see how much lstat I have and how can I optimize them. Well, I managed to get rid of them almost at all, but now I have some questions about include_path and including files based on current dir. I have such structire of files /home/file/www (that's my site root dir) include/ - bittorrent - global.php lang/ - eng.lang - rus.lang index.php My files are ---- index.php --- require './include/bittorrent.php'; --- common.php --- require './include/global.php'; require './lang/eng.lang'; And some other files from include dir Default include path is ".:/usr/share/php5:/usr/share/php" and if I don't change it it results in a bunch of lstat. Here is the trace http://pastebin.com/m37704b6a The thing I don't understand from trace is WHY it tests include path BEFORE the ./ ? Why it doesn't try to load file based on relative path first (it should hit it on first try) and then use include path? Ok, I make in bittorrent.php - set_include_path('/home/file/www'); The only lstat i have now is lstat("/home", {st_mode=S_IFDIR|0755, st_size=144, ...}) = 0 lstat("/home/file", {st_mode=S_IFDIR|0755, st_size=1112, ...}) = 0 lstat("/home/file/www", {st_mode=S_IFDIR|0755, st_size=11880, ...}) = 0 lstat("/home/file/www/bittorrent.php", 0x7fff8d95cca0) = -1 ENOENT (No such file or directory) open("/home/file/www/bittorrent.php", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/file/www/include/bittorrent.php", O_RDONLY) = 14 So the question is - why are they happen at all, if I include bittorrent.php as require './include/bittorrent.php' in index.php. As i understand it should hit the right folder from first time. Could you, please, explain how all this works, because as it turned out it is not so obvious as it should be... I have PHP 5.2.6 (Gentoo Linux package name is dev-php5/php-5.2.6-r2) and lighttpd 1.5 ------=_Part_57639_16467529.1216277378366--