简体   繁体   English

AWS Elastic Beanstalk 安装 IonCube 或 Zend Loader

[英]AWS Elastic Beanstalk Installing IonCube or Zend Loader

I have been trying to get one of these two loaders installed all evening without success.我整个晚上都在尝试安装这两个装载机中的一个,但没有成功。 I have narrowed it down to creating a config file.我已将其缩小到创建配置文件。 I have put a.config file in a.ebextensions folder located in my root directory of my project, I'm not sure if it needs to be at the same level as my project.我已将 a.config 文件放在项目根目录下的 a.ebextensions 文件夹中,我不确定它是否需要与我的项目处于同一级别。 But in any case every time 403 error with the following message:但无论如何每次都会出现 403 错误并显示以下消息:

"You don't have permission to access / on this server." “您无权访问/在此服务器上。” If I remove the script the message goes away.如果我删除脚本,消息就会消失。 I will also include a screenshot of where I can get to with out the.config file included and the reason why I need one of the loaders installed.我还将附上一张屏幕截图,说明在不包含 .config 文件的情况下我可以到达的位置以及我需要安装其中一个加载程序的原因。 Thanks in advance here is what my.config file looks like:提前致谢这里是 my.config 文件的样子:

# Install ioncube
mkdir ion
cd ion
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xzvf ioncube_loaders_lin_x86.tar.gz
mv ioncube/ioncube_loader_lin_5.4.so /usr/lib/php/modules/ioncube_loader.so
touch /etc/php.d/ioncube.ini
echo "zend_extension=/usr/lib/php/modules/ioncube_loader.so" >> /etc/php.d/ioncube.ini
cd ..
rm -rf ion/ 

Which I got from here: https://forums.aws.amazon.com/thread.jspa?messageID=446182&#446182我从这里得到的: https://forums.aws.amazon.com/thread.jspa?messageID=446182&#446182

没有 .config 文件我可以去哪里

I spent several hours on this and found I had silly mistakes like typos, improper YAML file formatting etc. and have found the following solution. 我花了几个小时在这上面,发现我有像拼写错误,不正确的YAML文件格式化等愚蠢的错误,并找到了以下解决方案。

Within your app deployment folder you need to create an .ebextensions folder, let's say the folder structure is as follows: 在您的app部署文件夹中,您需要创建一个.ebextensions文件夹,假设文件夹结构如下:

  • /Web/ /网络/
    • index.php 的index.php
    • phpinfo.php phpinfo.php的
    • .htaccess 的.htaccess
    • /.ebextensions/ /.ebextensions/

Within the .ebextensions folder you will need to create a configuration package, for my example I am using Amazon AMI Linux with PHP 5.6 installed through Amazon Elastic Beanstalk. 在.ebextensions文件夹中,您需要创建一个配置包,对于我的示例,我使用通过Amazon Elastic Beanstalk安装的带有PHP 5.6的Amazon AMI Linux。

A link for more information can be found here: Customizing Software on Linux Servers 可以在此处找到更多信息的链接: 在Linux服务器上自定义软件

Create a file called ioncube.config with the following contents: 使用以下内容创建名为ioncube.config的文件:

commands:
  install-ioncube:
    command: |
      if [ ! -f /etc/php.d/ioncube.ini ]; then
          mkdir /tmp/ion && cd /tmp/ion
          wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
          tar xzvf ioncube_loaders_lin_x86-64.tar.gz
          mv /tmp/ion/ioncube/ioncube_loader_lin_5.6.so "/usr/lib64/php/5.6/modules/ioncube_loader_lin_5.6.so"
          touch /etc/php.d/01-ioncube.ini
          echo "zend_extension=/usr/lib64/php/5.6/modules/ioncube_loader_lin_5.6.so" > /tmp/ioncube.ini
          mv /tmp/ioncube.ini /etc/php.d/01-ioncube.ini
      fi

NOTE: When you copy this, you will need to ensure the formatting is spaces and not tabs for it to be a properly formatted YAML file. 注意:复制时,您需要确保格式是空格而不是标签,使其成为格式正确的YAML文件。

Create another file called zenframework.config with the following contents 使用以下内容创建另一个名为zenframework.config的文件

packages: 
  yum:
    php-ZendFramework: []

I found that without these two it did not work as expected, I also had an issue where for some unknown reason my .ebextensions folder was being ignored, if this happens to you simply rename it to something else and back again. 我发现没有这两个它没有按预期工作,我也有一个问题,由于一些未知的原因我的.ebextensions文件夹被忽略,如果这恰好你只需将其重命名为其他东西然后再返回。

Run the eb deploy from the Amazon CLI and then take a look at the PHP configuration, if unsure this can be checked with the following code: 从Amazon CLI运行eb deploy ,然后查看PHP配置,如果不确定可以使用以下代码检查:

<?php

    phpinfo();

<?php

This should now be installed. 现在应该安装它。 If you need to know more information on the Amazon CLI it can be installed using this guide: Installing the EB Command Line Interface (CLI) and then the guide on working with PHP within Elastic Beanstalk is found here: Deploying Elastic Beanstalk Applications in PHP 如果您需要了解有关Amazon CLI的更多信息,可以使用本指南进行安装: 安装EB命令行界面(CLI) ,然后在此处找到有关在Elastic Beanstalk中使用PHP的指南: 在PHP中部署Elastic Beanstalk应用程序

I realize this isn't the "best" approach, but I've been running this setup for literally years.我意识到这不是“最佳”方法,但我多年来一直在运行此设置。 It's pretty straight forward.这很简单。

  1. Download the ioncube下载离子立方体
  2. Put the library into a folder called ioncube (or whatever you want to call it)将库放入名为ioncube的文件夹中(或任何你想调用的文件夹)
  3. Commit the file into your version control将文件提交到您的版本控制中
  4. Create a file in your project called .ebextensions/00_ioncube.config在您的项目中创建一个名为.ebextensions/00_ioncube.config的文件
files:
  "/etc/php.d/01-ioncube.ini":
    mode: "000755"
    owner: root
    group: root
    content: |
      zend_extension = "/var/www/html/ioncube/ioncube_loader_lin_7.3.so"

This installation for IonCube worked just now for EC2 (hope it works as well for elastic beanstalk): IonCube的这个安装刚刚适用于EC2(希望它适用于弹性beanstalk):

PHP version installed is 5.5 - please change the 5.5 to your installed version if you have a different one ("php -v" gives you the currently installed one): 安装的PHP版本是5.5 - 如果您有不同的版本,请将5.5更改为您安装的版本(“php -v”为您提供当前安装的版本):

# Download current version of IonCube loader
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

# Unzip to /usr/local
sudo tar -xzf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local

# Add installed module to PHP config
echo 'zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.5.so' | sudo tee /etc/php-5.5.d/ioncubeloader.ini

# Restart Apache (if necessary)
sudo service httpd restart

If your run "php -v" now, it should show you IonCube installed: 如果您现在运行“php -v”,它应该显示已安装IonCube:

PHP 5.5.12 (cli) (built: May 20 2014 22:27:36) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.6.1, Copyright (c) 2002-2014, by ionCube Ltd., and
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM