I had all kinds of trouble getting Zenphoto to install on 1and1. None of which I believe are the fault of the Zenphoto project. I am blaming the difficulties on how you need to configure php on 1and1.
What problems did I have. It appears that there were tables that were not created correctly. The way I figured this out was that I was trying to save a ¬†guest user and password to¬†and album. The name wouldn’t stick. When I went in and look under the MySql admin¬†tool (phpMyAdmin), there was no user field in the albums table. Something was wrong right from setup.
So here are the steps that I came up with to get zenphoto installed properly. I can’t say that all of the steps I took were necessary, and some might even be suspect, but in total it works.
First of all, I am on a linux hosted shared server on 1and1. That is important, because of how php must be configured. The commands here need to be entered at the command line. You can ssh here, or use putty from windows, but this is not an explanation on how to do that.
I downloaded the current version which at this point is zenphoto-1.2.4.tar.gz.¬†To do this I used wget so I don’t need to transfer it after downloading. Then I expanded the archive and installed the files.
wget http://zenphoto.googlecode.com/files/zenphoto-1.2.4.tar.gz tar -xvzf zenphoto-1.2.4.tar.gz
Don’t do the setup yet.
I then went to the 1and1 web site, logged in and went to the MySQL Administration control panel. I selected to create a new database, and picked version 6. You can choose between 5 and 6. I picked 6. 1and1 will tell you the user name, password, host, and database name you will need to enter into setup, but don’t run setup yet.
We want to tell apache to use PHP5 instead of 4. To do this we want to modify the .htaccess file that comes with zenphoto. In that file are some rules for rewriteing. We don’t want to change those. Just add a couple of lines. To edit this file I typed
nano -w .htaccess
You need to add these two lines after the comment lines (with #’s) and before the <IfModule mod_rewrite.c> line
AddType xmapp-php5 .php AddHandler x-mapp-php5 .php
Now that is done press ctrl-X to exit, and say yes to saving. Don’t run set up yet. We have a couple more things to do.
Now we need to tell php to turn off magic quotes, and to use UTF character encoding. We do this by creating a php.ini file in the directory where the code is. This is the dumb part. You need this in every directory you have php code. I put it in the root of my zenphoto install, and in the zp-core folder. This is what I put there.
[PHP] magic_quotes_gpc = Off mbstring.internal_encoding = UTF-8
If you want to create this file, type
nano -w php.ini
Now copy the code above and press shift-insert in the terminal window. Then you can press ctrl-X and say yes to save.
I also copied this file to the zp-core folder
cp php.ini zp-core/
Just a note: There are instructions on the web that you can add these directives to your .htaccess file, but that will not work on 1and1 linux shared hosting. You will get a 500 server error. See here.
Ok, now you can run setup. Go to your browser and head to http://www.yourwebsite/zenphoto/ This will in turn tack the zp-core/setup.php to the end and start the setup. There will be a couple of warnings left. First one is about strict permissions. I clicked on the link, and zenphoto set things up how it wanted. Next is the .htaccess file. Ignore this one, because we modified the file. The time stamp should be different.
Now you can go ahead and enter you database information. Press OK, and zenphoto should tell you that everything is A OK. You will then set up an Admin user and password, then you are given the opportunity to log in.
If you want to check out the issue I had, upload some files to a new album. Then edit the album and put in a guest user and password and save. Log out, then click on the album you created and locked. Enter the name and password you entered for the guest user. If when you login you can see the album, you are good to go. When I did this process before this procedure, I would try to save the album with the guest user. The name would disappear once I pressed save. Then when I tried to log in I was given an error.
I hope that saves someone some hassles. Good luck.
OMG .. you made my day ..
Thanks alot Christopher for the VERY helpful article ..
Can I ask you favor?
I was having problem with disable “magic quotes” and “UTF-8” .. but I finally I found your blog with the BEST answer. but what happened next that the ‘Safe mode’ was off, and after these modification I got warning regarding the ‘Safe mode’:
Zenphoto functionality is reduced when PHP safe mode restrictions are in effect.
Do you have any idea?
Thanks in advanced 🙂 ..
Are you on a 1and1 server? I seem to have safe mode off. Try a script with one line like this.
Navigate to this script from a browser. Mine says safe mode off. What functionality do you know you are missing?
No, I’m on SurpassHosting and I just figured it out! the Safe mode was enabled then I disabled it 😀 .. thank God ..
and OMG! FINALLY I INSTALLED it after trying took almost 3 hrs and half O.o!
THANK YOU VERY much Christopher for your help .. much appreciate!
ok one last question! *blush*
the last part which is about ‘guest user’ .. is it a problem or what? coz I just installed as I you know but I dont know if I will face this problem!
(f) ..
Chris,
Thanks for the info… straight froward and concise.
I was doing a local install for testing purposes on an XAMPP ‘server’. Not sure this stuff was necessary for me, but i like the straightforward writing style here. I am a computer guy / photographer, too.
I’m actually having trouble with uploading images…they seem to work, but don’t show up in the album. FTP upload (or, direct copy, in my case) works fine, though…now I just want to see if I can map the albums directory to the directory on my computer where I keep dated (upload date) folders of all the pictures I take for a more automated album creation process. We will see. [/end mostly unrelated rant]
Anyway, take it easy and thanks for the post!
Just wondering what the permissions are on your server. If you can get files there by FTP, but not by uploading within Zenphoto, it would seem like your upload or album folder is not defined or writeable by the user that apache is running under.
You are incredible. Thank you. You should be one of the admin guys in zenphoto. They weren’t much help. You walked me through it.
After 3 days of pulling out my hair, now, at least, I’m uploaded and working. Now I have to pick a theme and start uploading.
I’m saving your address in case I need your help again.
I am glad I could be of help. It did take me awhile to get mine going, which is why I made this post.
As we can’t possibly be familiar with any specific host issues we would have been really grateful if you had let us know about this via our forum. We only get to know about this tutorial via Erika who had problems we never encountered on other shared hosts. We will now add a entry linking to you on our site’s troubleshooting.
Hi Acrylian. This all came out of a post on the forums that I was working through. I didn’t think at the time to make any more official contact.
http://www.zenphoto.org/support/topic.php?id=5472
Pingback: Zenphoto » Troubleshooting Zenphoto
Wow, I think this post is going to really help me! I have a client that hosts with 1and1 and he just started having problems with thumbnails and images not working correctly.
I am going to update to the latest version of Zen Photo and take a look at the .htaccess file to see if that is the problem.
Thanks in advance, I am sure this will help.
http://www.redrumtattoo.com/gallery/index.php
Yeah, 1&1 is causing problems for me too. For some reason, it’s not working well with MySQL 5 of 1&1. Sometimes settings refuse to save and other times the password field for the admin becomes corrupted. Funnily, when I revert back to PHP 4, zenphoto “check for zenphoto update” works but when I’m back to PHP5, it “could not connect to zenphoto.org.” Seems like 1&1 did something funky with their database and PHP installation.
Thanks very much – a great help on a troublesome upgrade to v1.3.1.2 from a previously-working v1.2.6 install on 1and1.
Thank you SO much! you made my day!
Thanks a million! I had to disable magic_quotes_gpc and your advice totally did the trick.
[Can’t believe that they enable it by default. Ugh… ]
[Even worse, you have to add the a php.ini file into *every* directory that serves PHP content? Ugh…]
Anyway, thanks!