Install libssh2-php on PHP 5.4.9 (x64) - php

I have a problem with the update on php 5.4.9 (i install it with the ppa "ppa:ondrej/php5")
Now i have the problem that i can't install libssh2-php (which is required on my project)
I found some .deb files, but it's only for 32-bit systems.
So when i'm trying to install libssh2-php i have a collision with "libssh2-php:i386" and i have the following dependiesmessage:
ucf:i386 libc6:i386 (>= 2.4) libssh2-1:i386 (>= 1.0) and phpapi-20090626+lfs:i386
System: Ubuntu Server 12.04 LTS x64 | PHP 5.4.9
I also got a warning on running "php -v"
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/ssh2.so' - /usr/lib/php5/20100525/ssh2.so: cannot open shared object file: No such file or directory in Unknown on line 0

The problem is/was that the libssh2 is not aviable for PHP5.4.x AND a x64 system.

I have the same problem trying to use ondrej's ppa for ubuntu 10.04 LTS. It seams that he didn't include the sssh extension.
Apt-get tries to install the version from default package which runs into conflict (depends phpapi-20090626+lfs) with current installed version, isn't it?
Only my backup php cli script needs this extension to run. After trying to solve dependencies witout success, I switched to a shell_exec('ssh ...#...') solution as workaround.
I am only a developer with advanced admin knowledge, no apt-get or linux packaging admin professional. There maybe other solution to fix this via packaging management or maybe building the needed version from source?
EDIT:
There will be another nicer solution :-) you can use pecl to install / build the extension, here is what i have done:
$ sudo pecl install ssh2
Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.12, stability "beta", use "channel://pecl.php.net/ssh2-0.12" to install
install failed
$ sudo pecl install channel://pecl.php.net/ssh2-0.12
downloading ssh2-0.12.tgz ...
Starting to download ssh2-0.12.tgz (26,223 bytes)
[...]
Build process completed successfully
Installing '/usr/lib/php5/20100525+lfs/ssh2.so'
install ok: channel://pecl.php.net/ssh2-0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.ini
Afterwards I add extension=/usr/lib/php5/20100525+lfs/ssh2.so to php config.

Just do:
sudo aptitude purge php5-suhosin
It's described in detail here: bugs.debian.org

Related

Install MongoDB PHP Extension for PHP 8.1 (Debian)

sorry if there is a duplicate question for this but I'm trying to set this up for hours now and it just doesn't work.
I have a Debian 11 server with "KeyHelp" installed on it (little brother of plesk). It comes with PHP 7.4 but provides a simple Dashboard where you can install other PHP versions. I installed PHP 8.1 and tried to install the mongodb extension via PECL.
After "pecl install mongodb" I added "extension=mongodb.so" and after that didn't show up the extension on the phpinfo page, I double checked if the extension is really in the extension folder of php, where it was.
Turns out that I installed the extension for PHP 7.4 and not for PHP 8.1. Finally I tried to force PECL to install it for PHP 8.1 but it says "phpize8.1 command not found". I found no way to install phpize8.1, can somebody help me out with that?
Thanks in advance!
I am using Ubuntu 20.04
I have PHP 8.1 version. You have to install modules of PHP
sudo apt install php8.1-mongodb
List the modules
php -m
It's not exactly Debian. I hope it helps you.
If you run command:
sudo apt install php-dev
System will install automatically the correct version of php{x}-dev for your distribution, and all it's dependencies, included PECL.
another way is try to run:
/usr/bin/phpize
If this command works, you need to add phpize to your PATH:
PATH=$PATH\:/usr/bin; export PATH
In this way phpize will work in future.

extension=php_intl.dll in my linux centos doesn't exists

I have a problem, I just want to uncomment extension=php_intl.dll in my php.ini file
but that extension doesn't exist, I'm using Centos with Nginx configuration.
Linux servers don't use .dll files. You need a .so instead.
To install php_intl on CentOS , you should enable remi repo . Open the terminal and run the following commands:
wget https://rhel7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
Update your system then install the php-intl:
sudo yum update
sudo yum --enablerepo=remi install php-intl
To permanently enable remi repo , open the terminal and run the following command:
sudo nano /etc/yum.repos.d/remi.repo
Set enabled=1.
How did you install PHP ?
PHP 5.6.3 is terribly old, and affected by tons of security issues, latest version is 5.6.40 but have reached its end of life a few months ago
If installed from sources, you have to rebuild it, location of php command usually gives useful information (ex, when installed in /usr/local)
which php
or remove this build from sources, and switch to RPM provided binaries.
If installed from a 3rd party repository, you should find the intl extension in the same repository.
see information provided by the yum command
yum info php-cli
While I heartily recommends to upgrade to a supported version (7.1+), if you want to keep 5.6, "remi" is the only repository which still provides this version (with security backports).
To upgrade your installation (to latest 5.6.40 or any other version, 7.0, 7.1, 7.2, 7.3), simply follow the wizard instructions.
With RPM, you never have to change php.ini to enable installed extension, each package provides its own configuration file (ex: /etc/php.d/20-intl.ini) which
enable it.
With proper provider, for any needed extension (ex xxx), a simple
yum install php-xxx
will install the package with this extension (package name may be different, as some packages provide various extensions).

Can not connect to MongoDB from PHP

I have installed MongoDB PHP lib
but despite this I can't connect to MongoDB database
Error of rockmonogo :
To make things right, you must install php_mongo module. Here for installation documents on PHP.net.
Error of phpmoadmin :
PHP cannot access MongoDB, you need to install the Mongo extension for PHP.
Error of Laravel with Jenssegers\Mongodb lib :
Unsupported driver [mongodb]
Make sure that it is in fact properly installed. The errors you're getting seem to indicate that your environment can't find the extension. I've compiled installation instructions for you.
Unix-like Systems
Open a terminal emulator and run wget http://pear.php.net/go-pear.phar
Then start the installation of PECL with php go-pear.phar
Install the PHP MongoDB extension sudo pecl install mongodb.
Add extension=mongodb.so to the php.ini file.
Mac OS X
Install homebrew by running /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" in a terminal.
Run brew update
Run brew tap homebrew/php
Install the extension according to your PHP version.
PHP 5.4: brew install php54-mongodb
PHP 5.5: brew install php55-mongodb
PHP 5.6: brew install php56-mongodb
PHP 7.0: brew install php70-mongodb
Windows
Open your web browser to http://pecl.php.net/package/mongodb
Open the latest version from the DLL link (with the Windows icon).
Choose the appropriate version from the DLL list. They are sorted by PHP version, system architecture (i.e. 32-bit vs 64-bit), and thread safety.
Extract the downloaded archive and place php_mongodb.dll in your PHP extensions directory.
Add extension=php_mongodb.dll to the php.ini file.
For mac system, the homebrew php tap mechanism is deprecated and it won't work. You need to manually install it or you need to install Ampps which contains all the packages in built.
The following error might be thrown for the user with new version of the system
Error: homebrew/php was deprecated. This tap is now empty as all its formulae were migrated.

How can I update my PHP 5.3.3 to PHP 5.3.8 Linux Centos

I want to update my php 5.3.3 to php 5.3.8, I already downloaded PHP5.3.8.tar.gzip.
My PHP 5.3.3 located in /usr/bin/php. When I try to install PHP5.3.8.tar.gzip and do this command:
./configure
make
make install
It installed in different location /usr/local/bin/php.
So now I have 2 php 5.3.3 and php 5.3.8. So I try to install it again and run this
./configure -prefix=/usr/bin/php
make
make install
This time an error occurred:
Installing PHP SAPI module: cgi
mkdir: cannot create directory `/usr/bin/php': File exists
mkdir: cannot create directory `/usr/bin/php/bin': Not a directory
make: [install-sapi] Error 1 (ignored)
Installing PHP CGI binary: /usr/bin/php/bin/
cp: accessing `/usr/bin/php/bin/#INST#29239#': Not a directory
make: *** [install-sapi] Error 1
Please help me, I want to delete the php5.3.8 I installed in /usr/local/bin/php
and update the /usr/bin/php to php5.3.8. I need php5.3.8 version only.
Thanks.
Generally on CentOS, you want to leave this sort of thing to yum.
yum update php
or
sudo yum update php
You can also replace the installation with a newer version. 5.3.X is not supported any longer, so you could do:
yum install yum-plugin-replace
yum replace php --replace-with php55
If you don't have php 5.5 in yum, first do this:
cd ~
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
rpm -Uvh epel-release-6-5.noarch.rpm ius-release-1.0-11.ius.centos6.noarch.rpm
If you don't have wget installed:
yum install wget
PLEASE NOTE FOR ALL OTHERS FINDING THIS THROUGH GOOGLE!!!
The URL's that I linked in the wget commands are the current releases of the epel and ius repos for CentOS 6. (It may also be out of date.)
If you have RHEL or CentOS 5, you can find the specific link for your RPM here: http://dl.iuscommunity.org/pub/ius/stable/
Why do you need 5.3.8 specifically? The last version of 5.3 was 5.3.27. 5.3 is end-of-life. I would find a modern repo like remi and install 5.4 or later using yum

Running PHP 5.3 on CentOS 5.4 - fatal error Class 'PDO' not found

What is the best way to get PHP 5.3 up and running on CentOS 5.4.
My machine says I have PHP 5.3 installed but running into an issue with my script that says
Fatal error: Class 'PDO' not found in /var/www/html/lib/rb.php on line 45
It fails trying to new up a PDO class in the RedbeanPHP 3.0 lib.
How can I fix this missing PDO problem?
I tried to follow these instructions:
from http://www.computingunplugged.com/issues/issue201102/00002619002
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# THIS LINE FAILED FOR ME
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-6.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
UPDATE
Someone removed their answer. It was good. I'm putting it back in with exact steps.
First I had to yum install php53u-devel
To quote "
You need the PDO extension. Usually the best way to install extensions is via PECL.
Before you can install any PECL extensions you need to install the php5-dev package
sudo pecl install pdo
sudo pecl install pdo_mysql
You then need add the following to the end of your php.ini file(s). Depending on which version of PHP you installed they’ll be /etc/php5/apache2/php.ini, /etc/php5/cgi/php.ini and /etc/php/cli/php.ini.
extension=pdo.so
extension=pdo_mysql.so
"
Now I get a mysql_query_missing when trying to run sudo pecl install pdo_mysql
and not sure how to get past this.
You'll have to install the php-pdo package as well.
Edit: Maybe this helps as well: How do I enable PDO using CentOS?
I have been successfully able to install PHP-5.3 on CentOS 5.4 Linux. I needed this to be able to successfully install and run Drupal 7 - which also worked out for me. Here are the details:
This is a copy of the answer I wrote up in ServerFault: https://serverfault.com/a/392168/29205
(...for my question: https://serverfault.com/questions/391772/php-xml-install-complains-of-dependency-php-common-but-this-is-already-installed/392168#392168 )
The solution is based on the accepted answer in:
https://serverfault.com/questions/391839/how-to-force-centos-yum-to-use-a-later-version-of-a-package-dependency-already-i
In summary: move to php5.3.
Reason: support for php5.2 as been removed owing to security issues as explained in that other question's accepted answer. This removal causes mismatch of the versions of the dependencies and therefore the error seen.
Background
I wanted to run Drupal 7 on a CentOS 5.4 machine. So I needed 5.3 version of PHP.
Here are the full working steps to upgrade to PHP 5.3 with working repositories as of May 24 2012 ( I provide comments preceded by # - you don't need these, just for your info)
# Comment: sites like http://www.computingunplugged.com/issues/issue201102/00002619001
# provide a good start for remedying the problem whereby we need 5.3 on CentOS 5.4 to run Drupal 7. But although their packages worked at the time, the links are now outdated, and updates to these are below.
# comment: (as of May 2012 - the following work, the reason for failures was use of 1) older packages no longer on the server and 2) change of address of one of the servers to dl.fedoraproject.org/pub/epel (credit to: http://osdir.com/ml/centos/2012-03/msg00057.html )
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
# After doing the above, php -v shows 5.3.x But on attempting to install Drupal 7 you may get complaint of something "Your PHP installation is too old 5.1.6 Drupal requires at least PHP 5.2.4. See the system requirements page for more information." and php.info shows the same
# The remedy is to simply restart your apache server
service httpd restart
# credit to following for suggesting service httpd restart :-
# https://serverfault.com/a/207806/29205
# https://serverfault.com/questions/207762/centos-updating-php-via-yum-doesnt-change-the-version-apache-uses
# Drupal 7 install on CentOS 5.4 worked after applying the above steps
# If your MySQL server is not running (check by ps -ef | grep mysql ) then you can run:
/etc/init.d/mysqld
# ...to start it, and to make sure it starts when the machine is restarted or cold booted:
chkconfig mysqld on

Categories