Mysql or Php problem

Mysql or Php problem

by Declan Hayes -
Number of replies: 5

I created a mysql database from dreamhost’s once click service. I can upload and see where the files are on my ftp.  However, in trying to retrieve the uploaded files, the site points elsewhere. I have one folder for moodle itself, and another for moodledata, which contains the uploaded files.  One of the files is at www.uladh.com/moodledata/2/IRELAND.jpg but the browser points at www.uladh.com/moodle/file.php/2/IRELAND.jpg This is the same story for all files I have uploaded. Even though I am logged in, I cannot download the files. 

Any pointers in very simple English very much appreciated.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Average of ratings: -
In reply to Declan Hayes

Re: Mysql or Php problem

by Jennifer DeJong -
I am having the same problem at dreamhost. Although I know relatively little about this issue, and I do not know whether or not it is helpful to you, I can share dreamhost's response to my query:

"The reason for this is basically moodle uses custom mod_rewrite rules.
So, it takes specific URLs and changes them into something, and passes
them into the php script.

   It's then taking your word document, and trying to put it's URL into
the script, but it isn't working.

Unfortunately, we can't provide support for getting that working, as
mod_rewrite is fairly complex.

Sorry about that! If you need anything else, please let us know."






In reply to Jennifer DeJong

Re: Mysql or Php problem

by Declan Hayes -

Jennifer: I passed on your note to a friend who writes cryptically. Some of his reply appended:

I created a mysql database from Dreamhost's once click service.

*-* Moodle would not even run if the database were not set up correctly.

*-* The Apache server in Dreamhost is set up so that the folder Moodle in YourHost.com can be accessed as http://Moodle.YourHost.com  I think that this uses Apache's
mod_rewrite.  I don't think that PHP even has access to
Apache's mod_rewrite, but it should not be too difficult
(for someone who knows) to modify Moodle if required -- maybe it would take an hour or two.

However, the Dreamhost model is that they set up a secure server, then write a program that will clone it for each individual user.  If the user does not mess with it -- particularly the DNS -- then it should work securely. 

In reply to Declan Hayes

Re: Mysql or Php problem

by Declan Hayes -

http://docs.moodle.org/en/Installation_FAQ#Uploaded_files_give_.22File_not_found.22

Jennifer: FAQ 10 might be the answer here. I am reading over the entire installation documentation again. I also visited http://discussion.dreamhost.com/showthreaded.pl?Cat=&Board=3rdparty&Number=49709&page=0&view=&sb=&part=&vc=1&o= and got some feedback there too. I am reinstalling the whole show but maybe you can try the recommended small fix in the FAQ

In reply to Declan Hayes

Re: Mysql or Php problem

by Declan Hayes -

http://docs.moodle.org/en/Installation_FAQ

I reinstalled Moodle, version 1.6+. This seems to fix the cronjob thing but I am still stuck with the problem mentioned in FAQ 10 and maybe Jennifer is too. I (tried to) change the htt accecc but stil lcannto download the course files.

If nayone has nay insights, please help. Thanks

In reply to Declan Hayes

Re: Mysql or Php problem

by Declan Hayes -

I contacted Dreamhost support and thye suggested I try the following option. (how can I do this without messing up:
FAQ10 in part: If you are not using Apache 2 and you still have this problem (unlikely) then you can switch Moodle to use an alternative method.  The disadvantages are a slight loss of performance for your users  and you won't be able to use relative links within HTML resources.

To use this alternative method, you should change the slasharguments  variable in the Operating System section of Administration Configuration Variables. You should now be able to access your uploaded files.

Dreamhost answer: Your uladh.com domain is on an Apache 1.33 service, not an Apache 2 service, so per their notes the .htaccess solution would not work.

I would not be surprised if our default configuration for all versions disallowed this from a security standpoint: if this were enabled, someone could theoretically download any file on your website (including configuration files with database connection info, script files, etc.) by changing the URL to include the correct filename.  And that's the least of the potential vulnerabilities by allowing script parameters to be piped dynamically via a URL.  Unless Moodle includes a specific safeguard so that only benign files (such as jpegs) can be downloaded in this manner, then this would present a question about security -- I'm not familiar enough with Moodle's actual code to tell whether or not this would be the case.

I would recommend using the alternate solution they offered via the Moodle admin panel.