【发布时间】:2013-07-03 22:13:45
【问题描述】:
我一直在尝试在共享主机上运行的 Bluehost 服务器上安装 Sylius,虽然我确实有 SSH 访问权限,但它有些受限。它没有附带 php intl 扩展,它的 ICU 版本是 4.2,安装 Sylius 时会出错,因为它需要更新的版本。
【问题讨论】:
标签: php symfony icu bluehost sylius
我一直在尝试在共享主机上运行的 Bluehost 服务器上安装 Sylius,虽然我确实有 SSH 访问权限,但它有些受限。它没有附带 php intl 扩展,它的 ICU 版本是 4.2,安装 Sylius 时会出错,因为它需要更新的版本。
【问题讨论】:
标签: php symfony icu bluehost sylius
我尝试在我的 Bluehost 服务器上全新安装 Sylius 并让它工作。
我之前在 https://my.bluehost.com/cgi/help/534 之后在我的 BlueHost 服务器上安装了 intl 扩展
不需要intl 扩展名。见下文。 (我在意识到我不需要它之前就尝试安装它)
安装扩展后,phpinfo() 说ICU的版本是4.2。
注意:在 BlueHost 上,您必须使用 php-cli 而不是 php 从命令行运行 php 脚本
为了安装我运行的 Sylius:
wget http://getcomposer.org/composer.phar
php-cli composer.phar create-project sylius/sylius -s dev
运行 create-project 时,我收到错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/icu 1.2.x-dev -> satisfiable by symfony/icu[1.2.x-dev].
- symfony/icu 1.2.x-dev requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
Problem 2
- symfony/icu 1.2.x-dev requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/intl 2.3.x-dev requires symfony/icu >=1.0-RC,<2.0 -> satisfiable by symfony/icu[1.2.x-dev].
- Installation request for symfony/intl 2.3.x-dev -> satisfiable by symfony/intl[2.3.x-dev].
然后我使用cd sylius 移动到由部分项目安装创建的新目录。
在 http://symfony.com/doc/current/components/intl.html 关于 ICU 和部署问题的部分中,我添加了 "symfony/icu": "1.1.*",(或者如果您没有安装 "symfony/icu": "1.0.*", 扩展,则添加 "symfony/icu": "1.0.*",)到 composer.json 的 require 部分
然后我运行 php-cli composer.phar update 以获取所有需要一段时间的依赖项(确保在将 composer.phar 下载到父目录时正确引用它)
所有包下载完成后,询问数据库信息等配置参数
然后我跑了php-cli app/console sylius:install
我运行 php-cli app/console doctrine:fixtures:load 并收到错误:
[RuntimeException]
The country resource bundle could not be loaded for locale "en"
来自https://github.com/symfony/symfony/issues/5279#issuecomment-12477297 和https://github.com/kbsali/sf2-icu 的信息我跑了
wget https://github.com/kbsali/sf2-icu/tarball/master -O sf2-icu.tgz
tar xzvf sf2-icu.tgz
mv kbsali-sf2-icu-XXXX/4.2 vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/
rm -rf kbsali-sf2-icu-XXXX sf2-icu.tgz
然后编辑vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php并更改
const ICU_DATA_VERSION = '49';
到
const ICU_DATA_VERSION = '4.2';
我再次运行php-cli app/console doctrine:fixtures:load 并加载了所有数据固定器,直到 LoadOrdersData 失败并出现错误:
[ErrorException]
Warning: array_keys() expects parameter 1 to be array, object given in /home5/ozzieorc/public_html/sylius_clean/sylius/vendor/fzaninotto/faker/src/Faker/Provider/Base.php line 127
然后进行https://github.com/Sylius/Sylius/pull/216/files 中描述的更改 - 希望这成为主分支的一部分,并且在安装 sylius 时不必更改
并第三次运行php-cli app/console doctrine:fixtures:load
我将我的 IP 添加到 web/app_dev.php 中的有效 IP 地址数组中,这样我就可以从 BlueHost 服务器远程运行 app_dev.php
在您的浏览器中,您可以转到web/app_dev.php 并使用以下命令登录管理区域
Username: sylius@example.com
Password: sylius
如页面所示
希望这可以帮助任何在安装 Sylius 时遇到问题的人。我花了一段时间才弄清楚。让我知道是否有更好的方法来解决这个问题。
【讨论】:
试试这个:
apt-get install php5-intl
【讨论】: