Warning: Use of undefined constant smart_ads_days - assumed 'smart_ads_days' (this will throw an Error in a future version of PHP) in /www/webvol6/nk/iapdku83bf7ungd/blog.silverstone.nu/public_html/wp-content/plugins/smart-ads/smartads.php on line 341

If you run your WordPress blog on some hosting partner you probably have the automatic updates of WordPress core and plugins working, but if you ever setup your own Linux server and trying to run WordPress on it, it is likely that this will not work out of the box, especially if you’re running multiple websites on the same server.

I don’t want to use some 3rd party plugin for this to work or FTP, so I investigated what it is that makes it work in my hosting partners server, but not my own. I figured it was some PHP configuration missing but it was much simpler than that.

You will need root-access to the server to continue. The problem is that the webserver process (httpd) does not have write permission to the files (let’s say in “/home/user/public_html” for example). The httpd process is most likely to run as user “nobody”, “apache” or “www” (it must not run as “root”!). One possibility to fix this is to set the directory public_html as write permitted by anyone, but that is not a good solution so I won’t write how.

Instead we wan’t to change owner of the files to match. To find out which user is running your httpd process you can login as root and issue the command

ps -axu | grep “httpd”

One process will run as root to bind to the port, but the other ones should be another user.

The easiest thing to do, and this is how many hosting partners have set it up, is to make sure the owner of public_html and all subfolders and files is the same user which is running the httpd process.

I am running Fedora Linux and in my case the user is “apache”, so while still logged in as root I just run the command

chown -R apache /home/user/public_html

This will change owner if the public_html directory, which is the root directory in my Apache configuration, and all subfolders and files. Now the automatic updates will work right away!