Resourcespace // config.php 0 bytes // cannot access resourcespace

I had to change the email setup (from Mandrill to Gmail) so tunnelled in to change the file permissions for config.php so this could be edited and updated.

When I went to save, there was a write error and my config.php file is now 0 bytes and I am unable to access resourcespace — error message /opt/bitnami/apps/resourcespace/htdocs/include/db.php line 90: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@‘localhost’ (using password: NO)

How can I recover my config.php information (there is no backup unfortunately) or get it to a working state at least?

I’m guessing the least I will need will be the MySQL settings and base URL of the installation.

Thank you

Hi @info16,

The config.php file was deleted, so every method using stuff defined there is going to be broken. I can help provide you a new config.php file but it will be useless if you don’t have the database user and password (randomly generated in every installation).

Confirm you have access to these files and I will send you the file with placeholders.

Regards,

David Gonzalez.

Hi David and thank you for getting back to me; I don’t have the DB details — can these be reset at all?

Many thanks :slight_smile:

Hi @info16,

There are several ways of getting your MySQL credentials back. How did you install your stack and where did you install it? (i.e. did you use one of our launchpads for the cloud?)

In case you did not, you should be able to log in as root with the password from your application credentials and substitute the password from the application user. For this, just execute the next query while logged in as root in MySQL

use mysql;
SET PASSWORD FOR 'bn_resourcespace'@'localhost' = PASSWORD('new-password-here');

Remember to substitute the placeholder with the new password.

After making the changes required in the config.php that I will send you by PM, just execute installdir/apps/resourcespace/bnconfig --regenerateKeys 1 and you should be ready to go.

Please don’t hesitate to come back and request further help if none of this worked.

Regards,

David Gonzalez.

Thanks so much for the sample config.php file and instructions for resetting the mysql password.

I did install resourcespace originally using a bitnami stack with the AWS free account option.

I’m still not able to reset the password unfortunately.

I think I’m stuck at the part where you said "you should be able to log in as root with the password from your application credentials and substitute the password from the application user. For this, just execute the next query while logged in as root in MySQL "

Are you able to tell me how to get to this point?

I’ve tried the instructions on this page : https://wiki.bitnami.com/Components/phpMyAdmin_and_phpPgAdmin to make phpMyadmin accessible but when I try and my bitnami server login the window just refreshes and doesn’t let me in.

So, an update.

I’ve managed to reset the mysql password so, all things being equal, I should now be able to use the new config.php file.

Except, when trying to upload to /apps/resourcespace/htdocs/include (using Transmit) I keep getting ‘Could not upload config.php. Write error’

I’ve tried chown-ing the include folder to be bitnami:bitnami and root:root but this hasn’t helped. The include folder has permission of 775. I changed to 777 but still no good, so it’s back to 775.

I can create an empty config.php file in /include but if I try and edit/save, that’s when the error occurs which makes me think it’s either an owner/permissions thing, but it’s a bit beyond me.

Any further help would be appreciated; I feel the solution is (finally) close!

Hi @info16,

I need to know a couple of things before being able to determine how to help you.

  • Can you access through ssh?
  • Can you edit it using sudo [editor_of_your_choice] config.php, editing and saving?

FTP and STFP do not work fine with systems that have restrained permissions, like the case of a stack. They are OK for uploading files, but that’s all.

Regards,

David Gonzalez.

Thanks again David - I wasn’t aware that the stack had restrained permissions.

I was able to use sudo nano config.php and now have a working? config.php file which is awesome, although I’m still getting the error —

Sorry, an error has occurred.

Please go back and try something else.

You can check your installation configuration.

/opt/bitnami/apps/resourcespace/htdocs/include/db.php line 90: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@‘localhost’ (using password: YES)

– so now the error has changed from (using password: NO) to (using password: YES) which is something.

Thank you again for all your help so far, it has been invaluable! What should I try next?

Hi @info16,

seems like your database credentials are wrong. You should not be using root user. The user for this application is bn_resourcespace. Please recheck the config.php.

You can verify manually that the credentials are OK executing /opt/bitnami/mysql/bin/mysqld -uUSER -p (the password will be requested; remember to substitute USER with the user you want to test).

I hope that helps.

David Gonzalez.

Hi @dgonzalez, you were right about rechecking the config.php (missing one underscore, it made all the difference)!!

This has almost fixed it - I was able to get to the login screen, and login.

The database seems to be OK, but I can’t view any of the resources. Right-clicking to inspect the thumbnail shows file paths that don’t exist (they start ok, http://domain/filestore/ - but after that the reference it points to isn’t in the filestore.

Clicking the broken thumbnail to view the resource presents the error -

Sorry, an error has occurred.
Please go back and try something else.
You can check your installation configuration.
(database) line N/A: Got error 28 from storage engine<br/><br/>describe sysvars

Also, the custom logo that used to be there is no longer, and it is displaying the default title.gif, not the new one.

Is this likely to be something to do with the filestore path?

I’m amazed I’ve managed to get this far - I appreciate your assistance greatly, and hope this final? issue may solve it?

Hi @info16,

Could you please post here the apache error logs? They should be located at installdir/apache2/logs/error_log. Also, can you please check the contents of the filestore folder? Maybe it was deleted too…

Regards,

David Gonzalez.

Hi @dgonzalez,

I’ve checked the error logs and they don’t look good for the time just before it all stopped working - there are a lot like this:

.convert.bin: Corrupt JPEG data: premature end of data segment `/opt/bitnami/apps/resourcespace/htdocs/filestore//4/8/9_5dde16be6b7ae60/489_4b5b63174e5f908.jpg' @ warning/jpeg.c/JPEGWarningHandler/343.

The filestore folder still has folders/files in it. I downloaded all these and there was ~4.5gb of images (I’d have expected more, maybe twice that size).

The images that are there still open OK, but I’m guessing something bad happened - the other half of the error log has a number of these errors:

[Tue Apr 19 05:30:46.219587 2016] [pagespeed:error] [pid 13144] [mod_pagespeed 1.6.29.2- @13144] /opt/bitnami/apache2/var/cache/mod_pagespeed/http,3A/,2Frs.psc.org.nz/lib/OpenLayers/OpenLayers.js,d8HSo1:1589: writing file: No space left on device

So would I be right in thinking the server ran out of space and caused some corruption in the database/filestore which has caused this to happen?

All isn’t lost, I suppose, since I still have a lot of the images and can reupload them. I’ve tried uploading a new resource (after resizing the server) and it uploads/displays fine.

Another question - there was no warning that the server was getting full; is there usually a notification, or is it more possible that the client batch uploaded gigabytes of files and the server didn’t get a chance to notify?

Thanks again David, I think it’s nearly as resurrected as it can possibly be. Your help has been extraordinarily valuable.

Hi @info16

I’m glad to hear the help provided by @dgonzalez helped you.

Yes, you would. It seems your server ran out of space and when you change the email configuration it couldn’t save it to disk and corrupted the file.

Since you are using AWS you can download the following scripts:

http://aws.amazon.com/code/8720044071969977

You can configure them to report memory and disk space usage metrics to Amazon CloudWatch. Then you could set an alarm when you would running low on space.

Regards,
Jose