Problem with web installer

A place for users and developers of the Xataface to discuss and receive support.

Problem with web installer

Postby jonbfl » Tue Aug 16, 2011 11:03 am

Ok, stumped again -

I "kinda" thought I understood the basics of getting Xataface going on a new server, but something seems to have eluded me.

I installed the latest incarnation - 1.3rc6 (from the tarball)
on a Centos VPS running PHP Version 5.1.6

After FTP'ing the files into place, I used SSH to chown the /xataface/Dataface/templates_c folder to apache:apache, and chmod'ed 775.

I did the installation test, no problems (apparently) - Got the AOK (who knows)
Dataface 1.3rc6 2510

Installed at /xataface

Installation status INSTALLED CORRECTLY
Templates Dir /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/Dataface/templates
Templates Compile Dir /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/Dataface/templates_c

set up my new database and local user with phpMyAdmin - gave user all privileges on the new database.

OK, time to run web setup
navigated to http://ml.argituz.org/xataface

Got prompted for MySQL user and PW, no problem
Xataface asked me to select database, no problem

I first tried the tarball method -
I got an odd thing - a zero-byte tarball.
so, of course, I suspect (as I really don't know that much) that the xataface/Dataface/templates_c folder is the culprit.

but plinking on that doesn't seem to have an effect.

Somewhere in my head, I think this is a PHP session or a permissions for workspace issue
Got it
It 'sorta' is - its related to PHP Safe Mode - which I don't seem to be able to control, although my php.ini now says:

Code: Select all
safe_mode = Off
; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
safe_mode_gid = Off

I checked my phpinfo(), and that (/etc/php.ini) is the config file in use, and zero others found on server. Although safe_mode was 'Off', I tried things with the sage_mode_gid = On also - no dice.
and YES - I restarted each time, even took the container down. :wink:
Code: Select all
[Tue Aug 16 12:23:25 2011] [error] [client 70.88.58.12] PHP Warning: set_time_limit() [<a href='function.set-time-limit'>function.set-time-limit</a>]: Cannot set time limit in safe mode in /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/installer.php on line 24, referer: http://ml.argituz.org/xataface/installer.php

I guess I could comment that out - while I query the host's help desk.

BUT - I'm also still getting this (which seems to be what is killing the tarballs)
Code: Select all
[Tue Aug 16 12:23:45 2011] [error] [client 70.88.58.12] PHP Notice: Undefined variable: compression in /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/installer.php on line 389, referer: http://ml.argituz.org/xataface/installer.php?-action=db2app


this appears to be the offender:
looks like $compression is not set - must be failing that regex
Code: Select all
function archive2app__process($values){
      require_once 'Archive/Tar.php';
      
      if ( preg_match('/\.gz$/', $_FILES['archive']['name']) ){
         $compression = 'gz';
      } else {
         $compression = null;
      }
      $archive = new Archive_Tar($_FILES['archive']['tmp_name'], $compression);

...

default: // download_tarball
            //$tarpath =  $_FILES['archive']['tmp_name'];
            if ( $compression == 'gz' ){
               $mimetype = 'application/x-gzip';
            } else {
               $mimetype = 'application/x-tar';
            }
            header('Content-type: '.$mimetype);
            header('Content-Disposition: attachment; filename="'.basename($tarpath).'.tar.gz"');
            echo file_get_contents($tarpath);
            exit;

(the following both caused by Safe Mode issue, I guess)
Code: Select all
[Tue Aug 16 13:04:20 2011] [error] [client 70.88.58.12] PHP Warning: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: SAFE MODE Restriction in effect. The script whose uid is 10002 is not allowed to access /tmp/quotations_baseqlaAbV owned by uid 48 in /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/installer.php on line 396, referer: http://ml.argituz.org/xataface/installer.php?-action=db2app
[Tue Aug 16 13:04:20 2011] [error] [client 70.88.58.12] PHP Warning: file_get_contents(/tmp/quotations_baseqlaAbV) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Success in /var/www/vhosts/argituz.org/subdomains/ml/httpdocs/xataface/installer.php on line 396, referer: http://ml.argituz.org/xataface/installer.php?-action=db2app

---------------------------------------------------------------------------------------
OK, I'm at the tag end of what I know to fix this, :shock:

Oddly enough - the FTP client won't attach, although I am quite sure I handed over good credentials. Oh well - I'm going to check out the 'script method' here in a bit while this gets sorted out. Really quite odd. (no errors drawn, it just doesn't think the credentials are good.)


Thanks to all
8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problem with web installer

Postby shannah » Tue Aug 16, 2011 11:43 am

I seem to recall having some problems with PHP 5.1.x... It is missing some critical functions. This is an annoyance that CentOS repo doesn't have 5.2 or 5.3 by default. There are a number of articles around the net that show how get 5.2 or 5.3 through yum... that's generally what I've referred to to get the update.

Although looking at your immediate issues, it's not the php version that is the problem. It is that safe mode is still on. Sometimes that can be a real pain to turn off as there may be other config files for apache that override the default. In your phpinfo() does it say safe mode is On? If so then you need to find where it is specified. In any case it is safe mode that is the killer here. You need to turn it off somehow.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with web installer

Postby jonbfl » Tue Aug 16, 2011 1:37 pm

Yep, thanks Steve.

In the past two years of this project, I have learned a great deal about PHP (not nearly enough), including how may different places you can "put" stuff (I guess a lot like Apache, huh???)

BTW, I tried the ./makefile, and it worked correctly (well almost). I'll give a report on that after I get the host on this safe_mode matter. The ./makefile created application failed on the 'safe-mode' issue (as you probably would expect) In fact, it even said so - LOL

Thanks for all the support, and I'm gonna kick this thing into shape (I have my own Linux servers, but I don't host client applications). I'll simply keep working on my machines, and give the beta testers access - that's what we did on the first leg anyway.

8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problem with web installer

Postby jonbfl » Thu Aug 18, 2011 7:39 am

Dear Steve:

I got it all sorted: there were a few things that were a bit weird, and I'd like to share how they were fixed. It turned out we had both the matter of the PHP safe mode option and a PHP sessions issue.

First issue -- one I would've never figured out -- the PHP safe mode problem. It turns out all the searching for 'safe mode' in the .INI files for PHP was for naught. The VPS I am using is hosted with the Plesk control panel version 8.6 (I actually use Webmin to administer it) BUT -- the Plesk control panel has a control for the PHP safe mode in Domains > Set up > next to the PHP box, there is a checkbox for safe mode. If it's selected, all the.ini affixing you do won't matter, Plesk will override any configuration change to make (thanks to KnownHost for good support with an explanation).

Once I made that change and restarted, I encountered another set of errors. Now the problem was. No write permissions in the default PHP sessions folder. I tried manually creating the sessions folder the Xataface error message suggested and giving the Apache user ownership of the folder. No dice. I then tried using CHMOD 777 to the folder, also no dice. I took a look at the tail of the error log and found there was an allowed path directive that defined where the TMP folder would be for the application. Rather than trying to determine the cause of this error (I suspect the control panel again), I used the option to add "session_save_path('/path/to/my/xatafaceapplication/tmp'); to index.php, then created the /tmp folder, and gave it the same rights as templates_c.

This cleared all the error messages, but I was left with a Xataface application that apparently had no CSS applied (plain text). The application actually worked correctly, but no styling. I searched the forum and use the Google search for Xataface, no CSS display, but was unable to find a meaningful result.

The Xataface application I had created was made with the 'makesite' method. I decided to try the web installer and see if I could make a tarball. That worked fine with the safe mode off, no problems ironically with the PHP sessions. I took a tarball and extracted it into another folder, fixed templates_c and added the /tmp folder as described -- then pointed my browser to it. Voilà, works exactly right.

I took a look at the index.php created by the two alternative methods and discovered the difference. The index.php created by the tarball archive had no trailing PHP close tag and the one created by makesite had that closing tag. I also found another problem with makesite -- I specified the folder name to be ../quotations_base on the command line (which I think should have placed in the root of htdocs) -- but the folder that was actually created was named '..quotations_base' and was located in the Xataface folder. (I think its an unescaped slash).

tarball:
Code: Select all
<?php //Main Application access point
session_save_path('/var/www/httpdocs/quotations_base/tmp');
require_once "/var/www/httpdocs/xataface/dataface-public-api.php";
df_init(__FILE__, "/xataface");
$app =& Dataface_Application::getInstance();
$app->display();


makefile:
Code: Select all
<?php
/**
* File: index.php
* Description:
* -------------
*
* This is an entry file for this Dataface Application.  To use your application
* simply point your web browser to this file.
*/
session_save_path('/var/www/httpdocs/quotations_base/tmp');
$time = microtime(true);
   // use the timer to time how long it takes to generate a page
require_once '/var/www/httpdocs/xataface/dataface-public-api.php';
   // include the initialization file
df_init(__FILE__, '/var/www/httpdocs/xataface');
   // initialize the site

$app =& Dataface_Application::getInstance();
   // get an application instance and perform initialization
$app->display();
   // display the application
$time = microtime(true) - $time;
echo "<p>Execution Time: $time</p>";
?>


(I shortened the actual pathnames)


The makesite method also does not create the .htaccess in the resulting Xataface application folder.

I hope this helps someone else in the future.

Thanks very much
8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 18 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved