覆盆子pi与lighttpd,php7和magento网上商店

时间:2017-04-14 14:04:29

标签: magento raspberry-pi php-7 lighttpd

我使用lighttpd,php7和magento设置我的覆盆子pi。不幸的是,在将magento解压缩到/ var / www / html后,打开Web界面设置时出现内部服务器错误。

这是我到目前为止所做的步骤:

  1. Raspbian Jessie Lite 放在我的Rasberry Pi 3
  2. 安装lighttpd

    apt install lighttpd -y
    
  3. 因为PHP 7在jessie repo中不可用我从新的弹性回购中获取它:

    echo "deb http://httpredir.debian.org/debian stretch main contrib non-free" | tee /etc/apt/sources.list.d/debian-stretch.list
    apt install php7.0 php7.0-fpm -t stretch
    rm /etc/apt/sources.list.d/debian-stretch.list
    apt-get update -y
    
  4. 接下来我们需要启用fastcgi并告诉Lighttpd在哪里找到PHP。

    tee /etc/lighttpd/conf-enabled/php.conf > /dev/null <<EOF
    fastcgi.server += (".php" => ((
                     "socket" => "/var/run/php/php7.0-fpm.sock"
    )))
    EOF
    
    lighttpd-enable-mod fastcgi
    lighttpd-enable-mod fastcgi-php
    /etc/init.d/lighttpd force-reload
    
  5. 安装MySQL并使用一个用户创建magento db

    apt-get install mysql-server
    apt-get install mysql-client
    
    mysql -u root -p
    CREATE DATABASE magento;
    CREATE USER magento_user@localhost IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON magento.* TO magento_user@localhost IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    exit
    
  6. 解包magento。在winscp中,我手动将tar.gz文件复制到/ home / magento

    mkdir /home/magento
    tar xzvf /home/magento/Magento-CE-2.1.6-2017-03-29-01-08-05.tar.gz -C /home/magento
    apt-get install rsync
    sudo rsync -avP /home/magento/. /var/www/html/
    
  7. 打开网站http://192.168.2.103会引发500内部服务器错误。

  8. 请参阅错误日志。我甚至不知道这些是不是正确的错误......

    cat /var/log/lighttpd/error.log
    
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: PHP message: PHP Fatal error:  Uncaught Magento\Framework\Exception\FileSystemException: The file "/var/www/html/var/.regenerate" cannot be deleted Warning!unlink(/var/www/html/var/.regenerate): Permission denied in /var/www/html/vendor/magento/framework/Filesystem/Driver/File.php:382
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: Stack trace:
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #0 /var/www/html/vendor/magento/framework/Filesystem/Directory/Write.php(172): Magento\Framework\Filesystem\Driver\File->deleteFile('/var/www/html/v...')
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #1 /var/www/html/vendor/magento/framework/Code/GeneratedFiles.php(98): Magento\Framework\Filesystem\Directory\Write->delete('/var/.regenerat...')
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #2 /var/www/html/vendor/magento/framework/App/ObjectManagerFactory.php(114): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles()
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #3 /var/www/html/vendor/magento/framework/App/Bootstrap.php(385): Magento\Framework\App\ObjectManagerFactory->create(Array)
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #4 /var/www/html/vendor/magento/framework/App/Bootstrap.php(362): Magento\Framework\App\Bootstrap->initObjectManager()
    2017-04-14 12:58:45: (mod_fastcgi.c.2702) FastCGI-stderr: #5 /var/www/html/vendor/magento/framewor...
    
  9. 我按照以下教程来到目前为止:

    https://blog.dantup.com/2016/03/installing-lighttpd-php7-and-letsencrypt-on-raspberry-pi-raspbian-jessie-lite/

    https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04

1 个答案:

答案 0 :(得分:1)

在这里待了一整天之后,我找到了让它运转的方法。

我实现了在我的覆盆子pi 3上安装以下内容:

  • lighttpd(版本1.4.35)
  • php7.0(7.0.16-3)
  • MySQL(Ver 14.14 Distrib 5.7.17,for Linux(armv7l))
  • Magento 2网上商店(Magento-CE-2.1.5-2017-02-20-05-04-55.zip)

这是要采取的行动:

  1. Raspbian Jessie Lite 放在我的Rasberry Pi 3
  2. 安装lighttpd

    apt install lighttpd -y
    
  3. 因为PHP 7在jessie repo中不可用我从新的弹性回购中获取它:

    echo "deb http://httpredir.debian.org/debian stretch main contrib non-free" | tee /etc/apt/sources.list.d/debian-stretch.list
    apt install php7.0 php7.0-fpm apt php7.0-xml php7.0-curl php7.0-mcrypt php7.0-intl php7.0-mbstring php7.0-zip php7.0-gd php7.0-mysql -t stretch
    rm /etc/apt/sources.list.d/debian-stretch.list
    apt-get update -y
    
  4. 接下来我们需要启用fastcgi并告诉Lighttpd在哪里找到PHP。

    tee /etc/lighttpd/conf-enabled/php.conf > /dev/null <<EOF
    fastcgi.server += (".php" => ((
                     "socket" => "/var/run/php/php7.0-fpm.sock"
    )))
    EOF
    
    lighttpd-enable-mod fastcgi
    lighttpd-enable-mod fastcgi-php
    /etc/init.d/lighttpd force-reload
    
  5. magento需要mysql-5.6或更高版本但目前它不在raspbian repo中。使用以下代码,我们将安装5.7版本:

    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/libmysqlclient-dev_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/libmysqlclient20_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/libmysqld-dev_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/mysql-client-5.7_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/mysql-client-core-5.7_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/mysql-server-5.7_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-5.7/mysql-server-core-5.7_5.7.17-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mecab/libmecab2_0.996-3_armhf.deb
    wget http://ftp.debian.org/debian/pool/main/m/mysql-defaults/mysql-common_5.8+1.0.2_all.deb
    wget http://ftp.debian.org/debian/pool/main/l/lz4/liblz4-1_0.0~r131-2+b1_armhf.deb
    
    sudo apt install libaio1 libaio-dev libhtml-template-perl libevent-core-2.0-5
    
    sudo dpkg -i libmecab2_0.996-3_armhf.deb
    sudo dpkg -i liblz4-1_0.0~r131-2+b1_armhf.deb
    sudo dpkg -i mysql-common_5.8+1.0.2_all.deb
    sudo dpkg -i mysql-client-core-5.7_5.7.17-1_armhf.deb
    sudo dpkg -i mysql-client-5.7_5.7.17-1_armhf.deb
    sudo dpkg -i mysql-server-core-5.7_5.7.17-1_armhf.deb
    sudo dpkg -i mysql-server-5.7_5.7.17-1_armhf.deb
    
    apt-get update -y/
    
  6. 使用一个用户创建magento db(以后的magento web安装程序需要)

    mysql -u root -p
    CREATE DATABASE magento;
    CREATE USER magento_user@localhost IDENTIFIED BY 'password123';
    GRANT ALL PRIVILEGES ON magento.* TO magento_user@localhost IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    exit
    
  7. 解包magento。在winscp中,我手动将tar.gz文件复制到/ home / magento

    mkdir /home/magento
    tar xzvf /home/magento/Magento-CE-2.1.6-2017-03-29-01-08-05.tar.gz -C /home/magento
    apt-get install rsync
    sudo rsync -avP /home/magento/. /var/www/html/
    
  8. 设置权限(注意!不要为了生产使用而执行此操作!请参阅官方网站以设置权限:)
  9. http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

        chmod -R 777 /var/www/html
    
    1. 打开网上商店网址(在webbrowser中输入raspberry的ip)并完成magento网页安装程序。
    2. 对我来说,打开第二个putty会话并观察lighttpd error.log以使用以下命令检测错误非常有帮助:

          tail -f /var/log/lighttpd/error.log
      

      请随时提出更好或更快的建议 也许有人可以告诉我如何使用权限修复错误并设置正确的错误;)

      来源:

      https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=162960

      https://magento.com/tech-resources/download