Re: getting a 404 with Media View
Thanks brian! I finally got around to testing this in our production environment tonight. Sure enough, the path wasn't right. I added APP . to the front of my path and it fixed the problem. Thanks for the advice. It's still odd to me that it works in our test environment fine without it, but not in production. Wonder if there is some sort of configuration in apache that could cause this. Oh well, got it working, thanks again! On Jul 28, 12:32 pm, brian wrote: > MediaView::render() fires a 404 if ... you guessed it--the file cannot be > found. > > I had some similar trouble a while back (see link below). I placed a > die(debug($path)) line just before that check and eventually figured > out the problem is that is_dir() can use a relative path and it was > throwing things off. I'm sorry that I can't remember the details > better than that but I solved the problem by setting path param like > so: > > 'path' => APP.$result['ItemFile']['directory'].DS, > > Although, if your app is working locally, perhaps the problem is > simply that apache doesn't have read permission on that directory. But > start with debugging the path to be sure it what you expect. > > http://groups.google.com/group/cake-php/browse_thread/thread/0f648c14... > > On Tue, Jul 28, 2009 at 10:37 AM, Stinkbug wrote: > > > I'm assuming this is an apache config problem, but I'm not sure what > > could be causing it. Thought I'd just ask the community to see if > > anyone knew what the problem might be. > > > I'm using the Media view to download files and have the files > > directory outside the webroot. I'm getting a 404 Page cannot be found > > error when tring to download the file. It works in out test > > envirnoment just fine, but when I move into production, I get this > > error. Could it be an apache config problem, or an app problem? > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting a 404 with Media View
well let us know what you come up with it may help someone in the future On Jul 29, 9:49 am, Stinkbug wrote: > Thanks for the tips guys. I'll have to do these tests late at night > since it's on a production box. Since I'm using CakePHP I haven't > messed with the .htaccess files. They are what comes with Cake. The > permissions on the directory is chmod 777. the owner and groups are > root.data, the same as our test box and it works fine there. The > files in the directory are wwwrun.www, which is the apache user I > guess. > > My files directory is actually outside of the app directory. I wanted > to set it up this way for deployment reasons. So with the debug > information on my local windows box, I get something like this: > > C:\wamp\www\intranet\app\../files\filename.pdf > > which I thought was a bit odd, but it still works. > > On our test linux box I got something like this. > > /srv/www/vhosts/intranet/app/../files/filename.pdf > > and it works fine. I'm leaning towards some sort of config problem, > whether it's permissions or something in apache. It's just odd to me > that it would work fine on my local box and the test server, but not > on production. I'll check the debug stuff on production tonight > probably. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting a 404 with Media View
Thanks for the tips guys. I'll have to do these tests late at night since it's on a production box. Since I'm using CakePHP I haven't messed with the .htaccess files. They are what comes with Cake. The permissions on the directory is chmod 777. the owner and groups are root.data, the same as our test box and it works fine there. The files in the directory are wwwrun.www, which is the apache user I guess. My files directory is actually outside of the app directory. I wanted to set it up this way for deployment reasons. So with the debug information on my local windows box, I get something like this: C:\wamp\www\intranet\app\../files\filename.pdf which I thought was a bit odd, but it still works. On our test linux box I got something like this. /srv/www/vhosts/intranet/app/../files/filename.pdf and it works fine. I'm leaning towards some sort of config problem, whether it's permissions or something in apache. It's just odd to me that it would work fine on my local box and the test server, but not on production. I'll check the debug stuff on production tonight probably. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting a 404 with Media View
sounds like a permissions problem. who owns that directory? if you are in a shell type "chown accountnameHere /htmldirectory/" and check read/execute permissions. also a stray or misconfigured .htaccess can cause these problems. On Jul 28, 10:37 am, Stinkbug wrote: > I'm assuming this is an apache config problem, but I'm not sure what > could be causing it. Thought I'd just ask the community to see if > anyone knew what the problem might be. > > I'm using the Media view to download files and have the files > directory outside the webroot. I'm getting a 404 Page cannot be found > error when tring to download the file. It works in out test > envirnoment just fine, but when I move into production, I get this > error. Could it be an apache config problem, or an app problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting a 404 with Media View
MediaView::render() fires a 404 if ... you guessed it--the file cannot be found. I had some similar trouble a while back (see link below). I placed a die(debug($path)) line just before that check and eventually figured out the problem is that is_dir() can use a relative path and it was throwing things off. I'm sorry that I can't remember the details better than that but I solved the problem by setting path param like so: 'path' => APP.$result['ItemFile']['directory'].DS, Although, if your app is working locally, perhaps the problem is simply that apache doesn't have read permission on that directory. But start with debugging the path to be sure it what you expect. http://groups.google.com/group/cake-php/browse_thread/thread/0f648c149c67bdcd/ec1f52e6f593017a?lnk=raot&fwc=1 On Tue, Jul 28, 2009 at 10:37 AM, Stinkbug wrote: > > I'm assuming this is an apache config problem, but I'm not sure what > could be causing it. Thought I'd just ask the community to see if > anyone knew what the problem might be. > > I'm using the Media view to download files and have the files > directory outside the webroot. I'm getting a 404 Page cannot be found > error when tring to download the file. It works in out test > envirnoment just fine, but when I move into production, I get this > error. Could it be an apache config problem, or an app problem? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---