1

Anyone know exaclty what's going wrong, I'm running Ubuntu (server) and have apache 2.2.14-5 and php 5.3.2-1 installed. When accessing the test.php file I get a HTTP 500 error. Here's what I get in my error.log

[Thu Oct 27 16:15:41 2011] [error] [client myip] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Thu Oct 27 16:15:41 2011] [error] [client myip] PHP Fatal error:  Unknown: Failed opening required '/blob/public_html/phpass-0.3/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Anyone know how to setup PHPass?

EDIT: Made a much simpler test: http://pastebin.com/TWq3C9Km, produced the same errors as above.

EDIT2: I have narrowed down what causes these errors to the following lines of code:

if(is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb'))) {
        $output = fread($fh, $count);
        fclose($fh);
}

EDIT3: Turns out I can't read error messages, whats actually happening is PHP can't read the file itself. A quick sudo chmod -R 777 phpass-0.3 temporarily fixes that, but here must be a better way.

Jonny Barnes
  • 515
  • 1
  • 12
  • 28
  • 1
    Could it be a file permission problem? – Surreal Dreams Oct 27 '11 at 15:33
  • 1
    Looking at the source code for the main `PasswordHash.php` file, the only thing I can see it trying to open is `/dev/urandom`. On a quick google the only thing that might stop that is the open_basedir directive in php.ini, mine is commented out. – Jonny Barnes Oct 27 '11 at 15:49
  • I had the same problem, but i found that [link](http://stackoverflow.com/a/20048548/2899954). I had to make it owned by Apache: `chown www-date phpass-0.3` **www-data** is the user automatically created for web servers (here Apache) on Ubuntu (at least, correct me if I'm wrong). And then give read right: `chmod -R +r phpass-0.3`. Then it should be ok. – kukinsula Jun 18 '14 at 08:53

1 Answers1

0

That error message usually indicates file permission problems as already pointed out. Global read/write/execute permissions are certainly not required, but make sure to give Apache read access to the files. For example:

chmod 755 phpass-0.3
chmod 644 phpass-0.3/*.php
Viktor
  • 3,436
  • 1
  • 33
  • 42