PHP extension xsl required for Atto Word Import plugin

PHP extension xsl required for Atto Word Import plugin

by Dave Weninger -
Number of replies: 10

Dear Sir,

I am using Moodle 3.6.1, PHP 7.2, Centos 7. I followed the default installation instruction to install Atto Word File Import plugin ver. 1.3.7 When I try to import a Word .docx  file into Atto editor. It prompts that xsl is needed for this action.

I tried to follow the steps as stated on the below website to enable xsl but in vain.

https://crappylabs.wordpress.com/2016/12/17/installing-php-xsl-extension-on-centos-7/

Below is what I have done.

1. yum install php-xsl, It prompts that required xml module is already installed.

2. edit /etc/php.ini and change extension_dir="/usr/lib64/php/modules" because it returns another path when typing php -i |grep ^extension_dir

3. create a xsl.ini file in /etc/php.d and add extension=xsl.so ,while disregards the existing 20-xsl.ini

4. service httpd restart

5. When I type: php -I | grep xsl, nothing is shown, the xsl is still not enabled


Please kindly advise how to enable xsl extension so that I can install the word import plugin.

Thank you very much.

Regards,


Kelvin Ma

Average of ratings: -
In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

Re-read the directions you followed ...

You:

edit /etc/php.ini and change extension_dir="/usr/lib64/php/modules" because it returns another path when typing php -i |grep ^extension_dir

Instructions:

php -i | grep ^extension_dir

It should return something like:

extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

Which means we don’t need to move the extension to its proper place

Then #3

create a xsl.ini file in /etc/php.d and add extension=xsl.so ,while disregards the existing 20-xsl.ini

Apache will read any file in /etc/php.d ... so one doesn't really need to have what appears to be 2 ini files for xsl.

When ever changing a settings line in an ini file always best to comment out the original, then add your line with a comment above it ... something like: # change 2019-04-16 yourfirstname.   That way, when one gets confused, easy to find changes ... fgrep 'change' [nameofconfigfile]

'spirit of sharing', Ken

In reply to Ken Task

Re: PHP extension xsl required for Atto Word Import plugin

by Dave Weninger -

When I type the below command,

php -i | grep ^extension_dir

It returns the below:

extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20170718 =>/usr/local/php/lib/php/extensions/no-debug-zts-20170718

Therefore, I edit the php.ini file as below

extension_dir = "/usr/lib64/php/modules"

Following your advice, I keep the 20-xsl.ini unchanged, instead of creating another xsl,ini

Inside the file 20-xsl,ini, there is a line:  extension=xsl

However, my problem is that xsl module is not enabled yet.

when I type: php -m

xsl is not found in the return list.


Please advise how to enable the xsl PHP module. Thanks a lot.

Best Regards,


Kelvin Ma

In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

Am trying to help!!!  But I didn't install your server ... so am trying to help you find xsl.so.

No Vulcan Mind Meld possible.

I do have more than one CentOS 7 server ... and here is what I am seeing on one of those:


[root@server cli]# uname -an
Linux server 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[root@server cli]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

[root@servcer cli]# php -i | grep ^extension_dir
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

Yours:
extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20170718 =>/usr/local/php/lib/php/extensions/no-debug-zts-20170718

What does your server show with: php -v

Mine shows:

[root@server cli]# php -v
PHP 7.1.26 (cli) (built: Jan 12 2019 09:59:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.26, Copyright (c) 1999-2018, by Zend Technologies

Note there is no Zend Tread Safe ... and the first line shows I am really 'talking to' ... php-**CLI**

Remember you are using php-cli really  ... see the path in yours /usr/local/php/....

[root@server cli]# find / -name xsl.so
/usr/lib64/php-zts/modules/xsl.so
/usr/lib64/php/modules/xsl.so

In your 20-xsl,ini file, rather than
extension=xsl
use full path to one of the xsl.so files listed above.

extension=/usr/lib64/php/modules/xsl.so
or
extension=/usr/lib64/php-zts/modules/xsl.so

use which ever one shows that it's loading when issuing ...

php -m |grep xsl

will respond with xsl if loaded.

[root@server cli]# php -m |grep xsl
xsl

[root@server cli]# php -i |grep xsl
/etc/php.d/xsl.ini,
xsl
libxslt Version => 1.1.28
libxslt compiled against libxml Version => 2.9.1
libexslt Version => 1.1.28

'spirit of sharing', Ken


In reply to Ken Task

Re: PHP extension xsl required for Atto Word Import plugin

by Dave Weninger -

[root@moodle2test ~]# uname -an
Linux moodle2test.hksyu.edu 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


[root@moodle2test ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)


[root@moodle2test ~]# php -v
PHP 7.2.3 (cli) (built: Mar  7 2018 12:33:08) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.3, Copyright (c) 1999-2018, by Zend Technologies

[root@moodle2test ~]# find / -name xsl.so
/usr/lib64/php/modules/xsl.so
/usr/lib64/php-zts/modules/xsl.so
/opt/remi/php72/root/usr/lib64/php/modules/xsl.so
[root@moodle2test ~]#

[root@moodle2test ~]# php -m |grep xsl
[root@moodle2test ~]# php -i |grep xsl
[root@moodle2test ~]#

It does not return anything.

However, it returns correctly for other php modules. What is the difference between them?

[root@moodle2test ~]# php -m |grep xml
libxml
xml
xmlreader
xmlrpc
xmlwriter
[root@moodle2test ~]# php -m |grep gd
gd
[root@moodle2test ~]# php -m |grep mbstring
mbstring



In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

In yours:
[root@moodle2test ~]# find / -name xsl.so
/usr/lib64/php/modules/xsl.so
/usr/lib64/php-zts/modules/xsl.so
/opt/remi/php72/root/usr/lib64/php/modules/xsl.so

You have 3 xsl.so files.
One is from remi repo and in a jail (the /root/ in path):
/opt/remi/php72/root/usr/lib64/php/modules/xsl.so


This one:
/usr/lib64/php-zts/modules/xsl.so
is a Zend Thread Safety module and am not sure why it's on your system.

My php -i |grep ^extension_dir
Shows:
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

My xsl.ini has:
; Enable xsl extension module
extension=xsl.so
Note the semicolon is a comment.

[root@server php.d]# php -i |grep xsl
shows how it  was compiled and is initialized:
/etc/php.d/xsl.ini,
xsl
libxslt Version => 1.1.28
libxslt compiled against libxml Version => 2.9.1
libexslt Version => 1.1.28

Note those are libraries ... dependencies - like Windows .dll files.

What do you get for:
yum list libxslt

From what repo did you install your PHP?

'spirit of sharing', Ken



In reply to Ken Task

Re: PHP extension xsl required for Atto Word Import plugin

by Dave Weninger -

[root@moodle2test /]# yum list libxslt

Installed Packages
libxslt.x86_64                      1.1.28-5.el7                       @anaconda
Available Packages
libxslt.i686                        1.1.28-5.el7                       base

After setting the php,in: extension_dir="/usr/lib64/php/modules"

[root@moodle2test /]# php -i |grep ^extension_dir
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

My 20-xsl.ini has

; Enable xsl extension module
extension=xsl

(writing full path or xsl.so is of no use)


PHP is complied from source code.

I just modified the LAMP of my boss's existing LAMP platform.


Regards,

Kelvin Ma



In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

PHP is complied from source code.

You compiled php from source code?  Why? Isn't needed and this could be the reason for your issues.  Many years ago that was the only way one could get LAMP.   No longer true.  Binaries provided by reputable/well-known repos do just as well and are much easier to maintain and manage on your own system.

I just modified the LAMP of my boss's existing LAMP platform.


You might have to wipe out PHP all together --- un-compile + remove via yum.
Uhhh ... I don't re-call how to 'un-compile' - matter of fact, don't think I ever tried ... may not be possible.

Well, have taken this one as far as I can ... good luck!
'spirit of sharing', Ken

In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

In your Moodle there is Admin Menu -> Server -> PHP info.

In older versions of php at the very top, there used to be a box that showed how PHP was built/compiled.  Is that box present on your system?  Probably isn't.

But, with php -i at the very top of that output, is there a section entitled: Configure Command =>

Here's what it looks like on a stock Mac ...

Configure Command =>  '/Library/Caches/com.apple.xbs/Binaries/apache_mod_php/install/TempContent/Objects/php/configure'  '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-libdir=lib' '--enable-cli' '--with-iconv=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-config-file-path=/etc' '--with-libxml-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-openssl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/libressl' '--with-kerberos=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-zlib=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-bcmath' '--with-bz2=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-calendar' '--disable-cgi' '--with-curl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-dba' '--with-ndbm=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-exif' '--enable-fpm' '--enable-ftp' '--with-gd' '--with-png-dir=/Library/Caches/com.apple.xbs/Binaries/apache_mod_php/install/TempContent/Root/usr/local' '--with-jpeg-dir=/Library/Caches/com.apple.xbs/Binaries/apache_mod_php/install/TempContent/Root/usr/local' '--enable-gd-native-ttf' '--with-icu-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-ldap=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-ldap-sasl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-libedit=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysqli=mysqlnd' '--with-pcre-regex=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--without-pcre-jit' '--with-pdo-pgsql=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.14.xctoolchain/usr/local/bin' '--with-pgsql=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.14.xctoolchain/local/bin' '--without-pear' '--with-pear=no' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--disable-phpdbg' '--with-readline=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-shmop' '--with-snmp=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-xsl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr' '--with-apxs2=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.14.xctoolchain/usr/local/bin/apxs' '--enable-zip' 'YACC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bison'

Can re-call doing what you say you've done ... compiled ... and having 'great fun' (yeah, right!) with how to install something I left out ... supports wise ... If you noticed above ... --with-xsl ... the very thing you are trying to get running on your server.

In addition, today ... one needs more than the compilers gcc, gcc+ etc. but libraries and headers as well as other apps and those have hooks into apache.

Yep ... by far much easier to use a repo and yum.

'spirit of sharing', Ken



In reply to Ken Task

Re: PHP extension xsl required for Atto Word Import plugin

by Dave Weninger -

Sorry, I may make up something. I suspect that my boss just compile the source code of Apache but used yum to install the php modules. My boss prefers to compile source code because he said that this will allow him to upgrade the system version.

[root@moodle2test ~]# yum list php-xml
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.cuhk.edu.hk
 * epel: mirrors.aliyun.com
 * extras: ftp.cuhk.edu.hk
 * remi-php72: ftp.riken.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.cuhk.edu.hk
Installed Packages
php-xml.x86_64                   7.2.16-1.el7.remi                   @remi-php72

If you have no idea, I may give up. Thank for very much for your help.

Best Regards,

Kelvin Ma


In reply to Dave Weninger

Re: PHP extension xsl required for Atto Word Import plugin

by Ken Task -
Picture of Particularly helpful Moodlers

I'd disagree with your boss.  Having to recompile one of the 3 (Apache/PHP/MySQL) due to what Windows folks know as a 0 day flaw and in the wild is exactly the reason for the decision to use repos.   Those security flaws came frequently enough to make re-compiling a chore.   For the users of Moodle that equates to more down time ... and in this case, adding something in an editor that is dependent upon something outside of code could also mean a 'white screen of death' - maybe only in certain areas ... and then a trip down a rabbit hole!   I got very tired of playing the role of 'Elmer Fudd'!

Soooooo .... best of luck to ya!

You might find better luck in some other forums.

'spirit of sharing', Ken