Drupal 7 error: The file could not be created - php

I move drupal 7 from server(live Site) to my localhost(xampp). I change settings.php(files/defualt/settings.php) for database connection and remove cache from mysql database. now in load index, i see my website without css design(only text) and see this error :
**Error message**:
The file could not be created.
The file could not be created.
The file could not be created.
The file could not be created.
The file could not be created.
I think drupal not create css/js compression files. How To Fix This Error? Thanks For Any Help.

While running MAMP
found answer from here:
http://drupal.org/node/581558#comment-6202892
Went to: admin/config/media/file-system
changed "/tmp/php" to "tmp/php" and problem was solved.

similar to the other answer it was a problem with my file system setup. The tmp directory in my live site is in a folder outside the public_html folder.
so I just created a new tmp directory inside my directory structure
and
went to admin/config/media/file-system and
set the tmp folder to point to that new tmp folder.

It seems a permissions problems, after you cleared the drupal cache, all the css and js files needs to be recreated in sites/default/files (or sites/yourdomain/files), check the web users has permission to write in this directory.

You need to give your "Temporary directory" to write permission. From admin-> config -> file system

First Check whether the Temp Folder is available in your sites/default/files directory or not.
If Temp Folder is not available then create the Folder and give the correct access permission to that folder.
If Temp Folder already available there then check the permission of the folder.

Related

How can I delete the hidden .svn folder on my local working copy using php on a remote server? Unlink() permission denied

My SVN repository contains multiple projects. Each project contains the same structure that looks like trunk -> doc -> log.txt. This log file contains the changes made between revisions.
Currently I created a php script that executes when a server build is run. This php script checks out log.txt file on the server's local directory. C://..../..../doc/log.txt.
It writes into this file and then commits the changes. The problem occurs when someone runs the server build with another project. It tried to check out the log.txt file of that project into the same directory and I get an svn error. I no longer need the checked out files in the local directory once the changes have been committed. The only option I could think of is to delete the doc folder (only in my local directory not the repo) before checking out the new one so that the previous log.txt is no longer there.
I found a recursive algorithmthat deletes all files with unlink() and directories with rmdir. The algorithm works well. Unfortunately, the hidden .svn files do not unlink() with permission denied errors. Using fileperms() on all files and parent directories gives back 16895 which translates to 40777 in octal, so I believe they have full permissions. But I believe permissions for users do not have modify/write. Is there a proper way to delete the hidden .svn folder on my server's working copy? Alternatively if anyone can think of a better method to do this. So if AprojA/doc/log.txt is already in the local directory and I check out BprojB/doc/log.txt. Is there a way to checkout and overwrite the existing log.txt with the log file from another project? --force parameter doesn't seem to do much for me.
I also had a vague idea of maybe checking out the top level svn repo with -depth=empty. and then svn update just the log txt files of each project. So instead of checkingout -> committing changes -> deleting. I can just have all log.txt files available. But the problem is they all have the same folder and file name of (doc/log.txt). Still relatively new to all this so I'd appreciate feedback of any kind.
u can use wild cards to delete the log files with the extension. so all files of the same extension will be deleted under the selected folder.

Error Uploading images in drupal

I was trying to upload a custom logo to my drupal site which runs on IIS 8 with PHP.
I got the following upload error :
" Warning: move_uploaded_file(temporary://logo.png): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in drupal_move_uploaded_file() (line 1642 of C:\inetpub\wwwroot\drupalfull\includes\file.inc).
Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php25C3.tmp' to 'temporary://logo.png' in drupal_move_uploaded_file() (line 1642 of C:\inetpub\wwwroot\drupalfull\includes\file.inc).
File upload error. Could not move uploaded file."
Please help me. I have set both read and write permissions on IIS but still it does not work.
Create sites/default/files/tmp folder and give full permissions (777) and change 'Temporary directory' at admin/config/media/file-system.
I think it fixes yout problem.
Regards.
If you are running ISS8 (web server) then the file path is different then the default for Unix.
Make sure you have the temporary folder setup correctly on your settings in Drupal and the folder has write permissions.
You can follow this article at step 5 and 6.
Create the folder:
Drupal uses the Sites\Default\Files directory to store temporary files and therefore must be able to write and modify files in this folder.
Create the folder:
C:\inetpub\wwwroot\Drupal>md sites\default\files
http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/install-drupal-on-iis
Your problem is most likely the permission problem inside drupal. Since you are using windows system, you need to make sure the folder sites/default/files have writable permission for the IIS server. Config the permission to be writable for all user and see if it is working and then limit the permission step by step until you feel comfortable.
I'm going to put another answer in here because I guarantee I'm going to forget how I fixed it!
Basically, on Windows, the default upload folder for PHP is C:\Windows\Temp. As part of the Drupal upload, it moves files from the PHP upload folder to the Drupal Temporary//: folder. There is an issue however in PHP whereby the PHP executable needs read permission to the full path to the uploaded files, so C:\Windows\Temp. If this is not given, it will error out and the file will not be moved.
Details are at http://php.net/manual/en/function.realpath.php which is a function call made deep in Drupal's upload file code.
My fix was to create a folder elsewhere, say C:\PHPTemp, and modify PHP's settings (session.save_path and upload_tmp_dir) to point to this folder instead. After giving IIS_IUSRS full control (overkill? probably!), I was then able to upload images!

Drupal wont change the temporary file path in the database?

I am facing a weird problem. I keep getting error messages on my drupal site by just visiting a node:
The specified file temporary://filezATB93 could not be copied, because
the destination directory is not properly configured. This may be
caused by a problem with file or directory permissions. More
information is available in the system log.
but all the dirs exist and have 777 permissions. I changed the temp dir from /tmp to tmp in the admin config but after visiting the website it switched back to /tmp again, so I put this in the settings.php:
$conf['file_temporary_path'] = 'tmp';
But both the /tmp and tmp have 777 permission. The weird thing is, when I export the database the table variable has the value pair temporary_file_path and it is always set to "/tmp", even if I drop the table and insert "tmp" right after that, every time the db exports "/tmp". How can I change this?
It can be a bit confusing, but the destination directory there refers to a path under Drupal's public file system, not the temp folder (which is the source in this case).
If you update permissions on the files folder, usually DRUPAL_ROOT/sites/all/default, the problem should disappear.

Wordpress Error: A TimThumb error has occured

I've encountered an error after installing wordpress onto a new domain.
I've contacted the theme developer and have had no luck resolving the issue.
I receive the following error when i copy the image link:
Warning: touch() [function.touch]: Utime failed: Permission denied in /home/domain/public_html/wp-content/themes/folioway/core/thumb.php on line 190
Warning: Cannot modify header information - headers already sent by (output started at /home/domain/public_html/wp-content/themes/folioway/core/thumb.php:190) in /home/domain/public_html/wp-content/themes/folioway/core/thumb.php on line 413
A TimThumb error has occured
The following error(s) occured:
Could note create the index.html file.
Query String : src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg&w=187&h=187&zc=1&q=90
TimThumb version : 2.8.2
I have not modified anything else aside from some CSS.
The thumbnails do not appear on the pages, however, the images do appear in lightbox.
I have set the permissions to the cache folder to 777, but this has not resolved the issue.
Any help would be greatly appreciates. Thanks.
It happened to me too, and this is the second time!
If you don't have time to discover why, but you want to keep it working, just rename, or delete your /cache folder; then, create a brand new /cache folder, set permissions to 777, and it will work again.
I found that the cache folder this is referring to is the one within the same folder as timthumb.php - find that file and the related cache folder and give the cache folder 777 permissions.
if you are on a linux based server,
first find the FILE_CACHE_DIRECTORY from the config file by (ex. in linux server open the file in vi commond)
vi /system/web/esupu/wp-content/themes/gadgetry-parent/framework/timthumb/timthumb-config.php
it could be like
define('FILE_CACHE_DIRECTORY', '../../cache/');
SO we change the cache folder ownership to user "www-data" which is the default user for Apache web server which runs this php codes,
sudo chown -hR www-data:www-data /system/web/esupu/wp-content/themes/gadgetry-parent/cache/
also, now better check if folder can be writable too (chmod permissions to 777)
Instead of using 777 as others have suggested, use 755 to the /cache folder.
I just delete the cache folder and refresh the page where code was, it started working.
I think it is the problem of file permission.
Headers already sent is usually a symptom of whitespace either at the beginning or the end of the file - check timthumb.php and make sure you have no blank lines or space either before the
The other possibility is that /wp-content/uploads/ is not writable by the web server, but I'd bank on the first one being the cause.
I added this to a php.ini file:
display_errors = Off
display_warnings = Off
output_buffering = On
TimThumb is a separate open source project that is used by many WP plugins.
If updating folder permissions doesn't work for you, another solution which worked for me was to update the plugin's TimThumb script with the most recent version. You can download it here:
https://timthumb.googlecode.com/svn/trunk/timthumb.php
In my case this file was in wp-content/plugins/events-manager/includes/thumbnails
For others that have this issue when using the FiatLux Wordpress Theme, as I am here is the solution:
Open FTP like Filezilla
Navigate to yoursite/wp-content/themes/fiatlux/includes*
Delete the cache folder
Recreate the cache folder, with permission setting 755
Download the updated timthumb.php file from GitHub and replace (I renamed the old one timthumb.old to test
If you use a Media server/ CDN, then be sure to add that site to the $ALLOWEDSITES array in TimThumb.php file
*If using another Wordpress theme, then find the TimThumb.php file and corresponding cache folder in that theme/ plugins folder in wp-content
in
src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg&w=187&h=187&zc=1&q=90
try put a '?' between .jpg and &w, so it will be like this
src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg?&w=187&h=187&zc=1&q=90

Creating a file from a wordpress plugin

I am creating a wordpress plugin that needs to be able save a file. What is the best way to do this without worrying about file permissions. (i.e Is there a directory that is considered safe to write to?)
If you can upload images to your blog, then wp-content/uploads should be writable.
But file permissions are always something to worry a little about when you're deploying to a new server.
Normally you can create a directory with mkdir(), mermissions to chmod(777) so you can delete this directory from ftp without a root user and this dir will bee fully writable via php. And also chmod you files with 777, otherwise you can't delete without root permissions.

Categories