Skip to main content

Fix Linux LAMP server permission issues (Ultimate Fix !, 2020)


Hello, Guys !. Today, we are going to discuss the apache LAMP server permission issues fix on Linux. Windows people won’t necessarily need this tutorial because permission issues won’t arise on Windows.

This Problem can happen on the LAMP servers installed on Linux Distros such as ubuntu 18.

In this tutorial, I will show how you can get into fixing the file or folder access permissions on Apache LAMP servers. This issue will be a total issue for WordPress users and it is because WordPress needs its plugins which are necessary for the stability of WordPress.

The Problems if we don’t fix LAMP server permissions

If we don’t fix the file permission issues, we will face these problems:

  • Won’t be able to write files to our document root and it’s folders.
  • WordPress would require FTP credentials for managing plugins and themes.
  • WordPress cannot create the wp_config.php file to its root directory.
  • File won’t be uploaded to the directory.

The Fix for LAMP server permission issues on Linux

1. Direct Method (Will work for most users)

In apache servers, most probably, when you are using Digital Ocean’s Droplet, you would find that the files that you upload will be assigned to the user root. For us to fix that problem, I have a simple fix for this.

Change the Group of the owner of files

So, Basically, the document root should be owned by a group called “www-data”

usermod -a -G www-data root

This would be a permanent fix for most of the users who are reading this

2. Three Simple Commands

sudo chown -R ubuntu:www-data /var/wwwsudo find /var/www -type d -exec chmod 2750 {} \+sudo find /var/www -type f -exec chmod 640 {} \+

3. Method two

First, use :

sudo cp -r /home/andre/www/moodle/ /var/www/html/

This code can copy your files to /var/www/html.

We’ll now reset the permissions so a person as well as the webserver can access everything in that document root, and then you should give your user full read and write permissions to all the files and directories.

Do this :

  1. Give your Apache webserver full access to the folders and files, so it can serve the site without 403 errors.
  2. Give your user ‘owner’ the permission for files and folders, and then we can give ourselves the permission to read and write on all of the files and folders in our Apache Directory.
  3. (Optional. But, I recommended it) Set the permissions up in such a way that any files or folders created from now on, in the directory structure has the group set to be www-data.

1. Allow Apache access to the folders and the files.

sudo chgrp -R www-data /var/www/htmlsudo find /var/www/html -type d -exec chmod g+rx {} +sudo find /var/www/html -type f -exec chmod g+r {} +

2. Give your owner read and write privileges to the folders and the files.

sudo chown -R USER /var/www/html/sudo find /var/www/html -type d -exec chmod u+rwx {} +sudo find /var/www/html -type f -exec chmod u+rw {} +

3. Make sure every new file after this is created with www-data as the ‘access’ user.

sudo find /var/www/html -type d -exec chmod g+s {} +

Other posts to you should check out to fix permission issues on LAMP server


Popular posts from this blog

Install LineageOS 16.1 on SM-J610(x) Samsung Galaxy J6 Plus

Installation Unlock the Bootloader Unlocking the bootloader involves complete removeal of your files. So, do a backup for your important files. Go to Settings -> About Phone -> Software Information Tap on “Build Number” 7 Times Developer option will be enabled Go to Settings -> Developer Options (At the bottom) Enable “OEM Unlocking”. You have to format your phone. Risk !!! Proceed the steps below if you are ready to take the risk of voiding your warranty (KNOX 0x1) It’s always better to do after your device warranty is over. Download Necessary Files I have made a All-in-One complete Installation ZIP file. Download Here or Click Button Below All-In-One ZIP Official Link Now, extract all the files to a folder. Boot Into Download Completely Power-Off your device Remove every cables connected to the device Press the Volume-Up & Volume-Down simultaneously. Now connect your phone to the COMPUTER via Micro-USB Cable Read the instruction shown there for a moment. Now, press the

Install Lineage OS 16, TWRP, Gapps on Samsung Galaxy Tab 10.1 2019 (SM-T510)

Introduction Let’s get started on installing this wonderful ROM RISK ! Make sure you are ready to take the risk as this may can lead to complete device bricking. Download the All-in-one zip file Download full installation files as zip Steps for installation Unlock bootloader Disconnect the USB cable Power off the device Press and hold Volume Up & Down keys Insert USB cable Flash TWRP Open Odin Click on AP Select TWRP .md5 file inside the zip I asked you to download Click on start near to bottom of odin window Flash Multidisabler Copy the multidisabler file in the zip I asked you to download into your SD card. Boot to TWRP and browse and swipe to install multidisabler zip file. Flash Lineage OS with Odin As I mentioned about installing the TWRP recovery above, browse the lineage os “.md5” file as your AP and hit on start Install Gapps Boot into TWRP recovery Install gapps “.zip” file as we installed the multidisabler. Boot into Lineage OS 16 !

Fix "Post processing of the image failed" - Wordpress Error (All Solutions)

Video guide Debugging the issue There is a file at /var/log/apache2 which logs all the errors that happen on your websites. tail -f /etc/apache2/error.log This will list your errors on your apache websites real-time. See the video above to know how I debugged and solved this error. All Solutions 1. Install php-mbstring module SSH into your server and type: sudo apt-get install php-mbstringsudo service apache2 reloadsudo service apache2 restart This will install the module for you and most probably will solve this issue for you. Remember: On the video above you might have seen that doing this didn’t work right away for me. But only after continuos restart and reload of apache server. Or you might need to just reboot your server with: sudo reboot Update your php.ini First find your install php version: php -v Now that you know your php version, cd into your php version at: cd /etc/php/(php_version) Now, edit you php.ini sudo apt install nano # If nano not installed on your servernano /et