JFolder::create: Could not create directory - Joomla - joomla

I end up with below error when I try to install a component,module or plugin.
JFolder::create: Could not create directory
What could be the issue?

Change the below variable to in your configuration file(configuration.php) as shown.
public $log_path = '/logs';
public $tmp_path = '/tmp';
Also make sure that these folder has the folder permission 755.
Read more

Now I found two solutions for resolving this issue,and both of them has been worked very well:
Solution One:
First find the exact absolute path to your tmp folder by using this trick:
Create a PHP file in your website root,for example path.php
Place this snippet of code in the file and hit the save button
<?php
$path = getcwd();
echo "Your Absolute Path is: ";
echo $path;
?>
Navigate to yourdomain.com/path.php in your browser
From now on:
Login to your Joomla Administartor panel.
Go to Global Configuration
Click on the "Server" tab
Change the path to the "Absolute Path(you've just found)"/tmp
Insert this line of code in your .htaccess file: php_value open_basedir NULL
This solution has been worked very well for me,and it's doesn't deal with any Joomla's core file hacking.
Solution Two:
Login to your Joomla Administartor panel.
Go to Global Configuration
Click no the "Server" tab
Change the path from /public_html/tmp to just tmp
Login to control Panel(CPanel),(Or you can use a FTP account for this purpose)
Open File Manager (if you are using FTP,this step must be skipped)
Open Folder "libraries"
Open Folder "joomla"
Open Folder "filesystem"
Right Click on "folder.php" and click Edit.
Look for the line, (search = obd):
$obd = ini_get('open_basedir'); Comment out that line with // at the beginning so it becomes://$obd = ini_get('open_basedir');
Save and Close.

You can change the owner of Joomla folders to your apache server user.
You can find the apache server user with the following command:
ps aux | grep -v root | grep apache | cut -d\ -f1 | sort | uniq
Source: https://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as
For Ubuntu, it's www-data.
After you know the apache user name, then you can change the owner of all the folders and files of your Joomla installation. You can use the following command to do so:
(I suppose that your apache user is www-data)
sudo chown -R www-data:www-data /path/to/your/joomla
If you are already inside your Joomla directory, then you can run the following command:
sudo chown -R www-data:www-data .

After a lot of trouble with this error, I got a break through.
In the configuration.php file, edit the var logpath n tmppath values as below var $log_path = '/home/public_html/sitename/logs';
var $tmp_path = '/home/public_html/sitename/tmp';
This definately will work. And works for me.

Related

Can't write image data to path laravel live project

On my project the user is able to upload a profile picture, and if they don't there is a default picture. I am using this on my Laravel project, and works 100%. Now I have hosted my project online it wont allow me to upload a profile picture but picks up the default image. I'm not sure why. The error message i'm getting is:
Intervention\Image\Exception\NotWritableException Can't write image data to path (/home/n1huer/laravel/public/uploads/avatars/1525256072.png)
This is my file structure within laravel
My controller for this is
public function update_avatar(Request $request)
{
if($request->hasFile('avatar')){
$avatar = $request->file('avatar');
$filename = time() . '.' . $avatar->getClientOriginalExtension();
Image::make($avatar)->resize(300,300)->save( public_path('/uploads/avatars/' . $filename) );
$user = Auth::user();
$user->avatar = $filename;
$user->save();
}
return view('myaccount', array('user' => Auth::user()) );
}
The file path must be right if it is picking up the default?
Any help would be greatly appreciated, thanks
You need to make '/uploads/avatars/' writable as the error is saying that it isn't writable.
Log into the remote server (or use a control panel) and change the permissions to the folder you're trying to write to:
chmod 755 /home/n1huer/laravel/public/uploads/avatars
On a side note,
I would look further into public folders and permissions.:
Here is some good advice:
https://stackoverflow.com/a/37266353/650241
Also, check out the official docs:
https://laravel.com/docs/5.6/filesystem
You can also use the command
sudo chmod -R a+rwx /path/to/folder
to give permissions to a folder and every file and folder inside it. Omit the x from either command if you don't want the files to be executable.
feast your soul here
Happy coding...
For whom this problem occurs:
First you need to know why this problem occurs
- See this path
path (/home/n1huer/laravel/public/uploads/avatars/1525256072.png)
This path is considered this way
http://myname.com/home/n1huer/laravel/public/uploads/avatars/1525256072.png
But it is intended here to be the actual in this
http://myname.com/uploads/avatars/1525256072.png
That is why the problem with the mentioned message occurs
to solve this problem, all you have to do is complete the following
come on this part
->save( public_path('/uploads/avatars/' . $filename) )
and replace it with this code to become like this
->save('./uploads/avatars/' . $filename)
and thus the problem is solved without the need to do anything else that may leave another problem leaving it
I have the same problem while using Image intervention library. It was working well in my local machine but in aws ubunto machine its giving this error. I have tried in many ways but finally I determined this all about permission issue. I'm using below codes to save an image from $request then resize it and then save it in profile folder under public directory.
$img=Image::make($avatar)->resize(300,300);
$img->save(public_path('profile/' .$file_storage_name));
what I see in my aws my profile folder is owned and grouped by root user. So I changed the ownership using sudo chown -R 1000:1000 profile and then changed the group using sudo chgrp www-data profile then give the folder read, write and execute permission using chmod 775 profile .Then magic ,it work .It look like below image

custom url instead of having localhost

I have a folder called example inside htdocs in XAMPP , so I access my url with localhost/example/ . How can I have just example/ instead of localhost/example/ when I type my url ? Thanks in advance!
I've tried editing DocumentRoom in apache htdocs and it didn't work...
I'm not sure if that helps you, but you have to set the html root into your example folder to be able to use localhost/ only. Maybe you can move all contents of the example folder to the parent directory and try again.
If you want to use a real URL like example.com/ instead of localhost/ you can edit your hosts file
sudo nano /etc/hosts
and add the following lines to the end:
127.0.0.1 www.example.com
127.0.0.1 example.com

Magmi import error

trying out the Magmi importer. Saved a file under the /var/import directory, which is found by Magmi and displayed in the dropdown of the file to import section, but when I run the import process I get the error message "NO FILE".
Check the file permission using for the file using linux console command chmod or cPanel
[magmi_root]/magmi/conf/Magmi_CSVDataSource.conf
If the file is not writable, Magmi cannot save the settings. Change the appropriate file permissions save the Magmi profile again, you are done!
Make sure you hit Save Profile after selecting the CSV file in the dropdown.
As a final check, open the magmi/conf/Magmi_CSVDataSource.conf file and see if the filename variable is set to the correct CSV location:
[Magmi_CSVDataSource]
CSV:importmode = "local"
CSV:basedir = "var/import"
CSV:filename = "/absolute/server/path/to/your/import.csv"
CSV:remoteurl =
CSV:remoteuser =
CSV:remotepass =
CSV:separator = ","
CSV:enclosure = ":DQUOTE:"
CSV:headerline =
Did you check if "Filesystem Path to magento directory" is correct? The default value is: "../.." This is correct when Magmi is installed in: [magento_root]/magmi/web/magmi.php I think you can also enter the absolute path to you Magento directory.

Carabiner: cache path does not exist. Please set the cache path in config/carabiner.php

I am using code iginiter. When I try running my application from a local browser then this error is throwing up.
Carabiner: cache path does not exist. Please set the cache path in config/carabiner.php.
I have no clue what it is. Tried some online similar solutions like :
http://www.webdevelopersdiary.com/1/archives/06-2012/1.html
but for some reason nothing seems to work. Please help me to come out of this.
Create cache directory specified in config/carabiner.php, at line #50.
Default setting: $config['cache_dir'] = 'assets/cache/';
Remember that cache_dir path is relative to document root (aka FCPATH from CI ; where index.php is located). On initialization, FCPATH and cache_dir are concatenated, resulting cache_path.
Excerpt from library:
$this->cache_path = $this->fcpath.$this->cache_dir;
Update
You need to create assets/cache directory, which is located in you application root, with write permissions: mkdir -p assets/cache && chmod -R 777 assets/cache
In the end, it will look like this:
$ tree
.
|____application
|____assets
| |____cache
|____index.php
|____system
|____user_guide

how to change web server folder location in xampp

I have installed xampp and by default my website files are stored in htdocs. How do I change the webdirectory path?
Edit the file /opt/lampp/etc/httpd.conf and change the lines containing current web directory path. It should start with DocumentRoot. Update all the places having the current path to the path you would like it to be.
It can be done by editing the "httpd.conf" file present in this path "\xampp\apache\conf\".
Change the line that starts with "Directory ...".
Note that all the lines that start with a hash (#) are just comments and are there just to describe the commands present there in the file.
search for the file "httpd.conf" and change the path in that file.
change localhost's name ? thus instead of having localhostdomain/webdirectory
you may have newdomain/webdirectory ?

Resources