I get an error at first run of Yii1 application - php

i am new to Yii. I am trying to setup a yii 1 app and i get this error.
"Application runtime path "C:\xampp\htdocs\gfs_design\protected\runtime" is not valid. Please make sure it is a directory writable by the Web server process."
I am using Xampp and the frontend and the yii folders are in my htdocs directory.
What I Have Done:
I have made the Yii folder writable from properties\security\advanced and so on
But i still get the error.
Can any one help?

Runtime folder must have access to read write and also should be available for publically.
Please give permission to runtime folder
chmod -R 777 /path/to/project/protected/runtime

The first time the app is installed, it doesn't come with a runtime directory. Just creating the folder in protected helped.

Since runtime folder should be publicly accessible, just use the following commands to make the folder writable/readable from the web:
chown -R www-data:www-data /path/to/project/protected/runtime
chmod -R 777 /path/to/project/protected/runtime
Hope this helps.
EDIT:
JFYI, runtime directory is internally used by Yii framework to store some cached data, such as logs, session and assets.

Related

laravel image optimizer file does not exists

I am using spatie/laravel-image-optimizer package to optimize my images.
I receive the error message:
storage/app/public/files/car/9/km_declaration/2022/uE5DMCYh6hCuQXrOZ4yOSLCtLEnNdsE9e9OriNVw.jpg does not exist
Although the file is there, and it can access it locally, in production it cannot find it.
I am using the optimizer as it supposted to be used, and I am using the filesystem public:
ImageOptimizer::optimize($this->url);
Do you have any guess why is it working locally with homestead but not on production?
(Folder permissions 755 on prod)
Update:
The code: ImageOptimizer::optimize($this->url); is run from a cron job.
If I do file_exists($url) from the controller I got true, but false from the job. I think that is the source of my issue.
In the storage folder, you need to set permissions 775
chmod -R 775 storage

Yii2 framework error

I'm new with framework and recently, i install yii2 on my computer, but then when i'm trying to test the frontend of yii2, it show this error. This is my first time using this, so i didn't know what is really the error is.
So, anybody can tell me what should i do to fixed the error and make the framework run on my computer successfully.
enter command line chmod -R 777 runtime in your folder where the framework itself is located. If you use an extended application, then in the root of the project it will be so сhmod -R 777 frontend/runtime
You have a problems with permissions. The runtime directory should have permissions set to 0777

Symfony on Apache permission issues

I have made a lot of Symfony apps that work in production, but recently tried deploying one to Ubuntu 16 for the first time. var/logs/prod.log shows errors about not being able to find classes, so of course the app won't run.
I can "fix" this with chmod 777 /var/www/ -R, and everything starts working. Surely that's not safe... How can I fix this the right way?
Note: I am currently not logged in as a user but as root.
*EDIT
The app will not run after chmod 777 /var/www/var -R to change permissions for chache and logs, but only if I change the permissions for all the folders of the entire app.
You might try locating folders/files which are the problem and change ownership to www-data which is actually used by Apache.
For a whole directory with files recursively:
chown -R www-data:www-data [folder_path_and_name]
For a specific file:
chown www-data:www-data [file_path_and_name]
Symfony has a section in the documentation for file permissions
Mainly you need to adjust the apache user permissions for logging, and as root you can easily do that.
Just remember to ignore the logs + cache if you're using source control such as Github.

How do I make a nouser/nogroup so wordpress can write to files?

I host my own test server. I am using ubuntu server 14.04 with apache2 mysql and php. and i am getting this error when I try and upload a theme to my wordpress.
Unable to create directory wp-content/uploads/2015/04. Is its parent directory writable by the server?
That for some reason i can not find a working answer for this error. I do know that permissions are involved but i am also new to the whole server admining.
So any help world be great to get this fixed. Thanks in Advance.
Justin
From the terminal, navigate to the parent directory of wp-content and use this command sudo chmod -R a+rw wp-content
The -R means to change the permission recursively(all child directories and so on)
The a means all user, +rw means read and write permission.

premisson to working correctly laravel

I created a project with Laravel 4 but when I go to the folder localhost /my_project/public get some errors related to the permissions. I solved it setting to 777 all the permissions of the folder and files contained in my_project. Is there a way to solve this thing is not to make 777?
What's happen when you set 755 permission to my_project directory? Try to change permissions and check it. Your directory should be able to read all files in public directory.
I set my ownership to be owned by www-data:
chown -R auser:www-data /path/to/laravel/root
I also make all my subfolders and files read and write by group:
chmod -R g+rw /path/to/laravel/root
I also make my folders have a sticky bit so if you add a new file, it inherits:
chmod -R g+s /path/to/laravel/root
This has always worked for me. Perhaps Linux experts might have better ideas but this is what I use.
Please refer to Laravel's documentation about installation located at http://laravel.com/docs/installation. Under no circumstances you should run laravel on production with full permissions to the whole world. You must also remember that your "application" will be executed from the public directory so there is NO reason to allow read/write/execute for the whole world to the whole project directory unless you don't care about security at all.
Anyway, extracted from Laravel's documentation from the permissions section:
"Laravel may require one set of permissions to be configured: folders
within app/storage require write access by the web server."
This whould make your project run smooth.

Categories