Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP error object not found
    primarykey
    data
    text
    <p>I have created a small PHP file which displays the name of text files in a directory as <code>first.txt</code>, <code>second.txt</code>, <code>third.txt</code>. On clicking on any of the files I get the error "object not found".</p> <p>This does not work:</p> <p><code>localhost/Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles/first.txt</code></p> <p>But this works:</p> <p><code>file:///Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles/first.txt</code></p> <p>Can you help me to understand what is wrong?</p> <p>Here is my code:</p> <pre><code>&lt;?php $directory = '/Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles'; if ($handle = opendir($directory.'/')){ echo 'Looking inside'.$directory.'&lt;br&gt;'; while ($file = readdir($handle)){ if ($file != '.'&amp;&amp;$file != '..'){ echo '&lt;a href="'.$directory.'/'.$file.'"&gt;'.$file.'&lt;/a&gt;&lt;br&gt;'; } } } ?&gt; </code></pre> <p>Following is some updates of log file</p> <ul> <li>[Thu Jul 18 01:06:57 2013] [error] [client ::1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/xamppfiles</li> <li>[Thu Jul 18 01:15:14 2013] [error] [client ::1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/Applications, referer: localhost/learning/ListingFiles/file.php</li> <li>[Thu Jul 18 01:15:43 2013] [error] [client ::1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/Applications, referer: localhost/learning/ListingFiles/file.php</li> <li>[Thu Jul 18 01:17:13 2013] [error] [client ::1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/Applications, referer: localhost/learning/ListingFiles/file.php</li> <li>[Thu Jul 18 01:39:04 2013] [error] [client ::1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/learning/ListingFiles/function.opendir, referer: localhost/learning/ListingFiles/file.php</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload