Closed ajgagnon closed 10 years ago
@ajgagnon How do you get a tmp file? We don't ahve one... Is it perhaps a plugin you have activated?
I can add - having rewritten the typography field - there are no calls to create tmp files or tmp folders. Whatever is doing that, it isn't Redux typography, per se. Have you examined any of the contents of those files? I'd be interested to know what is in them.
Also, try adding this argument to the typography field on the server in which this is happening
'update_weekly' => false
This will disable the updating of google fonts. Assuming this is not a caching plugin issue, I am half wondering what the tmp folder is set to in that server's php.ini, because it should not be in the wp upload folder.
Thanks guys. Knowing that the tmp file isn't part of the plugin - I'm almost certain it's a server config issue. My first guess is it's an issue with a host running proFTP php.
http://wordpress.org/support/topic/30-upgrade-bug-ftps/page/4?replies=100
It looks like it creates these .tmp files when WordPress mkdir fails. I'm going to troubleshoot some server settings and I'll update the topic when I'm done.
Thanks again,
Andre
You might check the PHP logs of the server in question, if mkdir is bombing, it might be logged.
Since it's not a Redux issue, I'm going to close the ticket (I'm OCD about open tickets), but please, still post back about what you discover. It might help someone else in the future. :)
I'm getting the same problem too. For me it's either info-html.tmp or googlefonts.tmp and my file sizes are zero - completely empty.
I've tracked it down so far that it's only occurring for one the themes and it's using the Redux Framework. I've checked the weekly_updates arg and its set to false. None of my other wordpress sites on this server - standalone or network do or cause this. All other Wordpress FTP functionality works fine - auto update, installation from uploads or web based plugin installations, upload folders are automatically created each year and month too.
-- Edit/Update -- I also tested renaming/disabling the Redux folder name and when I viewed the site the .tmp files stopped being created. Renamed/Enabled back to normal and they started back up again.
-- Update 2! -- Tracked down the issue that was causing the info-html.tmp files to be created. The theme had the following code block in it's config file for Redux (http://themeforest.net/item/magaziner-responsive-wp-news-magazine-blog/6486461/comments?page=5&filter=all#comment_7108309)
if( file_exists( dirname(FILE).'/info-html.html' )) {
/* @global WP_Filesystem_Direct $wp_filesystem /
global $wp_filesystem;
if (empty($wp_filesystem)) {
require_once(ABSPATH .'/wp-admin/includes/file.php');
WP_Filesystem();
}
$sampleHTML = $wp_filesystem->get_contents(dirname(FILE).'/info-html.html');
Commented that out and the info-html.tmp files disappeared. Now to the googlefonts.tmp - any ideas?
First, when adding updates, add a new reply. We aren't notified when edited are made to previous messages, and hence, we don't answer timely. (@Dovy, see the edits to the previous post)
That code block in question initialized the $wp_filesystem if the $wp_filesystem variable is empty. It's necessary, otherwise get_contents will fail, which causes a whole different set of problems. Relying on WP to handle it on it's own - in the past - proved problematic. I'm not even sure why get_contents would create a tmp file, since is should be a read operation, not a write. I'll dive into the WP code and see if there is a condition in which that happens.
FTP functionality. Hmmm.
From class-wp-filesystem-ftpext.php
function get_contents( $file ) {
$tempfile = wp_tempnam($file);
$temp = fopen($tempfile, 'w+');
if ( ! $temp )
return false;
if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) )
return false;
fseek( $temp, 0 ); // Skip back to the start of the file being written to
$contents = '';
while ( ! feof($temp) )
$contents .= fread($temp, 8192);
fclose($temp);
unlink($tempfile);
return $contents;
}
I'll save everyone the trouble of backtracing wp_tempnam
. It create a tmp file via a wp version of get_temp_dir, which looks like this:
function get_temp_dir() {
static $temp;
if ( defined('WP_TEMP_DIR') )
return trailingslashit(WP_TEMP_DIR);
if ( $temp )
return trailingslashit( $temp );
if ( function_exists('sys_get_temp_dir') ) {
$temp = sys_get_temp_dir();
if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
return trailingslashit( $temp );
}
$temp = ini_get('upload_tmp_dir');
if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
return trailingslashit( $temp );
$temp = WP_CONTENT_DIR . '/';
if ( is_dir( $temp ) && wp_is_writable( $temp ) )
return $temp;
$temp = '/tmp/';
return $temp;
}
I guess it's obvious how they end up in uploads/tmp (although why it's not unlinking via the get_contents, I do not know). It also suggests that sys_get_temp_dir is failing. (http://www.php.net/manual/en/function.sys-get-temp-dir.php). Hopefully you're using PHP 5.2.1 or higher.
Have you checked your php.ini for a properly set temp folder, and ensure that folder exists on your server?
Ok, I just pushed a supposed fix, but I cannot test it since I don't have the problem on my servers.
Please pull from this repo and give it a go. It should work. It sets the tmp directory in your environment variable if empty.
Please verify someone...
Just gave it a quick test - Updated my ReduxCore from 3.2.3 to 3.3.3 with the changes made in the fix - it appears to be making more tmp files (Tested using the Theme Option page - admin.php?page=_options ). However the more files might be because I updated the version...
V3.2.3 - created 3 tmp files V3.3.3 - created 11 tmp files V3.3.3 with fix - created 11 tmp files.
Also checked that I was actually using the fixed files - grabbed them manually via Copy+Paste and uploaded them individually. Same result. This is only for the googlefonts.tmp files - I haven't reenabled the code block above as I dont think it does anything and was only causing a new issue and not the googlefont.tmp one.
I said to update from the repo here... Not WordPress.org. You will need to manually install it.
Didn't grab it from Wordpress - grabbed the latest version from the repo and manually uploaded via ftp (replacing the ReduxCore folder)
I then grabbed this redux-framework-e9b932158eb137cccbf8367079e999d52811930e.zip and uploaded it.
Do you have a server I could access to try to debug this?
Email me the details if you can. dovy@reduxframework.com.
Unfortunately not due to security requirements.
Then I don't think I can help if I can't debug. I know it's entirely your server that's the prob. I just hope to find a fix for it.
Thats entirely understandable, i'll keep on it and try and track it down. Maybe ajgagnon can assist here if it turns out to be the same issue, or if he indeed has a fix from a server point of view.
I'm having the same issue (just posted a bug) and can help you track it down. @dovy email me or message me at alan@ufies.org and I can set you up with a login to help track things down.
Just tested and reason found.
Your redux directory is not the same file owner as your ~/wp-content/redux folder created by Redux. Both must be the same. Fix your permissions and you're good to go.
Or you could do this. http://stackoverflow.com/questions/5708282/dynamically-set-upload-tmp-dir-in-apache2 :)
Hi Dovy,
Thanks for the fix. Just to clarify, does the matching owner need to be something specific (like www-data) or do they just need to be the same?
@ajgagnon It's the username that your web server is running under. Also it's possible that the redux folder isn't under wp-content. I had to create mine in wp-content/uploads because for whatever reason it wasn't being created. Basically it creates a temp folder under whatever the upload_tmp_dir folder is set to in that context, so in my case it was there. Then you just have to make it writable by your web server.
I debugged this by throwing a file phpinfo(); in it under the root of my wordpress install, found the upload_tmp_dir and created the redux folder under that, with the same permissions.
Hope that helps.
Really just need chmod 777 or 755...
Pull the latest version of Redux from here or wp,org and it should be resolved.
Thanks for the clarification @dovy and @arcterex. Installing the latest version for wp.org seems to have solved it. Thanks!
That's what I love to hear. :)
If you like Redux, please do one or all of the following: Write a review: http://wordpress.org/support/view/plugin-reviews/redux-framework Follow us: http://twitter.com/ReduxFramework Like us: http://facebook.com/ReduxFramework Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MMFMHWUPKHKPW
Thanks!
OK - do I see a solution to the OPs problem at the end of the thread ? Can someone summarize what it is ?
Your redux directory is not the same file owner as your ~/wp-content/redux folder created
by Redux. Both must be the same. Fix your permissions and you're good to go.
Is that it ? What does 'your redux directory' mean ? I dont own the site, and I dont know what Redux does. I am a sysop with flooding /tmp folders, looking for the source of the problem.
@commonpike In short it's a permissions problem, you need to create a 'redux' folder under (most likely) the default uploads directory in the wordpress install of the user causing the issue. So if user alan has wordpress installed in ~/www then probably the solution is to create the directory /home/alan/www/wp-content/uploads/redux and make sure the permissions allow the webserver.
Depending on your server setup might be either a user like www-data (default on debian/ubuntu) or as the user (in our example, as user 'alan') if the server is set to that apache runs as the user.
Can i ask what goes into this older and why it needs to be created ?
Update to the newest Redux. This was resolved.
Our faulty Redux seems to be part of the installed Total theme of an user. The theme is up to date. I cant find an option to update Redux. Any suggestions ?
Install Redux Framework from the WordPress plugins panel. It will override the Redux that's in the theme.
I have installede redux framework 3.3.6 as a plugin, and still i get thousands of tmp files in my tmp directory every hour
Make a folder called redux inside your wp-contents/uploads directory if it doesn't exist. If that doesn't work, run phpinfo(); and seeif you have a temp directory created.
What host are you on btw?
Oh and please open a new ticket with all your answers.
I have done all in the thread above:
You can see my config on http://www.rec.dk/phpinfo.php.
I'm on Ubuntu 14.04 LTE
Thanks for looking into it.
Please email FTP and wp access to dovy@reduxframework.com.
I just tried to set www-data as owner on all folders in my wordpress site. And the problem went away.
The downside is that I can no longer use my FTP access to set files up. I use the Lineza theme from Themeforest, so I have also written to the publisher.
Do you still need FTP access?
Install the theme and plugins via the wp interface. Then all will work. Your host has the permissions wrong.
I had it on my test server ( MAMP), and moved it to our own Ubuntu server via ftp.
do you think I should just have www-data on the theme and child them folder?
/Jens
Venlig hilsen / Kindly regards
Jens E. Hummelmose
On Sat, Aug 16, 2014 at 7:51 PM, Dovy Paukstys notifications@github.com wrote:
Install the theme and plugins via the wp interface. Then all will work. Your host has the permissions wrong.
— Reply to this email directly or view it on GitHub https://github.com/ReduxFramework/redux-framework/issues/1383#issuecomment-52400968 .
Because of how PHP works, the user who intends to write files needs to be in the same group as the user the webserver runs as.
If I were you I'd do the following:
I'd load the theme/redux plugins as standard zips that you upload via the WP interface.
I'd manually do FTP to the child theme so you can make modifications.
If a server is setup properly, the user is in the same group as the web server's user and thus can read/write the files while they're owned by say www-data.
Glad you figured it out. Best of luck.
thanks a mill.
will try that tomorrow. The server runs as www-data, and since all files and folders are that now it works fine.
I will try upload the theme tomorrow
/jens
Venlig hilsen / Kindly regards
Jens E. Hummelmose
On Sat, Aug 16, 2014 at 8:19 PM, Dovy Paukstys notifications@github.com wrote:
Because of how PHP works, the user who intends to write files needs to be in the same group as the user the webserver runs as.
If I were you I'd do the following:
I'd load the theme/redux plugins as standard zips that you upload via the WP interface.
I'd manually do FTP to the child theme so you can make modifications.
If a server is setup properly, the user is in the same group as the web server's user and thus can read/write the files while they're owned by say www-data.
Glad you figured it out. Best of luck.
— Reply to this email directly or view it on GitHub https://github.com/ReduxFramework/redux-framework/issues/1383#issuecomment-52401676 .
And once again because you're new. ;)
If you like Redux, please do one or all of the following: Write a review: http://wordpress.org/support/view/plugin-reviews/redux-framework Follow us: http://twitter.com/ReduxFramework Like us: http://facebook.com/ReduxFramework Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MMFMHWUPKHKPW
Thanks!
I believe I'm using Version: 3.5.4.1 which came with my theme: Native Church. We too get 1000's of info-htmlX.tmp files in our /tmp folder.
We have a wp-contents/uploads/Redux folder set to 777.
What is the next thing to check why this is happening?
Install Redux as a plugin from the admin plugin browser and delete that redux folder you created. ;)
The problem can be reproduced if someone is using SSH SFTP Updater Support plugin as described here: https://codex.wordpress.org/Editing_wp-config.php#Enabling_SSH_Upgrade_Access and worpress files owner is not web server user. I think wp filesystem should be used only for update purposes not like in sample config. AFAIK this is not how wp filesystem class should be initialised:
if ( empty( $wp_filesystem ) ) { require_once( ABSPATH . '/wp-admin/includes/file.php' ); WP_Filesystem(); }
But this seems to be fixed silently in new version of sample config.
So the new version works? Which sample config? One from the builder?
I have not tested it, I'm currently working on specific page that by customer requirements uses 3rd party theme with built in plugin. The only problem I've found is sample-config.php $sampleHTML = $wp_filesystem->get_contents( dirname( FILE ) . '/info-html.html' ); Someone used this as base for their config. This file doesn't contain this line anymore in repository. I have changed the code to first check if file_get_contents works. Anyway wp-filesystem initialization should contain some credentials prompt and nobody should assume that they are stored in wp-config as far as I understand wp filesystem documentation properly.
Current version should work perfectly.
Best regards, Gabriel.
:) Great. Thanks.
Ahh... this can also be a problem: https://github.com/reduxframework/redux-framework/blob/master/ReduxCore/inc/class.redux_functions.php public static function initWpFilesystem()
Something like this seems to be proper way: // now we have some credentials, try to get the wp_filesystem running if ( ! WP_Filesystem($creds) ) { // our credentials were no good, ask the user for them again request_filesystem_credentials($url, $method, true, false, $form_fields); return true; }
Like described here: http://ottopress.com/2011/tutorial-using-the-wp_filesystem/
Cheers!
Really enjoying the plugin so far. Thanks for the great work.
I have a few issues with a large amount of temporary files being created for some users. It seems every time a page loads, ~28 new .tmp files are created in the wp-content/uploads/tmp/ folder:
Eventually it crashes the server. This is using 3.3.2.3 (the latest on the master branch) and WordPress 3.9.1. Dev_mode is off. This happens both with the plugin and when it's embedded in the theme. I've tried removing one or the other and it doesn't have any effect. I should mention the problem disappears with both the plugin and embedded framework removed.
It doesn't seem to happen on all installs, so it may be an issue with specific server settings. I just can't seem to pinpoint the part of the code that would create these temporary files. Any insight you can give is appreciated!
Thanks,
Andre