Error 500 in transfer of OJS to another hosting "SQLSTATE[HY000] [1130] Host '127.0.0.1' is not allowed to connect to this MySQL server"

HI,
I solicited hosting assistance, but it hasn’t helped me so far, except to say that the server is working fine. They have not responded for a few days now.
I apologize to @marc, as I only noticed now that I wrote the real name of my site myself, in the initial post of this thread. I can’t edit the first post of this thread and I can’t delete the real name of my site. Perhaps the reason is that too much time has passed.

I made a few attempts:

  1. I changed the Base URL or by removing the “www” in front of the subdomain. No result. I then wrote the Base URL with no www or subdomain. No result.

  2. I simplyfied the DB name, DB User name and password. I removed the underscores “_” contained in them and now they are made up of only numbers and letters. The only underscore left is the hosting prefix. To do this I have created a new database. Nothing has changed, no results. I would like to know if the password that is written in config.inc.php must be written clearly and visibly, or if it must be encrypted with methods such as SHA, MD5 or similar.

  3. I looked for the string “128.0.0.1” in the whole database, but it was not present.

  4. I tried to delete the database and replace it with the old versions that are known to work, but no results.

  5. I upgraded from OJS 3.2.0-2 to OJS 3.3.0-6, as suggested by @marc. The PHP version is 7.3. While doing this I discovered that there was a comment of mine in config.inc.php not preceded by the semicolon “;” . Unfortunately 500 errors remained, but the error messages are this:

Fatal error: Uncaught Error: Call to a member function getConnection() on null in /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php:74 Stack trace: #0 /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php(200): Illuminate\Database\Capsule\Manager::connection() #1 /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/db/DAO.inc.php(65): Illuminate\Database\Capsule\Manager::__callStatic('raw', Array) #2 /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/context/ContextDAO.inc.php(63): DAO->retrieve('SELECT * FROM j...', Array) #3 /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/core/PKPRouter.inc.php(252): ContextDAO->getByPath('my-subdomain') #4 /var/www/vhosts/main-domain in /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php on line 74

If I go in hosting Log I have this:

Warning 79.50.34.172 mod_fcgid: stderr: #2 [/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/context/ContextDAO.inc.php](https://linp129.arubabusiness.it:8443/smb/file-manager/code-editor?currentDir=%2Fmy-subdomain.main-domain.com%2Fvar%2Fwww%2Fvhosts%2Fmain-domain.com%2Fmy-subdomain.main-domain.com%2Flib%2Fpkp%2Fclasses%2Fcontext&subscriptionId=69&file=ContextDAO.inc.php&redirect=%2Fsmb%2Flog-file%2Fbrowser%2Fid%2F392)(63): DAO->retrieve('SELECT * FROM j...', Array), referer: https://www.my-subdomain.main-domain.com/index.php/my-subdomain/index

Warning 79.50.34.172 mod_fcgid: stderr: #3 /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/core/PKPRouter.inc.php(252): ContextDAO->getByPath('my-subdomain'), referer: https://www.my-subdomain.main-domain.com/index.php/my-subdomain/index

Warning 79.50.34.172 mod_fcgid: stderr: #4 /var/www/vhosts/laboratoriogruppo in /var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php on line 74, referer: https://www.my-subdomain.main-domain.com/index.php/my-subdomain/index

Thanks.

Nothing to apologize. Changes made and your site name is now “my-subdomain.my-site-name.com”.

About the issues, I’m sorry to say that we are stuck till you can confirm your DB credentials.
If your hosting company don’t give you this data (they must tell you or at least refer a howto to let you find this essential information by your own) if you like to guess, I still suggest you use the “adminer” method to guess. This web application is very simple and will let you confirm all is running as expected.

Once we got this info, we can move forward.

BTW, you made some changes and most of them don’t make any sense (or could cause additional issues), so I recommend you revert all the change to the beginning and start finding the DB credentials.

Cheers,
m.

Hi!

I used adminer again, and the database appears, with all the tables. What should I report about what appears? Do you want a screenshot? If you tell me what you need, I will provide it to you
I used the new credentials with no special characters and it looks ok.
I had already used Adminer, as reported by some posts above, and even then everything seemed fine. It connected and the tables appeared.

What are the unnecessary changes that I need to revert? If you tell me I will do the revert.

If you prefer, I can create a new database with the credentials of your choice. I can make you a screenshot of the database creation panel, where the host name, port, prefix, password, username, database name appears. The panel is Plesk and nothing else appears. If I log into PHPmyAdmin I can get more details. If you tell me what you need, I will provide it to you.

Cheers

Answers below:

I used adminer again, and the database appears, with all the tables. What should I report about what appears? Do you want a screenshot? If you tell me what you need, I will provide it to you.
I used the new credentials with no special characters and it looks ok.

I trust you, I don’t need a prof. The adminer thing it’s only for you, to be sure your DB credentials are working fine.
If you can see your OJS tables of your server from your local machine, it means your DB server, username, password are right. Save them in good place because we will need them to replace the old credentials in your config.inc.php.

I had already used Adminer, as reported by some posts above, and even then everything seemed fine. It connected and the tables appeared.

Sorry if I misunderstood you but the localhost reference confuses me. I though you was reaching a local DB, not the server one, but now I understand you are able to reach your server’s DB from your local machine (via adminer) so it means now we have the right credentials for sure.

What are the unnecessary changes that I need to revert? If you tell me I will do the revert.

Something went wrong when you moved from one server to the other, so I would encourage you to recover the initial DB backup and files so we can start the process with a clean canvas. I just want to be sure here we didn’t made any damage during the first attempt of fixing.

My main concern here is you upgraded to 3.3.0-6 when I asked to upgrade to the last stable-3.2.

Moving from 3.2.1-2 to 3.2.1-4 (or stable-3.2.1) was a harmless move, but doing a 3.2 to 3.3 migration could introduce new errors over the existing ones and we won’t be able to discover what is really happening.

We are good keeping it to php 7.3, but please recover config.inc.php too.

If you prefer, I can create a new database with the credentials of your choice. I can make you a screenshot of the database creation panel, where the host name, port, prefix, password, username, database name appears. The panel is Plesk and nothing else appears. If I log into PHPmyAdmin I can get more details. If you tell me what you need, I will provide it to you.

This would be great. Your “localhost” reference is still confusing me.
Use the credentials you like (I don’t mind) but please recover the old DB on a new database in your plesk and send it to me (remember to hide the pwd).

Also send me (via private message):

  1. New an anonymized copy of your (recovered) config.inc.php (ie: pastebin).
  2. If you can reach your terminal, the output of “$ php -m” (or the list of phpmodules in your plesk panel).
  3. The output of “phpinfo()”. If you don’t know how to do this, the process is described here.

Cheers,
m.

Hi!

Then I’ll delete the site and create it all over again using the original backup from the initial migration.
Then I’ll set the PHP version to 7.3 and upgrade the site to OJS last stable-3.2.

In fact I don’t have a local database, but I work on a managed hosting, on which I have few possibilities to make adjustments and modifications.

I’m having a hard time posting private messages with this OJS forum system. In fact, when I tried last time, I accidentally created two new discussion topics, while instead I just wanted to send a private message. Now I will try to understand how it is done. Perhaps it could be simpler than expected.

I will try to ask the hosting technicians for the list of PHP modules, and then I will send you a diagnosis of the PHP system with phpinfo.
As long as I can understand how private messages work.

Thanks and cheers!

Then I’ll delete the site and create it all over again using the original backup from the initial migration.
Then I’ll set the PHP version to 7.3 and upgrade the site to OJS last stable-3.2.

That will be perfect.

I’m having a hard time posting private messages with this OJS forum system.

OJS forum is a nice piece of free software called “discourse”.
Things are a little bit different than classic forum, but when you get familiar with it you really enjoy how clean and easy is the UI/UX.

To send a private message to any user, you only need to click over the username and then, click on “Mesage”.

I will try to ask the hosting technicians for the list of PHP modules, and then I will send you a diagnosis of the PHP system with phpinfo.

The hosting companies usually let you select the modules in your php configuration (may be is close to the place where you was able to modify the php version?).

Take care,
m.

Hi!

Sorry for delay, I have lot of work.

I deleted old website and reloaded all files of original migration. But I haven’t completed the installation yet.

PHP version is 7.3.28.

Can I put the output of phpinfo() on pastebin or is it risky? I send It to you via message.

The config.inc.php is on pastebin, here: confic.inc.php of OJS website - Pastebin.com
Please remember wich the correct port on the new hosting is 3306, then the host must be “localhost:3306”. In the old hosting it was only “localhost”. When i first tried the database connection with adminer, I tried both to use “localhost: 3306” and “localhost”, and what works is “localhost: 3306”.

The hosting support says to me only that the PHP functions not allowed are these:

  1. popen, exec,
  2. ini_alter,
  3. passthru,
  4. pcntl_exec,
  5. show_source,
  6. shell_exec,
  7. symlink,
  8. system,
  9. curl_multi_exec,
  10. posix_getpwuid,
  11. opcache_get_status

Thanks and cheers

I deleted old website and reloaded all files of original migration.

Perfect.

But I haven’t completed the installation yet.

Sorry but I don’t understand you.
You can not finish the installation or it’s only you didn’t find time to complete the process yet.
If you are stuck, post your actual error in pastebin. If you need to finish, post your error after install.

Can I put the output of phpinfo() on pastebin or is it risky? I send It to you via message.

Pastebin is risky but you can post your phpinfo safely if you annonymize your data first (search and replace your domainname and your user/pwds).

The config.inc.php is on pastebin, here: confic.inc.php of OJS website - Pastebin.com

I didn’t see any wired thing in your config.

Please remember wich the correct port on the new hosting is 3306, then the host must be “localhost:3306”. In the old hosting it was only “localhost”. When i first tried the database connection with adminer, I tried both to use “localhost: 3306” and “localhost”, and what works is “localhost: 3306”.

This is the only BUT I can have about your configuration. This “localhost” is killing me.
I never see a hosting setting “localhost” as your DB host, but if you was able to login in adminer with “localhost” as a host… it means we are fine, so let’s move on.

The hosting support says to me only that the PHP functions not allowed are these.

We don’t need the forbiden php functions, we need the enabled php modules.

BTW, at this point with the reinstallation, I have doubts about the error we are trying to fix.

Is still this one?

`Fatal error: Uncaught Error: Call to a member function 
getConnection() on null in 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php:74
 Stack trace: #0 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php(200):
 Illuminate\Database\Capsule\Manager::connection() #1 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/db/DAO.inc.php(65):
 Illuminate\Database\Capsule\Manager::__callStatic('raw', Array) #2 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/context/ContextDAO.inc.php(63):
 DAO->retrieve('SELECT * FROM j...', Array) #3 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/classes/core/PKPRouter.inc.php(252):
 ContextDAO->getByPath('my-subdomain') #4 /var/www/vhosts/main-domain
 in 
/var/www/vhosts/main-domain.com/my-subdomain.main-domain.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php
 on line 74`

If not, please post it in paste bin.

Cheers,
m.

Hi!

I apologize, I was not clear. I didn’t complete the OJS site installation because I didn’t have enough time to complete it.
I will complete the installation tonight, after 18:00 (Rome).

The link of config.inc.php is there: https://pastebin.com/bHsFZgUp
What does it mean when you say: “I didn’t see any wired thing in your config.”? Can you be clearer, please? Thank you

This is the only BUT I can have about your configuration. This “localhost” is killing me.
I never see a hosting setting “localhost” as your DB host, but if you was able to login in adminer with “localhost” as a host… it means we are fine, so let’s move on.

Yes, the connection with host “localhost:3306” works fine. In the original config.inc.php there is only “localhost” because I have not set any configuration yet. The config.inc.php that I have now put on pastebin ( https://pastebin.com/bHsFZgUp ) is the original one, without modifications.

We don’t need the forbiden php functions, we need the enabled php modules.

I will ask to my support more details

BTW, at this point with the reinstallation, I have doubts about the error we are trying to fix.
Is still this one?

As I said, at the moment OJS is not installed yet, I will complete the installation tonight, after 18:00 (Rome).

Thanks, cheers

Hi!
As soon as the site is installed, I will put the error log on pastebin.
Then I’ll add the phpinfo too, if I can make it anonymous.
Cheers

1 Like

Perfect. No hurry.

Sure. Sorry but English is not my mother tongue and probably the expression is not right.
I mean that your config.inc.php looks perfect to me. Nothing strange or unusual in it.

Perfect. Or if you like, you can try to find it by your self.
This is usually close to the place where you changed the php version.

Cheers,
m.

Hi,

I asked the hosting support to list me the PHP modules used. I am waiting for an answer.

I have completed the installation of the site. The database connects. The errors that currently appear in the frontend are the following:

Instead, going into the Server Log, the errors are as follows:

Later I will post the phpinfo on pastebin

Thanks and cheers

The frontend of the website doesn’t work. Is completely offline, maybe because of higher PHP version and lower OJS version.
Cheers

Hi!
I’m sorry, but I think there is too delicate information in PHPinfo, even after having anonymized both the domain and the path. In fact, it is easy to understand which domain it is. So I prefer to send it to you privately, but I don’t know how to do it. Messages don’t allow attachments.
Thanks and cheers

The hosting support says that in phpinfo that I gave you, there was already all PHP modules used.
Cheers

I’m so sorry @ojsmk3 but I completely missed your answers till now.

Looks like we have a brand new error to work with:

Fatal error: Uncaught Exception: DB Error: 
Table 'vydeq753_PLXOJSstfnDB7NM.sessions' doesn't exist

The error is telling the same in the frontend than in serverLog: you missed the ojs sessions table.

This table exists in every OJS so only 2 things would happen:
a) You didn’t create it in first place (something when wrong when moving from your former installation).
b) You ran the upgrade script and it breaks your installation.

You can read more about this here:

I’m sorry but in both cases, you need to full start the process till you get a full running OJS (as in former installation).

I think the easiest way is asking for professional help or move your journal to an existing hosting service (like pkp publishing services).

Cheers,
m.

Hi!
I haven’t fully read the page you linked yet. The web site contains a lot of data that I must recover, but I don’t know how.
I wanted to know if taking this missing table from a very old backup of this OJS site, that I have kept, and pasting it into the current DB (creating it) of the current website we can start the site. In this way, perhaps I would recover some of the site’s data, since now I can’t read it.
If this old table is also broken, could I get it from a generic OJS installation and paste it into the current DB?
Thanks for your invaluable help!

I’m sorry, but by reading with a text editor the .sql database file used for migrating the website, I found a “session” table. I’m not expert and maybe I’m wrong.
I paste below a summary of what I’ve found:

--
-- Structure of `sessions` table
--

CREATE TABLE `sessions` (
  `session_id` varchar(128) NOT NULL,
  `user_id` bigint(20) DEFAULT NULL,
  `ip_address` varchar(39) NOT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created` bigint(20) NOT NULL DEFAULT 0,
  `last_used` bigint(20) NOT NULL DEFAULT 0,
  `remember` tinyint(4) NOT NULL DEFAULT 0,
  `data` text DEFAULT NULL,
  `domain` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dump of data of `sessions` table
--

INSERT INTO `sessions` (`session_id`, `user_id`, `ip_address`, `user_agent`, `created`, `last_used`, `remember`, `data`, `domain`) VALUES
('01d38352ed03c350d98124e105a50119', NULL, '106.53.83.56', 'Go-http-client/1.1', 1607564628, 1607564628, 0, 'csrf|a:2:{s:9:\"timestamp\";i:1607564628;s:5:\"token\";s:32:\"3e5c7f16f32ef282d2f7d78fa0363c68\";}', 'my-subdomain-my-main-domain.com'),
('06d057c7f29a29d0261dbd58332c45c9', NULL, '209.17.97.2', 'Go http package', 1609669101, 1609669101, 0, 'csrf|a:2:{s:9:\"timestamp\";i:1609669102;s:5:\"token\";s:32:\"7dcbdb3880eddaadc7a6dcb2f61ca255\";}', 'my-subdomain-my-main-domain.com'),
('0b2850693c59180fa78ff14cc31c2572', NULL, '209.17.97.2', 'Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)', 1609669099, 1609669099, 0, '', 'my-subdomain-my-main-domain.com'),
('0cc33bfc29e3ee9f1ec2ca41e016ac6c', NULL, '93.35.216.201', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36 Edg/87.0.664.55', 1607363062, 1607363230, 0, 'csrf|a:2:{s:9:\"timestamp\";i:1607363218;s:5:\"token\";s:32:\"3e8f9b4ce1e97b63731df61ec1e33ec7\";}', 'www.my-subdomain-my-main-domain.com'),

...etc
...etc
...etc

('fd08e49efe8d6d3764b59ba1492a595f', NULL, '106.53.83.56', 'Go-http-client/1.1', 1607564627, 1607564627, 0, '', 'my-subdomain-my-main-domain.com'),
('fd4c6c92144a2dd863b7c7c7520862d2', NULL, '132.232.81.163', 'Mozilla/5.0 (compatible; TestBot/0.1; +In_the_test_phase,_if_the_spider_brings_you_trouble,_please_add_our_IP_to_the_blacklist._Thank_you.)', 1609970897, 1609970897, 0, 'csrf|a:2:{s:9:\"timestamp\";i:1609970898;s:5:\"token\";s:32:\"0f353ef9d9a694b09d2ebca61b7372d3\";}', 'www.my-subdomain-my-main-domain.com'),
('fdcdd9bed3213a527b60691f504ccf9e', NULL, '93.37.215.199', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15', 1606562572, 1607159039, 0, 'csrf|a:2:{s:9:\"timestamp\";i:1607159040;s:5:\"token\";s:32:\"7fb699418d958d15bcc473ba8bb8b11f\";}', 'www.my-subdomain-my-main-domain.com');

-- --------------------------------------------------------

PS. I translated the comments of above code in english.
Cheers