webERP Forum

Full Version: create new company on a web host
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi.

I'm having trouble creating a new company in webERP installed on a web host. I hope someone can help with a good answer.

I created a new database ('comp2') and new user (also called 'comp2') with all permissions in the web host's <my URL>/cpanel. I'd think the new DB should appear in public_html.webERP.companies, but it doesn't. Maybe I need this next step:

I ran<my URL>/Z_MakeNewCompany.php as suggested by Exson in a prior thread. I log in using the demo database initially installed. Next I see the 'Make New Company Database Utility'. I entered 'comp2' for company abbreviation, uploaded a logo file and checked 'Create Database?' But when I click Proceed, I get:

Database Error : Access denied for user 'erpsmall_user'@'localhost' to database 'comp2'. Database SQL Failure : The SQL that failed was CREATE DATABASE comp2

Adding a new company works properly when I'm in localhost, but not on my web host.

I'm sure others who are as confused as I am by what I think is a simple problem can benefit from a clear set of steps on how to do this. I certainly will. If not, is there a document somewhere that I can reference?

Thanks in advance,
Buz
Hi, Buz:

According to the error message, you set the database user as erpsmall_user in your config.php file. But what you granted authority in your host is comp2. I guess it's the reason that your host denied erpsmall_user to access the database comp2 and you cannot create the database accordingly.

Hope it's helpful.

Thanks and best regards!

Exson
Thanks, Exson.

config.php has:

$DBUser = 'root';
$DBPassword = '';

I did not create a user erpsmall_user in the web host erpsmall_comp2 DB.

I followed Phil's instructions dated Sep 29, 2011 (make a directory under companies with exactly the same name as the new db you just made, then copy the directories from your other company directory over to the new directory). I verified that the erpsmall_comp2 folder in public_html/weberp/companies exists and has the same contents as my demo DB. When I login to erpsmall_comp2 and I get this message:

Warning: mysqli_connect() [function.mysqli-connect]: (42000/1044): Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2' in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 17

Warning: mysqli_set_charset() expects parameter 1 to be mysqli, boolean given in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 23
Connect failed: Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2'
Fatal error: Call to undefined function _() in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 30

I guess I don't understand how all this works so I'd appreciate a more detailed explanation or a reference to a document that clearly explains adding a new company.

Regards,
Buz
[undefined=undefined]Hi, Buz:[/undefined]

It seems that your database server add a prefix for user name and database automatically. It's very strange to add prefix for user name. Something must be wrong. I think the problem maybe that you set the wrong user and password to the database. In my impression, a virtual host will not allowed a root user.
You should set the users and database right for the mysql server, otherwise, you cannot log in.
Why not set the DBUser as what you said 'comp2' in the config.php and the right password? Then try it again.

Thanks and best regards!

Exson






(06-02-2013 09:38 PM)Buz Wrote: [ -> ]Thanks, Exson.

config.php has:

$DBUser = 'root';
$DBPassword = '';

I did not create a user erpsmall_user in the web host erpsmall_comp2 DB.

I followed Phil's instructions dated Sep 29, 2011 (make a directory under companies with exactly the same name as the new db you just made, then copy the directories from your other company directory over to the new directory). I verified that the erpsmall_comp2 folder in public_html/weberp/companies exists and has the same contents as my demo DB. When I login to erpsmall_comp2 and I get this message:

Warning: mysqli_connect() [function.mysqli-connect]: (42000/1044): Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2' in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 17

Warning: mysqli_set_charset() expects parameter 1 to be mysqli, boolean given in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 23
Connect failed: Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2'
Fatal error: Call to undefined function _() in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 30

I guess I don't understand how all this works so I'd appreciate a more detailed explanation or a reference to a document that clearly explains adding a new company.

Regards,
Buz
My mistake. The 'root' user is in my localhost webERP.

The web host version has $user = 'erpsmall_user'. When I login to my existing demo database as an administrator and then run <my URL>/webERP/Z_MakeNewCompany.php, I get: Connect failed: Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2'.

The new company shows in public_html/webERP/companies and has the same folders as for my demo DB. And it also shows in my webERP droplist at login. When I try to log in, I get:
Access denied for user 'erpsmall_user'@'localhost' to database 'erpsmall_comp2' in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 17

There is only one configuration.php file on the web host. Perhaps there should be only one DB in MYSQL with one or more companies?

I'm sure my error is very simple, but I do not see it. I am missing something simple but important. We people who are new to webERP need a section in the manual about how to create a new company.

Thanks,
Buz
Hi, Buz:

Since different ISP has different configuration, it's hard to know what goes wrong.

Usually, create a new companies is quite simple, what you need is just to login to the demo database and run the Z_MakeNewCompany.php, and follow the instruction, everything will goes well. Before you did run the Z_MakeNewCompany.php, you DO NOT need to create database, users etc. If you did created the new company directory as what you said, the scripts will never to create a database and populated it with tables for you.

Since you database has not created successfully , you should not log in with the new companies you created.

A solution maybe to create those tables in phpmyadmin maually, which means you run the weberp-new.sql in cpanel with phpmyadmin. Then try to log in again.

Thanks and best regards!

Exson
Thanks for your help, Exson.

I am closer, but still not there ...

I just tried again, this time I did NOT create a new DB at the web host. I ran Z_MakeNewCompany.php, logging in to my demo DB. At the 'Make New Company Database Utility' screen, I entered 'company3' for company name, uploaded a jpeg logo, and did NOT check 'Create Database?' (I get an 'access denied' error if I check 'Create Database'). After clicking the Proceed button, I got this message:

"The new company database has been created for company3. The company details and parameters should now be set up for the new company.
NB: Only a single user "demo" is defined with the password "weberp" in the new company database. A new system administrator user should be defined for the new company and this account deleted immediately."

'company3' appears in the webERP log in window AND in /home/erpsmall/public_html/webERP/companies, with all folders present. But there is no new database on the web host.

But when I try to setup company details or login to 'company3', I get:
Access denied for user 'erpsmall_user'@'localhost' to database 'company3' in /home/erpsmall/public_html/webERP/includes/ConnectDB_mysqli.inc on line 17

The company got created; I just can't log in to it. I wonder why?

btw, the web host (http://www.rochenhost.com) requires the prefix 'erpsmall_', although that may the reseller's requirement.

Also, http://www.weberp.org/weberp/doc/INSTALL.txt has a description for how to use weberp-new.sql. I ran it, using 'erpsmall_company3' as DB name. It ran successfully, but I still get the same error when I try to log in: Access denied for user 'erpsmall_user'@'localhost' to database 'company3'

Buz
Hi Buz,

It sounds like the host has some tricky stuff going on... the same mysql user must be able to access both databases - I am picking that there is some other user that has the permssion to access the new company database, but webERP needs the same mysql user to have access to both.
Hi Phil,

The host is one I bought through a reseller for rochonhost. He seems to hold usage info close to the vest. In short, he won't tell me how; he wants me to pay him to do it. But I must be able to do this myself, so here I am, whacking my way through the bush.

Any hint about what I should try next?

Thanks,
Buz
Hi, Buz:

It seems that your sql server administrator has set the max_user_connections=1; It maybe set in the configuration file, so it's have big chance that you can not modify this setting in cpanel.

The simple step to solve this problem maybe like this:
1) Use the script to install a production company. Then you get the companies directory and database ready.
2) Hack the ConnectDB_mysqli.inc, (if you use mysqli, otherwise, use ConnectDB_mysql.inc) at line 17 which is
$db = mysqli_connect($host , $DBUser, $DBPassword,$_SESSION['DatabaseName'], $mysqlport);
You add a condition to just which user, which password to use for different database.

Just my2cent, I didn't test it and not sure if it's workable.

Thanks and best regards!

Exson


(06-03-2013 06:07 PM)Buz Wrote: [ -> ]Hi Phil,

The host is one I bought through a reseller for rochonhost. He seems to hold usage info close to the vest. In short, he won't tell me how; he wants me to pay him to do it. But I must be able to do this myself, so here I am, whacking my way through the bush.

Any hint about what I should try next?

Thanks,
Buz
Pages: 1 2
Reference URL's