Maybe the title of this blog post isn’t perfect. While I am writing this post, no better title is coming to my mind.
By the way, let me explain the topic. Suppose you have installed WordPress in the XAMPP stack in Ubuntu (or any other ubuntu based distro). Now you want to install some plugins and themes from the WordPress dashboard. You have clicked on the “Install Now” button and suddenly this ugly(!) message comes in front of you, asking for your FTP credentials.
But it should not happen. So you start searching in the internet how to fix this problem. In the maximum solution, you have been told to input your FTP credentials or add them to the wp-config.php file. But it can be solved in a different way.
Actually if the user of WordPress installation directory is different from the user of apache, this problem happens. So we need to fix this.
Firstly, we need to check the user of apache. To do this, run the following command in terminal:
ps -ef | grep httpd | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}'
In my case, the user of apache is “daemon”.
So we need to change the user and group of WordPress installation directory to “daemon”. To do this, run the following command in terminal:
sudo chown -R daemon:daemon /opt/lampp/htdocs/wordpress/
Replace daemon:daemon
with your apache user:group
(you have got this by running the firstly mentioned command). Replace /opt/lampp/htdocs/wordpress/
with your WordPress directory location.
Boom!!! Done!!!
So by now you can install themes and plugins and can update them without your FTP credentials. Congratulation!
If you find this post helpful, please do share and subscribe to this blog by your email. And obviously feel free to share your thoughts in the comment section. Have a nice day 🙂