Home  >  Article  >  Backend Development  >  Drupal 8 Twig C extension installation issues

Drupal 8 Twig C extension installation issues

WBOY
WBOYOriginal
2016-07-06 13:51:151407browse

Maybe I can’t understand the official website installation because my English is not good enough

Official website installation

Official address: http://twig.sensiolabs.org/doc/installation.html

<code>$ composer require twig/twig:~1.0

最后在 php.ini 加入下面这代码

extension=twig.so #For Unix systems

</code>

centos 7 installed successfully

I tried this method for a long time without success, and finally installed php56-twig on centos7 and it was OK

<code>$ sudo yum install php56u-twig
</code>

php56u is the version of php I installed on centos7
If you use other versions, you can find other corresponding twig extension versions.

Drupal 8 Twig C extension installation issues

ubuntu installation-failed

ubuntu version: Ubuntu 14.04.4 LTS
php version: PHP 7.0.8-3 deb.sury.org~trusty 1

Question 1

An installation error occurs when executing the composer method on the official website

<code>$ composer require twig/twig:~1.0
</code>

Drupal 8 Twig C extension installation issues

After checking these two failures a lot, I still don’t know how to solve them?

Question 2

The php-twig extension installation package for ubuntu cannot be found

Many versions of php-twig packages can be found in centos7, but not a single version of utuntu can be found.
I don’t know if there are other ubuntu resource packages or other installation methods

Question 3

Looking for other solutions to install ubuntu php7 Twig C extension

Additional questions

pear installs Twig C extension and reports error

<code>$ pear install twig/CTwig
</code>

Drupal 8 Twig C extension installation issues

Reply content:

Maybe I can’t understand the official website installation because my English is not good enough

Official website installation

Official address: http://twig.sensiolabs.org/doc/installation.html

<code>$ composer require twig/twig:~1.0

最后在 php.ini 加入下面这代码

extension=twig.so #For Unix systems

</code>

centos 7 installed successfully

I tried this method for a long time without success, and finally installed php56-twig on centos7 and it was OK

<code>$ sudo yum install php56u-twig
</code>

php56u is the version of php I installed on centos7
If you use other versions, you can find other corresponding twig extension versions.

Drupal 8 Twig C extension installation issues

ubuntu installation-failed

ubuntu version: Ubuntu 14.04.4 LTS
php version: PHP 7.0.8-3 deb.sury.org~trusty 1

Question 1

An installation error occurs when executing the composer method on the official website

<code>$ composer require twig/twig:~1.0
</code>

Drupal 8 Twig C extension installation issues

After checking these two failures a lot, I still don’t know how to solve them?

Question 2

The php-twig extension installation package for ubuntu cannot be found

Many versions of php-twig packages can be found in centos7, but not a single version of utuntu can be found.
I don’t know if there are other ubuntu resource packages or other installation methods

Question 3

Looking for other solutions to install ubuntu php7 Twig C extension

Additional questions

pear installs Twig C extension and reports error

<code>$ pear install twig/CTwig
</code>

Drupal 8 Twig C extension installation issues

I have never used twig, but judging from your screenshot, it actually did not fail.
The error in the screenshot is telling you that php does not have the zip extension installed, and the system does not have the unzip command installed, so it cannot decompress it. The downloaded zip (I presume this is a zip of an already ok binary file)
But then it tried to install from the source code (Now trying to download from source)
So the installation should be successful through the source code installation method

The first point is obviously that there are no zip and unzip commands. You can try installing one

<code>sudo apt-get install zip</code>

But what I want to say is that you don’t actually need to use composer to upgrade. What you do is just upgrading from v1.23 to v1.24. Unless you are sure that it fixes the problem you are currently experiencing, it is not that big. significance.

About C extension installation
Officially recommend that you use pear to install it. Have you tried it?

<code>pear channel-discover pear.twig-project.org
pear install twig/CTwig</code>

Whether to install the C extension is just a matter of efficiency optimization. Even if you don’t install it, it won’t be inoperable. You can install the C extension after the project goes online. Maybe the server you are online with is centos.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn