Installing PHP XSL extension on CentOS 7



So you just finished installing php and then tried deploying your app, but then you are greeted with something like:

. . . the requested PHP extension xsl is missing from your system. . .

. . . requires PHP XSLT extension. Please enable it first then. . .

Don’t despair because installing and enabling this extension on CentOS 7 is a piece of cake!

The packages we’ll be needing to install XSL extension are php-xml and libxslt.

Assuming you already ran sudo yum update because you just installed php and whatnot, on your terminal run these two:

sudo yum install php-xml
sudo yum --disableexcludes=main install libxslt.[arch]

where arch could be i686 or x86_64 depending on your system.


Once both commands finished running, we’ll try to search for the actual extension by running:

sudo find / -name

It should return something like:


This is where the extension is installed and if you installed php via yum, that’s also where php’s extension_dir is set. But just to confirm, try checking the actual extension_dir value by running:

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 anymore.


Now to enable the extension, we need to add it to our php configuration but check the file first if it’s already there.
Create a new file named xsl.ini in /etc/php.d/ and add the following inside:

Save and close the file.

Retart HTTPD by running:

sudo systemctl restart httpd.service

Now try checking if the extension is indeed enabled by running:

php -i | grep xsl

You should see something like:

libxslt Version => 1.1.28
libxslt compiled against libxml Version => 2.9.1
libexslt Version => 1.1.28

Which means it’s enabled and working. Easy!


1 Comment (+add yours?)

  1. Trackback: Installing PHP XSL extension on CentOS 7 — Crappy Labs – SutoCom Solutions

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: