raspberry pi with lighttpd, php7 and magento webshop

raspberry pi with lighttpd, php7 and magento webshop

September 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
raspberry pi with lighttpd, php7 and magento webshop

Resolving Internal Server Errors with Magento on Raspberry Pi

When setting up a Magento webshop on a Raspberry Pi running Lighttpd, PHP7, and MySQL, you may encounter internal server errors like the one described:

Uncaught Magento\Framework\Exception\FileSystemException: The file "/var/www/html/var/.regenerate" cannot be deleted

Let’s troubleshoot this issue step-by-step.

Understanding the Error

This error occurs because the script tries to delete a file located in the var directory, but lacks sufficient permissions. By default, Magento expects full read-write access to the var folder during installation and setup. However, your current configuration is not granting these necessary permissions.

Permissions Issue: The Culprit

The error message clearly states:

Warning!unlink(/var/www/html/var/.regenerate): Permission denied

This happens because the process running PHP (likely PHP-FPM) doesn’t have sufficient write privileges in the /var/www/html directory.

Fixing the Permissions Issue

To resolve this, you need to ensure that the web server has proper permissions to read and write files in the Magento root directory:

  1. First, let’s make sure you’re using the correct user for your PHP-FPM service. By default, it should be running as the www-data user on most Linux systems.

  2. Next, grant the necessary permissions to the Magento installation directory:

sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html

The above commands change the ownership of the /var/www/html folder and its contents to the www-data user and group. The -R flag recursively applies these changes.

Why These Permissions Are Required

Magento requires write access to several directories during installation:

  • The var directory for caching, log files, and temporary files.
  • The media directory for storing images and other media assets.
  • The app/etc directory for configuration files.

Without proper permissions, Magento cannot complete the setup process or function correctly as a fully operational e-commerce platform.

Best Practices for Magento Permissions

As a best practice:

  1. Always use an FTP client like WinSCP to upload your Magento files directly into the /var/www/html folder.
  2. Ensure that the www-data user owns all of the files in this directory.
  3. Set permissions as follows:
    • var, media: 750
    • app/etc: 640

Conclusion: A Working Magento Setup on Raspberry Pi

By following these steps, you should be able to successfully install and configure a working Magento environment on your Raspberry Pi.

Remember:

  1. Always keep your system up-to-date.
  2. Use proper user permissions for security and stability.
  3. Test thoroughly after each change.
  4. Consult the official Magento documentation for more detailed information on requirements.

If you’re looking to deploy Magento in a professional development environment, consider using our Laravel Company Blog. We cover advanced Magento topics and provide insights from experienced e-commerce developers.

Database Security Configuration Errors

Our network