[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Big troubles installing in the Server...HELP !
- Subject: Re: Big troubles installing in the Server...HELP !
- From: iisisrael <..hidden..>
- Date: Thu, 7 May 2009 13:21:01 -0700 (PDT)
onavp wrote:
>
> Webserver: Bluehost
> I create de database (not the same name as suggested, because I can't)
> I create a user also
> When I tried to upload the Tables from Pg-central.sql (a problem with the
> $ appear)
> I am stuck there...
>
I'm not a PG expert, but I think I'm getting somewhere....
Bluehost creates a default schema whenever you create a database, which
includes a table called 'users', and I couldn't find a way around it. When
logging in to phpPgAdmin, the user does not have superuser rights and can't
create databases, so you're stuck creating the database using Bluehost's
cpanel.
So the first thing that needs done after creating the database is to open up
Pg-central.sql (from your local drive) and rename all the references to
table names. I appended a prefix to all of them (e.g. 'users' became
'myprefix_users'). The double $$'s I changed to single quotes ('), making
it necessary to escape every ";" and single quote within the string. For
example...
<code>
CREATE OR REPLACE FUNCTION create_user(text) RETURNS bigint AS $$
INSERT INTO users(username) VALUES ($1);
SELECT currval('users_id_seq');
$$ LANGUAGE 'SQL';
</code>
... becomes...
<code>
CREATE OR REPLACE FUNCTION create_user(text) RETURNS bigint AS '
INSERT INTO myprefix_users(username) VALUES ($1)\;
SELECT currval(\'users_id_seq\')\;
' LANGUAGE 'SQL';
</code>
But we still have permissions issues to deal with. There's a comment in
Pg-central.sql that says, "The two below statements must be run from a
single session". Well, they do, but currval isn't allowed, so you have to
put a value in there manually. If all is working as it should, the current
value for 'users_id_seq' is '1', so we make further changes...
<code>
INSERT INTO myprefix_users_conf(id,password) VALUES
(currval('users_id_seq'),NULL);
CREATE OR REPLACE FUNCTION create_user(text) RETURNS bigint AS '
INSERT INTO myprefix_users(username) VALUES ($1)\;
SELECT currval(\'users_id_seq\')\;
' LANGUAGE 'SQL';
</code>
... becomes...
<code>
INSERT INTO myprefix_users_conf(id,password) VALUES ('1',NULL);
CREATE OR REPLACE FUNCTION create_user(text) RETURNS bigint AS '
INSERT INTO myprefix_users(username) VALUES ($1)\;
SELECT \'1\'\;
' LANGUAGE 'SQL';
</code>
Then in phpPgAdmin, click on the "PostgreSQL Server" link, login, select the
database you created, and click on the "SQL" tab. Click on "Browse..." and
find your altered Pg-central.sql, then click "Execute". You'll see the
syntax errors are gone, the tables get created, and the user "admin" records
are all created in all the right places!
Now if we try going to login.pl, we get the exciting 500 Server Error - oh
joy!
When browsing to login.pl, it uses LedgerSMB/Sysconfig.pm, which in turn
uses Config::Std, which neither Bluehost nor the LedgerSMB file structure
contain.
So first, we need to install the Perl module Config::Std on Bluehost. In
cPanel under the Software / Services section, click on "Perl Modules".
Next, in the text box for "Install a Perl Module", put in "Config::Std" and
click "Install Now". This will cpan the module into your local perl
includes directory very nicely, just as if you had ssh access.
Now, any script that is accessed directly by the browser (e.g. login.pl,
admin.pl) needs to have Bluehost's INC script at the top, after the Perl
bash line (#!/usr/bin/perl) and before the first "use Abc::Xyz;" line. This
script block can be found on the same page you used to install the module.
Even if a script itself does not use a module from your local INC directory,
another module that it does use may. I haven't tracked them all down yet,
but if you ever get a 500 Server Error, this would be my first guess.
It might be a pain to add in all the script modifications, but if you have a
copy of the source, run your own SVN repository and create your own branch,
it should be a snap to keep up with the updates, eh?
We'll see how it goes...
israel.
--
View this message in context: http://www.nabble.com/Big-troubles-installing-in-the-Server...HELP-%21-tp23170115p23360472.html
Sent from the Ledger SMB - Development mailing list archive at Nabble.com.