Sunday, September 10, 2017

How to install XAMPP in Linux and make WordPress update work perfectly!

Installing XAMPP properly so that Wordpress runs smoothly on Linux
We have all been there... when we try to update something in Wordpress in Linux and it does not update. Even debug.log does not create. It is most of the time a permission issue. But Windows does not suffer from it. So, why should Linux have this issue? Fear not, we have a solution!

Step 1: Install XAMPP (LAMPP)

If you have not installed XAMPP yet on your linux machine, then first do so. I have written a tutorial here.

Step 2: Create Group for XAMPP Users and put yourself in!

* Replace "username" with your username.

sudo groupadd xamppusers
sudo usermod -a -G xamppusers username
groups username

The last command will show you the groups that your username is in. If you have xamppusers group in the list, then you are good.

Step 3: Own the files!

Run this:

cd /opt/lampp
sudo chown -R username.xamppusers htdocs
sudo chmod -R 775 htdocs

This will relax the file permissions of your htdocs folder, so you have less trouble. And also change the owners to the username you chose. You will taste great feedoms when editing files and modifying files with php after this.

Step 4: Edit the httpd.conf

httpd.conf is the configuration file for Apache.

First backup the conf file:
sudo cp /opt/lampp/etc/httpd.conf /opt/lampp/etc/httpd.conf.bak

Edit the file:
sudo nano /opt/lampp/etc/httpd.conf

You will find two lines saying something like this:
Tip: You can press Ctrl+W, type user daemon and press enter to find it quickly.
User daemon
Group daemon

Editing the httpd.conf with nano in linux cli

Replace it with your values, something like this:
User username
Group xamppusers

Step 5: Restart XAMPP

This step is very important. If you do not do this the changes you made in httd.conf file will not be taken.
sudo /opt/lampp/lampp restart
or, use the GUI Control Panel if you have it.

Bonus Tip: Accessing htdocs from home directory

ln -s /opt/lampp/htdocs/ ~/htdocs

You will then be able to see a link to the "htdocs" folder in your home folder. This is so convenient for accessing files on htdocs.

Conclusion

After doing all this hard work you will be able to install Wordpress without any permission issues whatsoever. Also update Wordpress without any problem.

Plugin update also works!

Wordpress Plugin updates without any issue


No comments:

Post a Comment