Click to See Complete Forum and Search --> : [RESOLVED] access permission problem


fabianus
03-13-2009, 07:49 AM
Hello all !

I do not know if this is the right place to post my problem, but I do hope that somebody may help me with this issue.

I just installed ubuntu server with apache preinstalled. I installed php, mysql etc.

Everything seems to work out well, but when the php application trys to access some image files, it throws a permission error. I suppose that I have to tweak something in the apache settings ... but what :-)

Here is the php code :


<p><?php

$a = getimagesize("testImage.jpg");

echo $a[1];

?></p>


And the getimagesize function throws the following error :

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/user/fabianus/www/testImageSize.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Here is the configuraiton file of my apache server :

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/fabianus/store/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/fabianus/store/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
Any help would be very wellcome !

Regards,
Fabianus

bradgrafelman
03-14-2009, 01:30 AM
Sounds like the file permissions on testImage.jpg don't allow the user that Apache is running as (e.g. "www" or "apache") to access the file. Try CHMOD'ing the file to either 744 or 766, depending upon whether or not you plan on just reading or reading and writing.

fabianus
03-14-2009, 07:49 AM
thanks bradgrafelman,

this solved it !

Regards,
Fabianus