PHP extension XSL help websites to generate HTML pages from XML data.
Thus it is quite inevitable in major website building platforms.
However, to enable this extension we install it and add it in the PHP configuration on the server.
At Bobcares, we often get requests to enable XSL extension, as a part of our Server Management Services.
Today, let’s see how our Support Engineers enable this extension.
What is XSL?
XSL aka eXtensible Stylesheet Language is a styling language for XML. Moreover, it is a language for expressing style sheets.
The style sheet is a collection of style rules. This describes how the different styles should appear on a webpage.
So, it describes how to display an XML document, where XML is a text-based markup language. To be more specific, XML is a text structured in a specific format.
Many PHP based web development requires XSL extension for displaying XML code on websites. For instance, the missing XSL extension in Magento installation shows up the error as,
How we enable the PHP extension XSL?
Since some applications require XSL extension, we often get requests to enable it. So, let’s discuss how we install PHP extension XSL in the server.
XSL extension in Linux servers
To enable XSL extension in Linux servers, we first check if the extension is already present in the server or not.
As a matter of fact, PHP 5 includes the XSL extension by default. Therefore, our Support Engineers use the command,
php -m | grep xsl
If there is no XSL extension, we install it along with the dependencies.
For instance, in a CentOS7 server, we install it using the commands:
yum install php-xml
sudo yum --disableexcludes=main install libxslt.[arch]
Here, we make sure to choose the arch as i686 or x86_64 depending on the server type.
Now to enable the extension, we need to add it to the PHP configuration. For this, we create a new file named xsl.ini in /etc/php.d/ and add the following inside:
extension=xsl.so
Finally, we save and close the file.
Similarly, in an Ubuntu server for the PHP version, we use the commands to install it.
apt-get install php7.0-xsl
apt-get install libxslt-dev
Then add the extension to the PHP configuration and enable the PHP module, use the command,
phpenmod xsl
Finally, we restart the webserver to make the change reflect on the server.
PHP extension XSL in Windows
In a similar way, our Support Engineers also enable the XSL module in the Windows server.
Firstly, we open the php.ini file. Then we uncomment the line,
extension=php_xsl.dll
Later, we save the file and restart the webserver.
Enable XSL using cPanel
Some customers have control panels for their servers. This makes the task of enabling PHP modules much easier. Let’s take the instance of cPanel.
- Firstly, our Support Engineers login as root in the WHM.
- Next, we select EasyApache from the Software section.
- Here we select the appropriate PHP version.
- Now, we search for the XSL modules available.
- Finally, we select the module and click the button Save and Build.
This makes the XSL extension now available in the server.
After enabling the module, our Support Engineers always confirm it. For this, we check the phpinfo page in the website. It appears as,
[Need help in enabling PHP extension XSL? – We’ll help you.]
Conclusion
In short, PHP extension XSL is important for converting XML code to HTML in PHP based websites. Today, we saw how our Support Engineers enable this in various platforms.
tranks