0

I am new to ubuntu. I am trying to install php 7.0 in my ubuntu 14.04

I have installed PHP using below commands.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.0
sudo apt-get install php7.0-mysql

I was able to successfully install php and working fine. Now I want install some custom module in it but I am unable to do it.

I was able to do it in centos 7 using below commands.

wget https://pecl.php.net/get/crypto-0.3.1.tgz
tar -zxvf crypto-0.3.1.tgz
cd crypto-0.3.1/
phpize
./configure
make
sudo make install

And edit PHP ini like below

nano /etc/php.ini

and add line in php.ini file like this

extension=crypto.so

I am able to phpize, configure, make and install but even I edit php.ini file located in

/etc/php/7.0/apache2/php.ini

but its still not showing module when I run php -m

let me know if I am missing something in it.

Thanks

5
  • Are you restarting apache2? Also be sure you don't have multiple PHP versions somehow enabled (such as PHP 5 and 7 with that old of a Ubuntu) You can also verify with a page that has <?php phpinfo() which configuration files are being loaded Sep 26 '18 at 15:12
  • php -m on the command line calls PHP CLI commands, this is different from the Apache2 plugin. If you are trusting php -m you need to make sure that /etc/php/7.0/cli/php.ini is altered, not the Apache2 one. Apache2 will only show from the phpinfo() call on a webpage.
    – Thomas Ward
    Sep 26 '18 at 15:21
  • @ThomasWard what is means of php.ini altered ? How can I do it? Thanks
    – Mira
    Sep 26 '18 at 15:27
  • @Mira the same way you edited php.ini - except edit /etc/php/7.0/cli/php.ini to add the extension=crypto.so line.
    – Thomas Ward
    Sep 26 '18 at 15:29
  • @ThomasWard thanks for that info. I will add there. One more questions after I run sudo make install, and when I try ls, I am not able to find crypto.so there, instead I can see crypto.ls etc. it can be issue ? Thanks
    – Mira
    Sep 26 '18 at 15:36
-1

From the github page of the package:

Linux

Before starting with installation of this extensions, the OpenSSL library has to be installed. It is defaultly installed on the most Linux distributions. The minimal version of OpenSSL that is supported is 0.9.8 but it is recommended to have installed version 1.0.1+ to use all features.

Of course PHP has to be installed too. The minimal version that is supported is 5.3 as the extension uses namespaces. Currently PHP also needs to be compiled with OpenSSL extension (--with-openssl). This dependency will be removed in the future.

1
  • 1
    Mind detailing how this answers the question?
    – Thomas Ward
    Sep 26 '18 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.