initialize Permission denied # rb_sysopen - Vagrant Up - php

I Install Vagrant in my Ubuntu(14.4) System. When i Enter Vagrant Up comment Display following Errors.
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine_index.rb:321:in `initialize': Permission denied # rb_sysopen - /home/w3cert/.vagrant.d/data/machine-index/index.lock (Errno::EACCES)

Permission denied
means that the file /home/w3cert/.vagrant.d/data/machine-index/index.lock is owned by another user and your current user has no permission.
check who is the owner of your file, if you run any install/command with sudo or root then your current user will not have access to modify the file.
for now you can change the ownership of all .vagrant.d files to your account and you should be able to run the vagrant up command

i had the same problem. I used Vagrant before and uninstall it. When i tried to reinstall back i had the same error
My solution was to delete the .vagrant.d temp folder (in your case /home/w3cert/.vagrant.d/)
Hope it works for you as well

As Manuel stated, deleting the .vagrant.d folder will solve the issue.
oddly this happened on windows as well, i didn't install anything new, or reinstall vagrant or anything like that. the only thing i can think of is the power cut we had last week has caused a folder/file lock... although a reboot should solve that :S

Related

how to clear cache of laravel app in centos server that uses nginx

enter image description herei'm using centos to host my laravel application,
when i upload the project first time using git, it will be cached, and when i change any file, changes doesn't apply, i tried all artisan commands that clear cache in laravel but didn't fix
the only way is to change the root directory of the application after each single change, is centos caching or nginx or laravel or other software in the server or the browser? even i cleared every thing in public/index.php and put echo 'foo'; and still got old cached data
screenshot of my nginx config file
screenshot of my nginx config file
This is possibly directory permission issue you need to grant storage and bootstrap directory 777 permission level. You need to run the following command on the root folder of your app
chmod -R 777 storage
and
chmod -R 777 bootstrap
Then try to effect your changes.
i tried systemctl restart php-fpm now every thing worked as expected and all changes applied thank you a lot i appreciate your help

.composer/config file permission denied using laravel

I have a laravel project on an ubuntu virtualbox.
I used to run composer update and all worked fine. I don't know of any changes that could have affected this but now when I run composer update I get
file_get_contents(/home/user/.composer/config.json): failed to open stream:
Permission denied
Does anyone know why? When I run sudo composer update , it works.
Your permissions got changed somehow (perhaps not related with running composer). Setting the owner of that file as your user should fix the issue:
sudo chown user /home/user/.composer/config.json
The above assumes that the username is user from the home path. As a side note, it works when running it as a super user using sudo because there's no permissions restrictions in that case.
It seems you don't have valid permissions for this file. Try running:
sudo chmod 0777 /home/user/.composer/config.json
EDIT
Of course, you should do it only in development environment (you mentioned you use Virtualbox). You should not do it in production environment.
Run below command.
sudo composer update

PHP permission error on writing to a file in Linux CentOS

I have installed linux centos 7 on a VmWare in Windows.
There are two users in the linux: root, sample
I have created a laravel project with user "sample" (logged in as sample), but when I try to run the project with user root (logged in as root), it throws a permission error that cannot write to the file (file_put_content()). I have tried
chmod 777 /var/www/html/laravel
Or even I have tried to change the permission of the write-access of the file to root using right-click->properties->permission, but to no avail.
The only possible solution has been to delete the file and re-create it with user root. Now, what is the solution? I though user root is privileged to do anything. But it seems it is not the case. What is the solution? How should change this issue?
Try chmod 777 -R /var/www/html/laravel/ ,-R is recursive

Laravel mkdir and copy Errors

I'm trying to install a laravel application. This question might be specific to Wardrobe, or not. I'm not sure. The Laravel application I'm trying to install is called Wardrobe.
So, there are 2 options that can be used to install this application (or script, I don't know). The first one is with Composer, and the second one is with git.
I'm trying to install this script to my server for weeks. I failed all the time. I can do this on my local computer, but can't on my server.
So, to tell you the problems, I'm creating two subdomains. One is called w1, and the other one is called w2. I'm trying to install Wardobe to w1 using composer, and I'll use git clone on w2.
I cd into /var/www/w2.domain.com/ and execute composer create-project wardrobe/wardrobe public_html. This creates the project into /var/www/w1.domain.com/public_html.
Then, for w2,
I cd into /var/www/w2.domain.com/ and execute git clone https://github.com/wardrobecms/wardrobe.git
Then, I go into database.php of each folder and write my database information.
Then I execute
chmod -R 777 app/storage/
chmod 777 public/img/
After all this, I go to w1.domain.com from my browser. I get '500 Internal Server Error', so I update both (w1 and w2) my .htaccess file from Laravel Installation Doc.
Now, I enter to w1.domain.com. I see the Installer Step 1. I click on 'Install Database & Continue'. BAM! Permission denied!
Here's the error message for w1:
copy(/var/www/w1.domain.com/public_html/public/packages/wardrobe/core/.gitkeep): failed to open stream: Permission denied
Then I enter w2.domain.com. BAM! Permission denied!
Here's the error message for w2:
mkdir(): Permission denied
Then I go into w1 and w2 folders and chown all.
Nothing changes.
Do you have any idea how to fix this?
Thanks in advance.
Here's the fix:
chmod 777 everything.
Install script.
Turn privileges to normal values using chmod.
End of story.
Thank you everyone for being so helpful.

Unpacking the update... Could not create directory. Wordpress

When I instal nextgen-gallery plugins. This error message appears
Downloading update from https://downloads.wordpress.org/plugin/nextgen-gallery.zip…
Unpacking the update…
Could not create directory.
How can I fix this problem ?
This is a permissions issue. Ensure the directory is writable by apache. Plugins are unpacked into the wp-content/plugins directory, so I would first attempt writing to the directory as apache:
sudo -u apache touch /path/to/wp-content/plugins/test.txt
Set permissions accordingly to correct the issue. You can read about permissions here: https://www.pluralsight.com/blog/it-ops/linux-file-permissions
You can read about the correct file permission scheme for Wordpress here: https://wordpress.org/support/article/changing-file-permissions/
#skrilled and #knutole's answer was great but I found that when attempting to fix the issue on the plugins folder, everything was ok and the answer did not work for me.
If anyone else has this issue, try looking at the upgrades folder also. This folder (from what I can see) is used as a folder to store temporary files for when WP upgrades or plugin updates are being ran.
If you simply receive the message stating 'Could not create directory' and there is no path specified, it could actually be talking about the upgrades folder.
Most likely, if you have configured it correctly, the http server associated to your wordpress site belongs to the group www-data. That's how one should configure it correctly.
Try members www-data and ps aux | grep www-data to be sure. In the latter command you should see on the last columns either nginx or apache.
In this case, you just need to set that group to the directory
sudo chgrp -R www-data <your_wordpress_root_dir>/
and then add full group permissions to such directory
sudo chmod -R g+rwx <your_wordpress_root_dir>/
Now it works perfectly :)
for nginx people
if you have php-fpm installed you have to tell it that its user and group is nginx. /etc/php-fpm.d/www.conf . find user which is assigned to apache by default and change it to nginx. also do it for group. then run this command :
sudo service php-fpm restart
also inside of your wordpress directory execute these commands
sudo chown nginx:nginx * -R
sudo usermod -a -G nginx username
change username into what your current username is.
yet you have to apply propper permissions.
run these commands inside your wordpress directory
sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +
If you are using vsftpd as your FTP server and have enabled passive connections, you need to add pasv_promiscuous=YES to /etc/vsftpd/vsftpd.conf.
I was having a similar issue. It started with me trying to update a plugin on a migrated WP install. I didn't get it, all my permissions were EXACTLY the same as the old server. In my situation, I started to see that not much was working properly. I couldn't install/delete plugins or themes as well as uploading media would error out. Then I found the fix via some research.
If you are still having this issue, and changing permissions DID NOT fix the problem try this:
Go in to your hosting control panel and find your hosting settings, wherever you can edit your scripting settings. In Plesk (as in my example), this would be under Websites & Domains. Click on your domain name at the bottom. On the next screen, where it says "PHP support (run as..." change the dropdown from "Apache module" over to "FastCGI application". Everything should be fixed up now!
(Re)setting the permissions via ftp didn't make a difference for me either. There is no SSH available, so I had to log in the control panel (directadmin in my case), the File Manager where I could "Reset Owner" to "File ownership reset" the /wp-contents directory.
I'm running Nginx with Wordpress. I deleted the upgrade folder in wp-content and then ran the upgrade from the wordpress GUI again. I noted the linux user for the upgrade folder created was www-data. I then did a {sudo chmod -R www-data:www-data .} Ran the upgrade again from the GUI and it worked.
Probably need to change the permissions on most of the folders so they can't be modified by www-data but I'll figure that out tomorrow.
A permission issue, make sure apache (www-data) has write permissions.
All the above is great, but I think you missed the simplest issue. Your website is using more space than it has allotted, and therefore it is broke. Wordpress makes more files as is in use. If you are on the margin of going over, a simple overnight issue where you did nothing is possible. Go to bed, everything fine. In the morning website is broke.
I own my websites so I go into the reseller part of Hostmonster or Hostgator (I have sites on both hosting platforms) and I reallocate more space and the problem goes away usually. Try that first, or look into it before messing around with permissions. If you changed a permission and the issue came up, could be permissions, otherwise, check this first.
I had the same issue when I tried to install wp plugin(s). However, I managed to solve the problem with the following command:
sudo wp plugin install [plugin name] --allow-root

Categories