I have been trying to get Sylius installed on my Bluehost server which is running on shared hosting and while I do have SSH access, it is somewhat limited. It did not come with the php intl extension and the version of ICU on it is 4.2 which produces errors when installing Sylius because it wants a newer version.
问题:
回答1:
I tried this on a clean install of Sylius on my Bluehost server and got it to work.
I had previously installed the intl
extension on my BlueHost server following https://my.bluehost.com/cgi/help/534
The intl
extension is not required. See below. (I was attempting to install it before I realized I didn't need it)
After installing the extension, phpinfo() said the version of ICU was 4.2.
Note: on BlueHost you have to use php-cli
instead of php
to run php scripts from the command line
To install Sylius I ran:
wget http://getcomposer.org/composer.phar
php-cli composer.phar create-project sylius/sylius -s dev
When running create-project, I recieved the error:
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].
I then used cd sylius
to move into the new directory made from the partial project install.
From the section on http://symfony.com/doc/current/components/intl.html about ICU and deployment problems I added "symfony/icu": "1.1.*",
(or add "symfony/icu": "1.0.*",
if you do not have the intl
extension installed) to the require section of composer.json
I then ran php-cli composer.phar update
to get all the dependencies which takes a while (make sure you reference composer.phar correctly as it was downloaded into the parent directory)
After all the packages were downloaded, it asked for config parameters such as Database info
Then I ran php-cli app/console sylius:install
I ran php-cli app/console doctrine:fixtures:load
and recieved the error:
[RuntimeException]
The country resource bundle could not be loaded for locale "en"
From info at https://github.com/symfony/symfony/issues/5279#issuecomment-12477297 and https://github.com/kbsali/sf2-icu I ran
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
and then edited vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php
and changed
const ICU_DATA_VERSION = '49';
to
const ICU_DATA_VERSION = '4.2';
I ran php-cli app/console doctrine:fixtures:load
again and loaded all of the Data Fixures until LoadOrdersData failed with the error:
[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
Then made the changes described at https://github.com/Sylius/Sylius/pull/216/files - hopefully this becomes part of the master branch and doesn't have to be changed when installing sylius
and ran php-cli app/console doctrine:fixtures:load
a third time
I added my IP to the array of valid IP addresses in web/app_dev.php
so I can run app_dev.php remotely from the BlueHost servers
In your browser you can go to web/app_dev.php
and login to the admin area with
Username: sylius@example.com
Password: sylius
as the page suggests
Hopefully this helps anyone having problems with installing Sylius. It took me a while to figure it out. Let me know if there are any better ways of going about this.
回答2:
Try this:
apt-get install php5-intl