Installation as subdomain

Some months ago I began the odssey of learning php when I downloaded SMF for a forum. Since then I've been able to manage relatively well but still it can be uphill at times. :)

The host I am using provides Fantastico and so the forum installation itself was a breeze. It was later on when I had to modify themes and such that I had to learn php intricacies.

Anyway, now I am presented with Zenphoto and not having the middleman benefit of Fantastico it's a direct approach. As I read some of the threads on installation and even the wikitrack on it I find myself shaking my head wondering if it's just me or the info.

So, with that in mind I want to ask about the installation:

I have uploaded Zenphoto to the server and followed the instructions and example given by "gagandeep" in the Trac/Wiki. This is what I get:

----------------------------
"Zenphoto Error

MySQL Error: Zenphoto could not connect to the database server. Check your zp-config.php file for the correct host, user name, and password. Note that you may need to change the host from localhost if your web server uses a separate MySQL server, which is common in large shared hosting environments like Dreamhost and GoDaddy. Also make sure the server is running, if you control it."
----------------------------

So, I went to host, (by the way, is the host name/url sufficient or is there a particular designation of the host?), user name - put in my name, and password - password put in.

But then there is a line which follows:
-------------------
// If you're sharing the database with other tables, use a prefix to be safe.
$conf['mysql_prefix'] = "";
-------------------

Well, I definitely want to be on the safe side and the reason for this being that Zenphoto is in the directory of the main domain name for another website I have. Yet, it has it's own domain name. The hosting account I have offers me 6 additional domain names to host on the same account so rather than make Zenphoto a part of the main domain name I decided to get ZP it's own domain.
In other words, it stands by itself, it has little to do with the other main site.

The above says "If you're sharing the database...". As far as I can tell, the host I'm using offers me 50 extra MySql databases so unless I interpret this wrong then I'm not sharing the database with the main site, it's a separate database.

So, just to be sure, I would appreciate some feedback on what I have related here before I go any further. In a way, I feel I'm not too far from getting this thing running since on my first try I only got the index page. Now I actually got a Zenphoto coloful box telling me something was wrong! It's the equivalent of ringing the doorbell at the correct address and hearing a voice from the other side of the locked door asking "Who is it?" :-)

Comments

  • If you have created a database specificallly for zenphoto, then you are not sharing a database. Still, there is no harm in putting something in 'mysql_prefix'.

    The server name is the url of the server. My host lists this under the database on its Database administration page. In my case they have created an alias so mine is named sbillard.powwebmysql.com.

    I, too, have my zenphoto installation in a subdomain. If you do that you need to be sure to modify the .htaccess file `RewriteBase` line. It should read `RewriteBase /

    `

    So, your zp-config.php file should have entries for the following:
    ////////////////////////////////////////////////////////////////////////////////
    // Database Information (the most important part!)
    ////////////////////////////////////////////////////////////////////////////////

    $conf['mysql_user'] = "xxxxx";
    $conf['mysql_pass'] = "xxx";
    $conf['mysql_host'] = "xxxx.yyyy.com"; // Won't need to change this 90% of the time.
    $conf['mysql_database'] = "dbdbdb";

    // If you're sharing the database with other tables, use a prefix to be safe.
    $conf['mysql_prefix'] = "pppp_";
  • sbillard

    Thank you for the reply.

    A couple of questions. And for the purposes here the subdomain is called "PhotoGallery" and in it there is a folder called 'zenphoto1' where I uploaded ZP1.1 to.

    The subdomain (actually referred to as 'addon' domain in Cpanel) of course is located in the main domain which I will call "mywebsite".

    Note: The hosting service added the number 5 to the domain name, so when I log in to the Cpanel the user name is 'mywebsite5'.

    I went to MySql in the Cpanel and created a database called "mywebsite5_zenphoto1"

    Should it then look like this:

    `///////////////////////////

    $conf['mysql_user'] = "mywebsite5_zenphoto1";

    $conf['mysql_pass'] = "the password used for mywebsite5";

    $conf['mysql_host'] = "localhost"; // Won't need to change this 90% of the time.

    $conf['mysql_database'] = "mywebsite5_zenphoto1";

    // If you're sharing the database with other tables, use a prefix to be safe.

    $conf['mysql_prefix'] = ""; (not sharing with other databases so will leave alone unless you think something (what?) should go there.)

    /////////////////////////`

    As for the htaccess file:

    `# htaccess file for zenphoto (should this be changed to zenphoto1 or just leave as is?)

    # NOTE: Change the RewriteBase below to the absolute path to your zenphoto directory.



    RewriteEngine On

    #### !!! Change this to the web path (eg: http://www.yourwebsite.com/photos --> /photos) !!!

    RewriteBase /zenphoto1

    ####`

    The above part, should that be changed to this?:

    `

    RewriteEngine On

    http://www.mywebsite.com/photogallery/zenphoto1

    RewriteBase /zenphoto1`

    Or, since the photogallery is a different domain name:

    `

    RewriteEngine On

    http://www.photogallery.com/zenphoto1

    RewriteBase /zenphoto1`

  • Note: The green highlight should have covered more in the previous post. But I figure you can see what I am referring to.

    The links of course don't go anywhere. At least I don't think they do. :-)
  • The .htaccess should be just:

    `

    RewriteEngine On

    RewriteBase /zenphoto1`

    The rest looks right assuming that the Admin user for your database is `mywebsite5_zenphoto1` and the host your database is located on is the same host that is serving your domain.

    Just as a note: When you are creating a subdomain for zenphoto it is not necessary to also install it in a folder within the subdomain. Also, for my site, the subdomain I created is outside the folders for the main web pages. I don't know if that would make a difference. Probably not.
  • sbillard

    Well, with a combination of help from you and hosting support I was at last able to get to the page that welcomes one to do the setup. It had the input boxes for name and password. I used the n/p that allowed me to get to the page: "$conf['mysql_user',$conf['mysql_pass,etc., but it comes back error. Same for the n/p I used for accessing the database created for ZP. Which n/p are we talking about here? :-)
  • The one on the setup page is the one that you (may have) put in the zp-config.php file for `adminuser` and `adminpass`. If did not set these in zp-config.php, then they are both empty, so just press the login button. (Remember to change the `adminuser` and `adminpass` on the admin options tab.)

    However, you said that putting in the n/p got you past the login, so something else is probably wrong. You should not be seeing anything that looks like `code`. Certainly not `$conf[....` Just WEB pages.

    Can you copy/paste what you are getting shown? (if it is showing your passwords, be sure to alter them!)
  • sbillard

    Okay, the admin name/pw was filled in and got in. There was a link to "see your gallery", clicked it and could see it at the bottom but at top the following was displayed"
    ----------------------------
    Warning: copy(/home/mywebsite5/public_html/photogallery/zenphoto1/albums/videoDefault.png): failed to open stream: Permission denied in /home/mywebsite5/public_html/photogallery/zenphoto1/zp-core/controller.php on line 20

    Warning: copy(/home/mywebsite5/public_html/photogallery/zenphoto1/albums/zen-logo.jpg): failed to open stream: Permission denied in /home/mywebsite5/public_html/photogallery/zenphoto1/zp-core/controller.php on line 21

    Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite5/public_html/photogallery/zenphoto1/zp-core/controller.php:20) in /home/mywebsite5/public_html/photogallery/zenphoto1/index.php on line 13
    ------------------

    Will read your response when I get back from work later today.

    Thank You
  • You can check that all your folders have readwrite permissions for the album folder. This is an error trying to put something into the album folder.
  • sbillard

    You've lost me on this one. I checked the lines 20-21 for the controller.php and they're part of this:

    `$_zp_current_album = NULL;

    $_zp_current_album_restore = NULL;

    $_zp_albums = NULL;

    $_zp_current_image = NULL;

    $_zp_current_image_restore = NULL;

    $_zp_images = NULL;

    $_zp_current_comment = NULL;

    $_zp_comments = NULL;

    $_zp_current_context = ZP_INDEX;

    $_zp_current_context_restore = NULL;

    $_zp_current_search = NULL;

    $_zp_current_search_restore = NULL;`

    Line 13 is part of this:

    `header ('Content-Type: text/html; charset=' . zp_conf('charset'));

    if (in_context(ZP_IMAGE)) {

    include("$themepath/$theme/image.php");

    } else if (in_context(ZP_ALBUM)) {

    if(isset($_GET['zipfile']) && is_dir(realpath('albums/' . $_GET['album']))){

    createAlbumZip($_GET['album']);

    } else { include("$themepath/$theme/album.php"); }

    } else if (in_context(ZP_INDEX)) {

    if (isset($_GET['p'])) {

    $page = str_replace(array('/','\\','.'), '', $_GET['p']);

    if ($page == "search") { zp_load_search(); }

    include("$themepath/$theme/$page.php");

    } else {

    include("$themepath/$theme/index.php");

    }

    }`

    Do you mean go through ALL the folders in Zenphoto or just the ones with the warning mentioned? Change all the nulls to true? Just guessing here.

    Checked via ftp many of the folders and read write is enabled.

    Though I have managed to get a relative handle on php for the SMF forum it's still a bit of puzzle overall. :-)
  • Correction: Ran it through an editor ( which I rarely use).

    Lines 20-21 in controller are:

    `

    if (!file_exists(getAlbumFolder() . 'videoDefault.png')) { copy(SERVERPATH . '/' . ZENFOLDER . '/images/videoDefault.png', getAlbumFolder() . 'videoDefault.png'); }`
    -----------

    Those lines are before the many nulls.

    Line 13 in index.php:
    `

    header ('Content-Type: text/html; charset=' . zp_conf('charset'));`
    ------------
  • trisweb Administrator
    What he means is that you need to set the server's permissions on the folders /albums and /cache to 777 (world writable), in order for PHP to be able to write to them.

    The code is working as designed, it just needs those permissions set.

    In the future checks for these permissions would be good... hmm...
  • trisweb

    Thank you for your reply.

    When I checked the permissions in the directory via ftp there are three boxes: user, group, world.

    User has both read and write checked while group and world have only 'read' checked.

    You're saying I should allow 'group' and/or 'world' checked as 'write' also in all the folders?
  • trisweb Administrator
    Yep. All boxes should be checked for those folders. Yes, all of them. It's not a security risk, don't worry.
  • trisweb

    Forgot to mention that there is also another box, "execute", that wasn't checked for any of the three mentioned above. Should it be checked too?

    The reason I ask, (which may or may not be relevant) is that the gallery will only be used by a handful of people. It's not something where the public in general will upload whatever. Again, this may not be the case re your suggestion of checking all boxes but I ask just the same.

    Thank You
  • The premissions are so zenphoto can store files to the folder. Only an Admin user is allowed to use the zenphoto upload facility, so the number of people viewing the album is not an issue.

    Not sure about the "execute" on some operating systems that permission is used to allow directory access to the folder. There will be no "executable" files in the folder so I don't think there is a problem setting "execute".
  • sbillard & trisweb

    Thank you for all the help. With what the both of you offered and some help also from the host the site is now operating and ready for use.

    There is only one problem left and that is with the 'Archive View'. Whether to the public or from admin, when the link is clicked the following is displayed:
    ------------

    Warning: array_count_values(): The argument should be an array in /home/esophy5/public_html/01twilight/zenphoto1/zp-core/template-functions.php on line 1477

    Warning: ksort() expects parameter 1 to be array, null given in /home/esophy5/public_html/01twilight/zenphoto1/zp-core/template-functions.php on line 1478

    Warning: Variable passed to each() is not an array or object in /home/esophy5/public_html/01twilight/zenphoto1/zp-core/template-functions.php on line 1489
    ----------

    This is a section where the lines (indicated) are at:
    -----------

    if (!is_array($tagcount)) { return false; }
    switch($sort) {
    case "results":
    arsort($tagcount); break;
    `case "abc": ` <-------LINE 1477
    ` ksort($tagcount); break;` <-------LINE 1478
    `}

    echo "
      \n";
      while (list($key, $val) = each($tagcount)) {
      if(!$counter) {
      $counter = "";
      } else {
      $counter = " (".$val.") ";
      }
      if ($option == "cloud") { <-----LINE 1489<br />
      if ($val <= $mincount) {<br />
      $size = MINFONTSIZE; // calculate font sizes, formula from wikipedia
      } else {
      $size =min(max(round(($maxfontsize*($val-$mincount))/($maxcount-$mincount), 2), MINFONTSIZE), $maxfontsize);
      } `
      --------

      When I asked the hosting service about this they sent the following reply:

      "Unfortunately we don't have a quick fix for this problem, this appears to be a programming issue with zencart. You may need to contact them (Zenphoto) to find why these errors exist or if they have a fix for you."

      If I get past this hurdle then I will be 'Zen' free. :-)

      Thank You
  • Please disregard the code highlighting, didn't come out right.
  • trisweb

    On the off chance, I googled zenphoto archive and it shows on trisweb.com the similar archive page problem I noted above although with different lines indicated:

    http://www.trisweb.com/tests/zenphoto-svn/?p=archive
    _____________________

    I ran the template-functions.php throuh a different editor and it's giving me this section:

    $datecount = array_count_values($cleandates); (line 1477)
    ksort($datecount); (line 1478)
    return $datecount;
    }

    function printAllDates($class="archive", $yearid="year", $monthid="month") {
    if (!empty($class)){ $class = "class=\"$class\""; }
    if (!empty($yearid)){ $yearid = "id=\"$yearid\""; }
    if (!empty($monthid)){ $monthid = "id=\"$monthid\""; }
    $datecount = getAllDates();
    $lastyear = "";
    echo "\n<ul $class>\n";
    while (list($key, $val) = each($datecount)) { (line 1489)
    $nr++;
    if ($key == '0000-00-01') {
    $year = "no date";
    $month = "";
    ------------------------

    By the way, which editor are you and the team using? It would help insofar as being on the same line number rather than what different editors indicate -- especially when inquiring about problems like these. The editor I used for the section I noted here is Arisesoft WinSyntax 2.0
  • add a line to the code after the line which is `$alldates = array();` which says `$cleandates = array();`
  • sbillard

    Thank you, that did the trick.

    Everything's looking so good now I'm almost apprehensive about updating the whole thing. :-)
Sign In or Register to comment.