### Some Links not working after connecting with backup database on the same server

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Some Links not working after connecting with backup database on the same server

Hello everyone,

Due to some server issue, I created a new database and imported the mysql dump and connected that with my moodle site on the same server. But unfortunately some links of images and audio files had been broken. I can not switch back to old database due to new students registration here. Please guide, how may I recover those links. Please check on elearning.sol.du.ac.in

Should I run the replace.php again? But the site is on same server with same url

With Thanks & Regards...

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Could be a browser issue.  I can see all images on front page.  Did you fix it?

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hi Emma,

I had uploaded logo the again, Slider was working file previously. In case of books, some images are missing and audio links not working. For eg. http://elearning.sol.du.ac.in/mod/book/view.php?id=379&chapterid=253

You may check with guest access.

Thanks!

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

I have gone through your website. I think that your database is fine, for certain image and audio files you can check the moodledata folder.check in "moodledata\filedir" whether the file is present or not.

Hope you will able to search it.

Thanks,

_Nikhil

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hi Nikhil,

The link on the image shows

""

When i try to upload again, It shows that it is there in server files and ask for overwrite?

If I try to upload new, then it gives me error " Incorrect pool file content 54f07ce9dd0c29721186135e10fe8a8c29bc5d05"

Thanks!

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

check you database engine and compare it with the previous database engine.

I think you previous engine must be "MyIASM" and current must "InnoDB" due to which this error has occurred.

if yes,then please check below url:

Hope you will find solution in it.

-Nikhil

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hi Nikhil,

Thanks for your reply. I checked the status of database and found it is InnoDB in my current (Restored) database and previous (Original) database.

Also, There is same problem with uploaded PDF files. Some files do not open and gives an error message that the file has been corrupted or broken. Again if, I try to upload it again, there is "Incorrect pool file content 5235a458c879cdae2f8dcec877a5c6998921843d." error.

Now, I can not upload the PDFs again :'(

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hi Fatema,

What Moodle version are you using (always provide this info, along with your server environment: web & database servers used, versions, php, hardware)?

If everything happened after the server issue, did you start by checking that the server is actually without any problems anymore? Check your server (web and database) configuration files and error logs (very important). If you are having corrupt files after uploading them I'd say that this must definitely be a server configuration issue. It could also be that current files in moodledata were damaged after the server issue you mention.

http://docs.moodle.org/26/en/Debugging

Please run the following SQL statement:

SELECT *FROM mdl_filesWHERE contenthash = '5235a458c879cdae2f8dcec877a5c6998921843d';

Also go to moodledata/filedir/52/35 and check file 5235a458c879cdae2f8dcec877a5c6998921843d.

Have you checked disk space?

Sometimes, seemingly unrelated things actually create problems; please disable any Moodle plugins you might have installed. Switch to the standard theme. Purge the cache (Site Admin > Development > Purge all caches). It could be a browser issue on your side; an add-on or a plugin could be interfering with the upload. How about virus and/or malware?

Average of ratings: Useful (1)
Re: Some Links not working after connecting with backup database on the same server

Thanks for your detailed reply. I am using Moodle 2.2.6, PHP 5.3.3, Mysql 5.1.67. I checked the moodledata/filedir/52/35 directory, there exist the file '5235a458c879cdae2f8dcec877a5c6998921843d'
. But it seems an empty file. I am also attaching the result of SQL query.

I also checked the available space on the server. There is enough space (209 GB) in /var .

I had already purged the cache when i connected my site to backup database. Also, there is no browser issue. I also checked the permissions and ownership at data root. Its 755 with apache as owner and group.

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hello Fatema,

Regarding the "5235a458..." file ("SM-1.pdf"), you say that "it seems an empty file". The problem here is that "seems" is a bit ambiguous. What is the actual file size? According to the six database records, it is a 204201 byte PDF file. So here we have a consistent value. The records also show that the file was uploaded several times (by the Moodle admin) but there is only one actual instance being used within Moodle (as a resource). Please check again to determine the actual size of the file. If it is a non-zero file, then copy it to another directory (outside of your web-related directories) and try to open it.

Permissions look fine, though you could set it to 0770:

http://docs.moodle.org/20/en/Creating_Moodle_site_data_directory

http://docs.moodle.org/22/en/Security_recommendations

I see you have full access to the server. What OS are you working with?

Did you check about any non-standard Moodle plugins?

• If everything happened after the server issue, did you start by checking that the server is actually without any problems anymore? Check your server (web and database) configuration files and error logs (very important).

These two recommendations are fundamental in trying to determine the cause of the problem.

Regarding the server settings:

• Apache - Check the LimitRequestBody directive.
• PHP - Check the following:
• post_max_size
• memory_limit
• max_input_time
• max_execution_time

Also check for any .htaccess (dot htaccess) file that could be interfering.

Average of ratings: Useful (1)
Re: Some Links not working after connecting with backup database on the same server

I am using Cent OS 6.3 server and checked the error logs for apache and mysql.

Apache logs shows errors:

[Tue May 13 17:03:31 2014] [error] [client 182.64.46.241] Default exception handler: Can not read file, either file does not exist or there are permission problems Debug: /var/www/dusoldata/filedir/39/83/3983313692007fe2e35d25bc28d690034d5b4339\n* line 143 of /lib/filestorage/stored_file.php: file_exception thrown\n* line 2076 of /lib/filelib.php: call to stored_file->readfile()\n* line 453 of /mod/book/lib.php: call to send_stored_file()\n* line 3914 of /lib/filelib.php: call to book_pluginfile()\n* line 37 of /pluginfile.php: call to file_pluginfile()\n, referer: http://elearning.sol.du.ac.in/mod/book/view.php?id=147

[Tue May 13 17:03:33 2014] [error] [client 122.180.104.149] Default exception handler: Can not read file, either file does not exist or there are permission problems Debug: /var/www/dusoldata/filedir/c2/aa/c2aa7f4881de172b8f311765c45359edda431a14\n* line 128 of /lib/filestorage/stored_file.php: file_exception thrown\n* line 2043 of /lib/filelib.php: call to stored_file->get_content_file_handle()\n* line 453 of /mod/book/lib.php: call to send_stored_file()\n* line 3914 of /lib/filelib.php: call to book_pluginfile()\n* line 37 of /pluginfile.php: call to file_pluginfile()\n, referer: http://elearning.sol.du.ac.in/mod/book/view.php?id=355&chapterid=186

I dont find any issue with mysql logs.

I checked the file size by command line. then deleted all the empty files found in my dataroot directory. After doing this the errors of "Incorrect pool file xxxxxxxxxxxxxxxx" are gone and some of the PDF files those were broken before are now opening normally. But the images and sound files are still missing. However I am now able to upload them again, but its a rigourous task again.

I wish to recover my image and sound files similarly, but not able to recover..

Please share any idea for the same?

Thanking You

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hello Fatema,

Not all zero-sized files should have been deleted, some have a purpose; well, they are history now. At least your PDF are working now.

You could try and just enable the File System repository (even if this seems unrelated):

http://docs.moodle.org/22/en/File_system_repository

You might also want to check the following:

http://docs.moodle.org/22/en/How_to_check_your_database_for_corruption

Cheers!

Average of ratings: Useful (1)
Re: Some Links not working after connecting with backup database on the same server

Thank you very much for the guidance provided by you. One more thing, Should i run the replace.php to fix this issue of broken links??

Because, while I reinstalled the apache and updated php, the data root in config.php had been changed automatically. Then i corrected it. So is it possible that, the links in database may refer to wrong dataroot.

If yes, how may i check and correct those links?

Average of ratings: -
Re: Some Links not working after connecting with backup database on the same server

Hi Fatema,

No, the dataroot parameter references the location of the moodledata directory, so if you change the latter then you need to update the former.

The repace.php script has to be run when you change from one domain to another (e.g. when you go from myolddomain.com to mynewdomain.com), because files are always referenced with their URL, like www.myolddomain/moodle/etcetera/myimage.jpg, not with the filesystem path (e.g. c:\some\path\myimage.jpg). Besides, if you check the moodledata directory, you'll never see the orginal file's name because when you upload a file, it is renamed with the value of its content hash.

So, if you find that an image (e.g. in a Page resource) is referenced like this:

http://themoodlesitename/draftfile.php/etc/image.jpg

And a PDF (e.g. in a File resource) is referenced like so:

http://themoodlesitename/pluginfile.php/etc/somefile.pdf

And themoodlesitename is the actual name of the current site, then both files are referenced correctly.

http://docs.moodle.org/27/en/Search_and_replace_tool