Changing tmp folder to other...?

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
numer9

Changing tmp folder to other...?

Post by numer9 »

Hey,
one of the biggest Polish hosting providers has included one nasty feature - tmp folder is "forbidden". That means that no scripts, images or whatever - can be accessed by PHP or by our CMS. I get "access denied", and CMS 1.9+ is missing all the styles (cms can't read it since it's ..../tmp/cache/xxxx.css now).

I've talked to this provider, there's no way to change it (no .htaccess script, php.ini or other setting).

So the only way is to change something in CMS MS. I've tried with config.php for the start - we got lines:
#Where do previews get stored temporarily? It defaults to tmp/cache.
$config['previews_path'] = '/temp/cache';

It's saved, but still no working. Of course after clearing cache. CSS are still read from "tmp" folder, with no luck. I've grepped cmsms code for "tmp" and found some hardcoded paths... Can someone help me, give some hints howto deal with the problem?
mike-r

Re: Changing tmp folder to other...?

Post by mike-r »

Quick and dirty: put all css into an file in root and dont use the smarty-call for that.
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

yap, thanks.

of course i could go back from {cms_stylesheet} tag to {stylesheet}, switch all the css paths from [[root_url]] back to old-way... but I'm concerned about all the caching possibilities, and i don't wanna go back... maybe if i solve the css problem some sort of "custom-way", the whole website caching will be down... And i don't want that at all...
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Changing tmp folder to other...?

Post by Wishbone »

Is it that you can't use any folder called 'tmp' ? Or you can't use yourdomain.com/tmp ? If it is the latter, you could put the CMS in a subfolder and redirect to it.. Now tmp will in yourdomain.com/cms/tmp
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

yap, i could do it. But when i'll sell the website my client won't accept the fact that every time when someone will enter mydomain.com - will be redirected to mydomain.com/cms... and all the links (to exact news article or to concrete website) - will be longer, and that won't get accept neither (even if i'll write .htaccess scripts to make both addresses work, but the one from the browser will be the problem)...

Thanks for this idea though!

Any other hints, please? Any clues why 'tmp' folder is hardcoded in so many places, like TinyMCE, lib/functions, classes/ or fileloc.php...? ???
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Changing tmp folder to other...?

Post by Wishbone »

Move to another host?
mike-r

Re: Changing tmp folder to other...?

Post by mike-r »

numer9 wrote:won't accept the fact that every time when someone will enter mydomain.com - will be redirected to mydomain.com/cms...
Is it not possible to link the domain directly in the subfolder?
Means: example.org links to /home/bla/blubb/www/cms instead of www?

€: but i think there have to be changed something in the future in CMSMS, i mean its a bug.
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

@Wishbone - yeah, probably that is the best solution. Problem is that i have plenty of websites in this hosting... and i'm running a company that kept telling clients that's it's the best option. Now they want upgrades and it's hard for me to tell them - move to another hosting :/

@mike-r - that's pretty similar to what admins said to me, that "relational" call (tmp/myfile.php) will work, just "domain" call (mydomain.com/tmp/myfile.php) will not. But when i'm assigning domain to the folder and setting up all cms features, it's just the way it is, don't know how to change the call fast (and in all needed places)...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Changing tmp folder to other...?

Post by calguy1000 »

one of the biggest Polish hosting providers has included one nasty feature - tmp folder is "forbidden".
The biggest reasons web providers seem to 'arbitrarily' implement changes like this is to work around or seal off a vulnerability in a package... typically they do it on all of their servers, and see what blowback happens. After 7 years, this is the absolute first first time I've heard of vendors blocking access to tmp though. This is NOT a bug in CMSMS.

Your best bet is to either change hosts, or to work with your host to add an exception to the tmp rule for your sites. If you have a fair number of sites with that host you have some weight to throw around and can request that they customize a few things here and there quite easily.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

Hey Calguy,
i'm in the webdesign business for over 10 years now and i haven't seen such problem as well - i've worked with many providers and hosting companies and noone did such a trick to their clients. I agree that maybe the best option for me is to change hosting company.

I've talked to them - said that i have over 20 domains hosted, more than 20 external clients that i said "it's the best solution" and they became their clients. It didn't make any impression, they said "change to dedicated server, on normal hosting it's our custom-made software and we won't change anything".

So i agree, that kind of partner is lousy. And if that's not enough, they have mySQL 5.5.8 which is causing more problems with installing stuff...

But another thing is that CMS MS has "/tmp" folder in such many places hardcoded. There is config.php and "previews_path" setting. Changing it didn't make much difference in CMS work (or I am wrong?). I needed to change fileloc.php, some code in lib/ folder... and tmp folder is hardcoded even in some modules, like TinyMCE. Maybe it's not a bug, but can you explain what should "previews_path" do?

BTW - thanks for all your time and hints!
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Changing tmp folder to other...?

Post by Wishbone »

In the CPanel hosting that I use, we can point add-on domains to arbitrary directory. I point my add-on domains to ~/websites/<domain> to keep it separate from my primary domain, which is in the public_html directory.

I can't point my primary domain anywhere other than public_html, however, even though I would want it to be in the same path ~/websites. What I do is replace the public_html directory with a sym-link to ~/websites/primarydomain.com so that I can keep all my domain hosting directories consistent.

If you have the ability to move your domain to a different directory, then this could be a solution.


As a side note, I have a different directory for each version of CMS.. e.g. ~/websites/mydomain.com_1.9.1 . When I upgrade, I copy all the files to the new version, duplicate the database, update config.php to point to the new database and path, then test the upgrade. Once I verify that everything works, I tell CPanel to point the domain to ~/websites/mydomain.com_1.9.3 . If something goes catastrophically wrong, the main website is unaffected. If I find something wrong later, I have the old install to compare to, which I can put on a subdomain.. e.g. 191.mydomain.com.
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

Thanks for your ideas... first one - i can't create sym-links, since it's just "shared webhosting" and there is no ssh access or sym-links stuff. I could think about some .htaccess redirections, but i don't want browsers to show anything else that "mydomain.com" - "mydomain.com/cms" or similar - isn't good for my clients. >:(

And the problem isn't related to relative path on the server - I got plenty of domains in different folders. In my panel (something like CPanel) i point my domain to the folder, and then cms cache is trying to reach http://mydomain.com/tmp -> and that call is blocked. That's why I wanted to change "tmp" folder name to "temp" for example. But it's very complicated stuff in CMS MS, and even some modules need to be altered...

And thanks for migration tips. I do exactly the same - copy the database, all the files - and create totally independent version, always make subdomain for this "mirror", i.e. "2011.mydomain.com" - because sometimes it works a bit different than mydomain.com/2011 even for the tests... And after tests I switch domain with subdomain in panel. I've also created small php script to zip all files and unzip it - cause copying 1 big file is better than copying over 4k files (faster and more stable). Backup and having "PLAN B" is a good option for all programmers - I agree to that ;)
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Changing tmp folder to other...?

Post by Wishbone »

I see.. I thought it was your main-domain.com/tmp that was blocked... It's really any-domain-in-any-folder.com/tmp that is blocked?
numer9

Re: Changing tmp folder to other...?

Post by numer9 »

Wishbone wrote:I see.. I thought it was your main-domain.com/tmp that was blocked... It's really any-domain-in-any-folder.com/tmp that is blocked?
yap,
on my host there isn't such a thing as "main domain" - they are all equal ;) and every-domain.com/tmp (every-domain.pl/tmp) is blocked by their custom-made apache-fork software...
mktskk
Forum Members
Forum Members
Posts: 29
Joined: Sat Jan 15, 2011 3:00 am

Re: Changing tmp folder to other...?

Post by mktskk »

numer9 wrote:Hey,
one of the biggest Polish hosting providers has included one nasty feature - tmp folder is "forbidden". That means that no scripts, images or whatever - can be accessed by PHP or by our CMS. I get "access denied", and CMS 1.9+ is missing all the styles (cms can't read it since it's ..../tmp/cache/xxxx.css now).
This hosting providers is home.pl, and it's really the biggest in Poland. Many corporate and professional websites is maintained there. So despite the fact that CMSMS is a very good cms, many people choose a different solution. This is so because they expected a proper system operation after installation. Many of these people do not have time to ask the question why this cms does not work with this provider and choose to operate, alternative systems.

** EDITED BY MODERATOR **
calguy1000 wrote:After 7 years, this is the absolute first first time I've heard of vendors blocking access to tmp though. This is NOT a bug in CMSMS.
That's right. It could be a feature if I could configure my own temp directory name such as name of admin directory.
Is there any possibility to add a variable (eg. $config[temp_dir_name]) to the config file?

PS. Thank you for your great work. :)
Locked

Return to “[locked] Installation, Setup and Upgrade”