where to create /var directory?

raidermax

Joined: 2014-01-26
Posts: 3
Posted: Sun, 2014-01-26 17:27

I am running CentOS 6.5 with PHP, MySQL, and Apache all configured and ready for use with gallery3. I installed gallery3 from a .rpm package in my repos from either the main centos repos or the EPEL (yum install gallery3). I can go to the gallery3 installer by doing http://MYIPADDRESHERE/galery3/installer/index.php however I get this message:

We're having trouble creating a place for your photos. Can you help? We need you to create a directory called var in your gallery3 directory. This sample code works for most users. Run it in the gallery3 directory: mkdir var
chmod 777 var Check again

I have tried creating a var folder and chmodding it in /usr/share/gallery3 but the same error pops up. What am I doing wrong? Thanks for the assistance, I look forward to being a gallery3 user!

 
raidermax

Joined: 2014-01-26
Posts: 3
Posted: Mon, 2014-02-03 23:12

Bumping because this is 8 days old and not a single reply, I am sure most of you know where to create the var directory, please drop down a comment to help me. Thanks.

 
spags

Joined: 2010-03-26
Posts: 120
Posted: Thu, 2014-02-06 08:40

Under Debian based distro, the gallery folder gets created under /var/www probably because this is the default location that apache is configured to keep its files. So in this example, Gallery attempts to access the folder at /var/www/gallery3/var

Assuming /usr/share/gallery3 is the correct location in your distro (and presumably it is since you can start the installer), then maybe something else to consider is to do a "ls -l" listing of your /usr/share/gallery3 folder and checking if there is something else different about your var folder from the other folders there. Maybe it is owner/group related.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2014-02-15 04:43

Short answer: Put it Gallery's root folder (wherever that is on your server); it should be in the same folder that already has the index.php and README files.

 
tenuous

Joined: 2014-02-19
Posts: 2
Posted: Wed, 2014-02-19 04:18

I am working on this with an install from EPEL on CentOS 6.5 as well. I created var in the /usr/share/gallery3 directory and adjusted permissions but I still get the same error.

Suggestions?

 
spags

Joined: 2010-03-26
Posts: 120
Posted: Wed, 2014-02-19 08:14

Well, it looks like the installer var_writable function calls the php is_writeable function and failing that mkdir to try and create it. If both these fail then I believe you would get the error message indicated. So it is likely the account being used by apache/php doesn't have permission to write to the directory (if it exists) and doesn't have permission to create the directory (if it doesn't exist).

You can probably confirm the directory location gallery3 is expecting by slightly modifying your gallery3 /installer/views/get_db_info.html.php file. Around line 16 you should see the error message saying "We are having trouble....Run it in the gallery3 directory:". Around line 26-27, you should find a code html block containing code that goes something like htmlspecialchars(VARPATH, ENT_QUOTES, 'UTF-8', true). Copy that entire line including the code block and paste it into your new blank line around line 16.

If you try the installer again, you should see the expected directory displayed after the error message. I say should because I haven't tested this myself so I assume it will do what I expect it to do.

If it really is /usr/share/gallery3 then it comes back to the permission problems. Actually now that I think about, either way it should come back to permission problems.

 
tenuous

Joined: 2014-02-19
Posts: 2
Posted: Fri, 2014-02-21 03:33

yeah... tried adjusting ownerships and still not getting anything. Thanks for thinking about it.

 
raidermax

Joined: 2014-01-26
Posts: 3
Posted: Fri, 2014-03-14 23:10

So, is there any real way of solving this? I have tried moving /usr/share/gallery3 to /var/www/html and still same problem. I really want to install this.

 
spags

Joined: 2010-03-26
Posts: 120
Posted: Sat, 2014-03-15 06:30

Did you make the modification to the installer I suggested above? If so, what directory did it display and does that directory exist?

The other thing to keep in mind is that the RPM package may not be up to date so it could have some older bugs in it.

 
altiris

Joined: 2013-11-03
Posts: 2
Posted: Tue, 2014-03-18 23:25

Okay this is the OP, apparently raidermax does not exist on this website anymore (account got banned for some reason)? I did exactly like you said and now the installer says this (like you said it should):

"We need you to create a directory called var in your gallery3 directory. This sample code works for most users. Run it in the gallery3 directory /usr/share/gallery3/var

mkdir var chmod 777 var"

My permissions seem to be correct, I have tried making Apache own the folder and root, the only other thing seems to be SELinux, which I can turn off for testing but I would prefer it on all of the time.

 
spags

Joined: 2010-03-26
Posts: 120
Posted: Wed, 2014-03-19 07:28

Okay so at least you know for certain that it is looking for /usr/share/gallery/var

This Apache wiki http://wiki.apache.org/httpd/13PermissionDenied describes a process to check the permissions on the folder and the parents. It then goes onto briefly mention SELinux diagnostics (by as you say temporarily disabling it). It has been done likewise in this CentOS forum post https://www.centos.org/forums/viewtopic.php?t=1742 so I guess that is going to have to be a good starting point. Hopefully that is the cause and then it would be a matter of following up on SELinux logs.

 
altiris

Joined: 2013-11-03
Posts: 2
Posted: Mon, 2014-03-24 02:52

I followed that Apache guide, my permissions for the /usr/share/gallery3 are set like this

total 92
drwxr-xr-x. 10 root root 4096 Mar 20 06:58 .
drwxr-xr-x. 263 root root 12288 Mar 11 21:59 ..
drwxr-xr-x. 3 root root 4096 Mar 18 22:57 application
drwxr-xr-x. 2 root root 4096 Mar 18 22:57 bin
lrwxrwxrwx. 1 root root 49 Mar 18 22:57 .htaccess -> ../../..//etc/httpd/conf.d/gallery3-site.htaccess
-rw-r--r--. 1 root root 4239 Jun 28 2013 index.php
drwxr-xr-x. 3 root root 4096 Mar 18 22:57 installer
drwxr-xr-x. 6 root root 4096 Mar 18 22:57 lib
-rw-r--r--. 1 root root 18011 Jun 28 2013 LICENSE
drwxr-xr-x. 22 root root 4096 Jun 28 2013 modules
-rw-r--r--. 1 root root 467 Jun 28 2013 php.ini
-rw-r--r--. 1 root root 467 Jun 28 2013 php.ini~
-rw-r--r--. 1 root root 2578 Jun 28 2013 README
-rw-r--r--. 1 root root 302 Jun 28 2013 robots.txt
drwxr-xr-x. 9 root root 4096 Mar 18 22:57 system
drwxr-xr-x. 4 root root 4096 Jun 28 2013 themes
drwxr-xr-x. 2 root root 4096 Mar 20 06:58 var

I noticed that the folder has 755 permissions, I set it to 777 like the installer says but same problem (I set it back to 755 after). I also set SELinux to permissive and it still had the same problem (I have put it back to enforcing). I can't seem to find the problem.

 
spags

Joined: 2010-03-26
Posts: 120
Posted: Mon, 2014-03-24 08:27

Well I'm just about out of ideas. The only other things I can suggest are to try and change the owner of the directory to something like:

chown /usr/share/gallery3/var www-data:www-data

See what happens then.

Finally, it looks like it is a fairly common problem. A Google for "php is_writable returns false 777" will return a bunch of pages. Hopefully some suggestions from those pages might give you a hint.