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

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

Related

Issue getting a file with Laravel

Hi I do not know what is happening but I want to get a file from the storage folder and it says that it does not existe but it exists I mean I go to the folder and it is there..
I retrieve the file like this:
$path = storage_path('app/public/' . $settlement->support);
$settlement_file = Storage::disk('local')->get($path);
And I get this error:
message: "File not found at path:
home/jysparki/newjis.jisparking.com/storage/app/public/06152617_8-2025.pdf"
and If I go to the folder it exists so I wonder what am I doing wrong? Thanks.
If you look at config/filesystems.php file and find disks array, you may notice that root under the local disk key is set to storage_path('app'). Well it's up to what the value may be in your case you're free to change it, but what does this mean is whenever you call Storage::disk('local') method it will try to find files relative to storage_path('app'), so there is no need to specify full path. Try this instead
$settlement_file = Storage::disk('local')->get('/public/' . $settlement->support);
or
$settlement_file = Storage::disk('public')->get($settlement->support);
as Laravel by default has public disk which pointed into /app/public storage directory

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

What is the '.' directory in Windows?

For example, a directory has the following files: (as shown in explorer)
index.php
hello.php
img
If you query it using windows or just type dir in cmd prompt it will have the following files:
.
..
index.php
hello.php
img
I understand that '..' is a link to the previous directory, but what exactly is '.' and how can it be used? I've searched all over the internet, but no avail found for the single dot
The . can be used in some commands: This will copy the files from c:\temp to the current directory:
copy c:\temp\*.* .
The .. can be used to move to a higher directory.
This will change to the parent folder:
cd ..
The '.' indicates the current directory as per this. As you mentioned, '..' is a link to the previous directory. Ultimately the Operating System will choose how to indicate these, but it is pretty standard across all major OSs
. is the same as the current directory, but in a relative way.
For instance if the current directory is c:\temp and if you cd in this directory, then . == c:\temp.
In short . is the current directory and .. is the parent directory. It is convenient for you to write scripts with these keyword otherwise you have to write a long command.

JFolder::create: Could not create directory - 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.

Edit file.php from controller using CodeIgniter

I need to add some content to a file from a controller in CodeIgniter, in my local enviroment I do this and works fine:
$handle = fopen(APPPATH."config/file.php", "a+");
fwrite($handle, $stuff);
fclose($handle);
However the file doesn't seem to get altered when it runs in the production environment server.
At first I though it could be permission issues but chmoding 777 the directory doesn't seem to work either
It seems to me APPPATH is pointing to a different path. Make sure APPPATH is correct.
Dumb of me, I chmoded the folder containing the file but not the file itself.

Resources