As the title says im trying to install a php extension (zip.so) that is missing from php7.1 version in ampps 3.8. I have searched for an answer but no luck so far.
Also using php5.6 and going to the php extensions list im able to see the zip extension, but since the software that im trying to intstall requires php 7.X im unable to simply use php5.6.
Thanks for the help in advance.
I finally found a way to do it:
Go to (for example) https://pecl.php.net/ and download the extension that you need.
Unzip the extension and go to the file location $ cd my/extension
Run phpize /usr/local/ampps/php-7.1/bin/phpize
Next run ./configure --with-php-config=/path/to/my/php-config for example ./configure --with-php-config=/usr/local/ampps/php-7.1/bin/php-config
make and sudo make install
In the end of sudo make install log you will find this Installing shared extensions: /usr/local/ampps/php-7.1/lib/extensions/no-debug-non-zts-20160303/ file path.
Go to the file path and you will find your compiled extension, for me it was zip.so
Finally copy the extension into your php folder /usr/local/ampps/php-7.1/lib/extensions/ext and you will be able to see it on the list of extensions in ampps, dont forget to enable it and restart apache2!
Hope it helps!
There is an easier way to do so
Open AMPPS Application ->Stop Apache (If running)
2 In "PHP" Tab -> "PHP Extension"
Enable "zip.so".
Apply
Restart Apache.
See image for clarification I am using a mac
Related
I have gnupg and gpgme installed using homebrew.
I also linked both and made sure they are installed and linked by running brew gnupg install and brew gpgme install and got the message confirming the installation and the version.
I have placed the gnupg.so file in the extension path and also added extension=gnupg.so into the php.ini file.
I got the extension path and the specific php.ini's path from the infophp page.
After restarting mamp, I still don't see gnupg or gpgme as extensions on phpinfo, neither I can use gnupg in my php code.
using $gpg = new \gnupg(); this gives me error saying gnupg class doesn't exist.
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'gnupg' not found
I tried another approach:
I also manually downloaded both gnupg and gpgme from their website extracted them ran following
./configure,
make,
sudo make install,
and was able to install successfully again, also made sure that gnupg.so is in the same path that shows up in phpinfo page for extension path and also added extension=gnupg.so to the same php.ini that appears in phpinfo page (I added the extension=gnupg.so right after all the other extensions in the php.ini file)
I am using:
mac os high sierra 10.13.3
php 7.1.12
mamp 4.4.1
gnupg 2.2.5 (I tried this version with brew install)
gnupg 1.4.0 (I tried this version with downloading from gnupg.org)
gpgme 1.10.0
I also would like to know, after hopefully fixing the above mentioned problems, do I need to include anything in my php file in order to use gnupg?
what are the differences between gnupg and gpgme? do I need both in order to encrypt a file in php?
if I wasn't able to fix this what is another way to encrypt xml files or files containing text data? I need to encrypt the file and FTP to another server and decrypt it over there.
Thank you all in advance for your help
I was able to solve this issue using Pecl to install GnuPG.
This link helped me a lot as well.
Run the following in order to install the library:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libgpgme11-dev
sudo pecl install gnupg
Restart your server with: "service apache2 restart", or "sudo service phpX.Y-fpm-sp restart" where x.y is the major.minor version of your php. Note: there are multiple different ways to restart the system so the changes take effect, so please do your own research on how to do it depending on the server and your php version.
As I've explained in my question, try to find the right php.ini file to add the "extension=gnupg.so" into. most common places you'll find your php.ini are:
/etc/php/7.2/apache2 (you can use your PHP version instead of 7.2)
/etc/php/7.2/cli (you can use your PHP version instead of 7.2)
The better way is to find out the php.ini path that loads the extensions, from the phpinfo()
Now Verify that it all went well with the following command:
"php -i | grep -i gnup"
If everything is working as expected you'll see something like this:
/etc/php7.0-sp/conf.d/gnupg.ini,
gnupg
gnupg support => enabled
I'm trying to install Gearman on OSX (10.8.3) and MAMP PRO (2.1.1), but for some reason it's not picking up my gearman.so extension file and loading it - I can't see it in phpinfo(). I followed the steps that seem to have worked for others:
Installing Gearman:
brew install gearman
Downloading and installing the Gearman package:
tar xzf gearman-X.Y.tgz
cd gearman-X.Y
phpize
./configure
make
make install
Both of these seemed to work correctly. I copying the gearman.so file to the extensions directory shown in phpinfo(), and added:
extension=gearman.so
To the MAMP PHP 5.4.4 php.ini template. I restart MAMP and open up phpinfo() again but it doesn't show anything to do with Gearman. If I look at the loaded php.ini file, gearman.so is listed there, and is in the extensions directory shown, but it still isn't loading.
Why wouldn't an extension show up after these steps? Any idea how I can troubleshoot this issue?
Make sure you placed the gearman.so in the right folder for MAMP and make sure you did sudo make install and not just make install
I know this is old but wanted to leave a comment incase someone else found this in their search
On my sever i successfully install phalcon version 0.6.0 through git. These are the steps i used.
git clone git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
restart the webserver
I tried to update to version 0.7.0, so i deleted the original folder and re-downloaded the git folder. I followed the same steps, after the install i check phpinfo. It installed correctly but, it installed a previous version(0.5.2).
I tried to install the extension multiple times but, it still gives me the old version.
is there something im doing wrong, any help would be appreciated.
Find if you have any phalcon.so files laying around and they are used instead of the actual one. It could very well be that the 0.5.2 is somewhere in your system, referenced by your web server and the installation process cannot update it.
locate phalcon.so
Note: for my installation it was in /usr/lib/php5/20100525/phalcon.so
Check your php.ini or your /etc/php/conf.d folder for references to the extension. If there are some remove them.
Re-run the installation process again using the
cd build
sudo ./install
Note the script output, especially at the end. It will tell you where the extension was installed.
Note the folder and add the directive in the php.ini file and then restart your web server for the changes to take effect.
It seems that you have installed PHP 5.3 on CLI but PHP 5.4 on Apache/Nginx, make sure your 'phpize' command is pointing to the 5.4 one:
[#] whereis phpize
Once you know the correct path change the priority of the executable, delete the PHP 5.3 or add an alias in the bash console:
[#] alias phpize=/path/to/5.4/phpize
Then try to run ./install again
I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code.
My question is that I can't seem to get the Postgre extension working in PHP. I checked the php.ini file, there were no "extension=..." lines. So I added "extension=pgsql.so". I then checked the "extension_dir" and found that there were only 2 files in there (ldap.so, phpcups.so), I added a pgsql.so file taken from another Linux box. I restarted httpd. And it does not work. I couldn't find any "pgsql" or "postgre" in phpinfo().
Forgive my noobness. I know too little Linux. I would really appreciate it if you can point me to the right direction.
I used the suggestion given by number5:
Dude, I'm on RedHat. I used the "yum" version of the command you gave, and I got this:
[root#perseus ~]# yum install php-pgsql
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=extras error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: extras
UNFORTUNATELY, the Linux server I'm using is NOT connected to the Internet. Any other way to install?
It depends on which Linux distro you are using.
If you are using Ubuntu/Debian, you need to:
sudo apt-get install php5-pgsql
Fedora/CentOS
yum install php-pgsql
usually you can find out which distro you are on by:
ls /etc/*-release
On CentOS extensions create separate *.ini file one per each php extension in /etc/php.d
So, don't alter main *.ini file, but create /etc/php.d/pgsql.ini and add there a line
extension=pgsql.so
Then you will need to restart Apache using
service httpd restart
But the best automated way is to just type
yum install php-pgsql
In your case that didn't work because of some problems in yum configuration. Go to /etc/yum-repos.d
Type
nano /etc/yum.repos.d/CentOS-Base.repo
Scroll down to [extras] section and ensure it is like this:
#additional packages that may be useful
[extras]
priority=1
name=CentOS-$releasever - Extras
=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Correct it if needed, save file (Ctrl-X) and do the following:
yum clean all
yum upgrade
Afterwards try to repeat
yum install php-pgsql
Remove the .so file you've copied from the other machine (though it might work, there's no need to take the risk)
Use the distribution's package manager to install the php_pgsql/php5_pqsql module
Restart the apache and try again. Maybe the module has been added to an .ini file automagically
If not, run <?php echo 'ini: ', get_cfg_var('cfg_file_path'); to see which php.ini you have to edit
edit this ini file
restart the apache
My operation system Linux mint kde and there was same issue
pg_connect()
You must install if you are use php5.6
sudo apt-get install php5.6-pgsql
After you must change extention name in "php.ini" file.
;extension=php_pgsql.dll
'dll' to 'so'
For example
extension=php_pgsql.so
I am trying to use the new facebook api and it requires libcurl PHP. I used
sudo apt-get install php5-curl
sudo apachectl -k restart
And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl.
The source of this problem is probably that I built some of the tools from source (apache2, php), but then I got bored so installed a lot of the extensions with the package manager. But I'm not exactly how to go about diagnosing the point of failure.
The apt-get install for curl definitely worked, and can be found in
/usr/lib/php5/20060613/curl.so
I think a lot of my confusion stems from not knowing which files go where, and what purpose they have. Any help would be appreciated, and please tell me if I need to provide more information.
edit:
The specific error I get is:
Exception: Facebook needs the CURL PHP extension.
from line
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
Ubuntu: 9.10
PHP: 5.2.13
Loaded Configuration File: /etc/php5/apache2/php.ini
In general it's a bad idea to mix and match software from your distribution's package manager with stuff you've built yourself. The package manager will not know anything about the stuff you've built yourself and so can get confused.
Not only that but who's to say the stuff from the package manager is even binary compatible with the stuff you've built yourself? If you build it all yourself then at least you know it will all be compatible.
Sounds to me like you should uninstall the extensions and build them yourself. If you can't or don't want to do that then go back and install apache and friends through your package manager but I would recommend having patience and going for the former option.
Answer of Questions
What version of Ubuntu?
What version of PHP?
How is Apache and PHP set up?
What ini files does phpinfo() say is parsed? (should be near the top)
Perhaps apt failed to properly modify your php.ini file to load the curl extension?
Check out your php.ini and see if you have line like:
extension=curl.so
or maybe:
extension=/usr/lib/php5/20060613/curl.so
To check if php-curl is installed please follow these steps:
Create a file in your web server (in Ubuntu it would be in /var/www folder), name it info.php
Open that file and type this command:
<?php phpinfo(); ?>
Save that file
Open your favorite browser and open that file (ex: http://localhost/info.php)
Now you will see the Information about your PHP installation
Search for Curl, and if you cannot find it, it mean your php doesn’t have curl installed.
To install php-curl please follow these steps:
Open your terminal and type this command:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
After it finish open php.ini file (mine is at /etc/php5/apache2/php.ini ) and add this command: extension=curl.so
Save the file and restart apache with this command:
/etc/init.d/apache2 restart
Check the PHP information page again, you will find PHP-CURL installed
That’s it
Source: http://www.ivankristianto.com/os/ubuntu/howto-install-curl-in-php-apache/379/