Enable php-gmp for php - php

I'm trying to configure an AWS AMI instance. In some of the PHP code I use the gmp function, so I installed the relevant package using the following command.
yum install php71-gmp
I have restarted apache, but this doesn't work or give any difference. Still getting the error Call to undefined function gmp.
Any clue how I can add this extension? In the /etc/php.ini there is no extension list..

I got this answer from Amazon Support Center
Create a something.config file inside a .ebextensions folder at the root directory of your project and put this code inside:
packages:
yum:
php70-gmp: []

Related

Pdftohtml Poppler utils not working on centOs

I am trying to convert pdf to html in php using mgufrone library(https://github.com/mgufrone/pdf-to-html). I run this in my mac it's working alright.
But when I run in centos server, the .html file is created blank inside /vendor/gufy/pdftohtml-pdf/output folder.
In my mac local multiples files are created inside /output folder. But in server only a single file is created with empty content.
Please help.
Herein lies the problem:
sudo yum install poppler-utils
That installs an old version (0.12.4) which does not have pdftohtml command options like "-s" and "-fmt".
Go to this page https://medium.com/#jakebathman/building-poppler-utils-for-centos-6-5-really-e52eccffc6ae to guide you on how to get a later version of poppler-utils. I installed https://poppler.freedesktop.org/poppler-0.22.5.tar.gz instead of 0.13.4 as instructed.
All the best!

How do you edit the command line php.ini file in Azure?

I'm trying to migrate a PHP website from AWS to Azure and have created a website in the Azure UI.
I've installed composer using the Kudu console and have overridden a few php.ini settings via the .user.ini file I created in the root. I've also added php_memcache.dll to my wwwroot/bin directory and enabled this in app settings within the Azure UI.
However, when running composer install using using the console I get an error because it can't find the memcache library. I assume because I haven't added this to the command line php.ini file. Does anyone know how to to edit this?
This is the error I get when I run composer install:
- The requested PHP extension ext-memcache * is missing from your system.
Edit - Solution
Looks like I've managed to run composer install using the following command:
php -d extension=D:\home\site\wwwroot\bin\php_memcache.dll bin\composer.phar install
Is it possible to run this without specifying the extension and using composer install instead of bin\composer.phar install`?
To add an extension to PHP app on an Azure website, it is easier to configure it from your Azure portal. The official Azure documentation on PHP configuration should help, just search on that page for "How to: Enable extensions in the default PHP runtime".
I wasn't able to find a way to get CLI extensions onto Azure. I did find that
composer install --ignore-platform-reqs
Does the install without blocking on missing PHP extensions.

Enable XSL on Ubuntu 12.04

I am trying to enable XSL on Ubuntu 12.04 but its failing. I did this locally on my Ubuntu 13.04 and it was successful. Basically the following worked on my local computer.
apt-get install php5_xsl
edit php.ini file and add extension=php5_xsl.so
restart apache
I repeated the same procedures on my production server running Ubuntu 12.04 and PHP version 5.5.12 but the extension is not getting loaded from the phpinfo. I have also changed the extension=php5_xsl.so to extension=xsl.so because this is what in the extension directory.
I read that I might need to recompile PHP but I am not sure of this steps.
Try this:
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Why:
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
What's happened here is that all debian-flavoured unixes have adopted
this standard for their PHP 5.4 packages, so if you're using debian,
ubuntu, or any of their relatives with PHP 5.4, you'll see a directory
structure like this. When you add a module to PHP, you'll add a file
to the mods-available directory enabling the module and adding any
config specific to it. If you want to enable the module, just do:
php5enmod http
This simply creates a symlink from the usual conf.d directory to point
to where the real files are in mods-available, prefixed with a number
that indicates the priority of the module. By default, the priority is
20.
Using this approach means we can toggle things on and off without
commenting out big chunks of config files and leaving them lying
around - if this seems familiar then that's no surprise; debian-like
linuxes manage their apache configuration in just the same way. Any
packages that you install using aptitude will use these exact same
commands to set up the configuration and then symlink it correctly. To
unlink, use the delightfully predictably-named php5dismod :)

How to update PHP and install ICU library on CentOS 6.x

I'm trying to install orocrm on centos server and it is asking for PHP 5.4 and ICU library 4.4. Although I updated PHP and restarted Apache my php version still shows PHP 5.3 if outputting phpinfo in a php page. But,if I use php -v command then it shows php 5.5
ini path is shown /usr/local/lib/php.ini if using php page but through command it shows /etc/php.ini
please help...
The PHP 5.4 you compiled is not getting picked up by Apache. Rather than figuring out how to point Apache to this installation, the easiest (and safer since you'll get security updates) is to use the IUS Community repository
I have a couple of thoughts. If you're on CentOS you're probably using YUM as your package manager. With it, you could remove the PHP's and add a new one (if you don't have active clients using it). You can search what PHP version yum has by doing one of these:
yum list
yum list installed
If it registers multiple versions, you can "yum remove $package".
If you're php -v showing version 5.5, then your path is set to include that. You can see that by typing $PATH from the command line when SSH'd in. In your ~/.bashrc (or ~/.profile) you can edit your $PATH by adding something like:
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
EDIT: You should back up your PATH before writing a new one and after you edit it type "source ~/.bashrc" or "source ~/.profile" to make the command line see it.
You can also directly edit the php in the .bashrc to point to the correct version by setting up an alias (if you don't fix the root of the problem) like
alias php="/path/to/php"
You can see where your current php is by typing:
which php
Your PHP extension comes from the apache httpd.conf file. You can find it somewhere like /etc/apache2/httpd.conf. Search for "LoadModule" or "LoadModule php" and see which extension of PHP your apache is pointing to. It may still be pointing to an incorrect version.
To answer your question about ICU, it comes from the "intl" extension. With yum, this is probably called php-intl or php54-intl or php54w-intl. You can do something like "yum search intl" and it should give you the exact extension name.
I hope this helps!

Class "XSLTProcessor' not found [duplicate]

This question already has answers here:
Fatal error: Class 'XSLTProcessor' not found
(2 answers)
Closed 8 years ago.
I'm trying to transform a XML file to a HTML output with XSLT..
My code is as following:
<?php
$xml = new DOMDocument;
$xml->load('file.xml');
$xsl = new DOMDocument;
$xsl->load('file.xsl');
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
But I'm getting the error: Fatal error: Class 'XSLTProcessor' not found
I know this has something to do with the fact dat the xsltprocessor is not compiled with PHP on my server... But I can't seem to find a way to enable it. (I do not control the server, but my hosting does)
Just install : sudo apt-get install php5-xsl
AND RESTART your APACHE Server ;)
I do not control the server
The PHP XSL extension can only be installed and enabled by the sysadmin.
While it's compiled by default, it is usually not installed by default when the server is using a pre-packaged version of PHP. Ask your host to install the php-xml package if you're on a *nix. If you're hosting on Windows, it becomes a bit more involved, as it requires finding the right .dll file (which may or may not be included in the official distribution) and editing php.ini.
With apache2/php5, you need the php5-xsl extension installed and enabled.
http://php.net/manual/en/book.xsl.php gives information on how to install the xsl extension. To enable, put the line "extension=php_xsl.so" in your php.ini file.
If it's still not working, create a new .php file on your server containing the line "". Load the file you just created, and search for "xsl" to see if the extension is actually being loaded.
Its necessary install the XLS extension.
My solution by my context.
I'm using one docker container contain ubuntu base and using php-fpm (ie if you simply already use linux ubuntu in the same).
The steps to install this extension in my context were:
First search xsl extension on linux repository
sudo apt-cache search xsl
I ended up finding the php5-xsl, so it was only install
sudo apt-get install php5-xsl
that the installation process the setup configuration is already added, if does not happen, just make yourself
sudo vim /etc/php5/mods-available/xsl.ini
insert this content:
extension=xsl.so
(obviously the paths are according to your php configuration settings, but my example is the default configuration)
Restart you php fpm and done (sudo service php5-fpm restart)!
If your php environment is on linux you can probably enable the php extension by using this command:
yum install php-xml
If it is a windows system, you can go into your php.ini config file and uncomment the php_xml.dll extension.
Hope that helps. A quick google search can answer questions like these in the future btw.

Categories