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>
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.
ubuntu version: Ubuntu 14.04.4 LTS
php version: PHP 7.0.8-3 deb.sury.org~trusty 1
<code>$ composer require twig/twig:~1.0 </code>
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
<code>$ pear install twig/CTwig </code>
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>
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.
ubuntu version: Ubuntu 14.04.4 LTS
php version: PHP 7.0.8-3 deb.sury.org~trusty 1
<code>$ composer require twig/twig:~1.0 </code>
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
<code>$ pear install twig/CTwig </code>
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.