0

There is Neo4J installed on my Ubuntu and I'm running a test code. It's perfectly working when the code runs on terminal such as:

root@ekin-Inspiron-1090:/var/www# php neo.php
home: demolished
name: Arthur Dent

But when it comes to run on browser like localhost/neo.php, it gives fatal error and stops working.

Warning: require(phar://neo4jphp.phar): failed to open stream: operation failed in /var/www/neo.php on line 4 Fatal error: require(): Failed opening required 'phar://neo4jphp.phar' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/neo.php on line 4 

I don't think it's really something with Neo4J or its PHP driver. What should be the reason?

edit: by the way, there are two php.ini files; i think one for apache and one for command line. I checked both of them and phar extension paths are the same. Also there are no include_path settings in both of them.

gzg
  • 1,469
  • 6
  • 23
  • 39
  • 1
    It might be saying you don't have access to the file. – Cole Tobin Jul 11 '12 at 19:32
  • 1
    command line runs under YOUR user id, apache runs under its own userid. Make sure that the apache user has access to the phar file. – Marc B Jul 11 '12 at 19:33
  • 1
    Seems likely to be a permission issue since the example shows the user running as `root`. – SilverSnake Jul 11 '12 at 19:34
  • @MarcB, how can I change the permission of apache user to the phar file? – gzg Jul 11 '12 at 19:34
  • 1
    @MarcB, thank you so much! I've been trying hard to solve this for 3 days. I give my apache user (www-data) to access /var/www and it solved it. – gzg Jul 11 '12 at 20:02

1 Answers1

1

It's an authorization error. Apache runs under its own user, so you need to give apache user to access www folder.