Installing php-ldap on CentOs - php

I have an unmanaged VPS server preinstalled with CentOs 6.6 and WHM/CPanel. I am trying to install php-ldap but it just says package not found. I have not been able to find anywhere what repository it should be in. How can I install ldap on my server to work with php 5.4? I am trying to manage Windows Server 2012 R2 Active Directory.
root#vps [~]# yum install php-ldap
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.5ninesolutions.com
* epel: fedora-epel.mirror.lstn.net
* extras: centos.arvixe.com
* updates: pubmirrors.dal.corespace.com
No package php-ldap available.
Error: Nothing to do
root#vps [~]#

On a cpanel serveur you probably have an "exclude" line in yum.conf (see I can't install any package related to PHP with yum) which prevent you to install/upgrade php from another repository.
To see the provider of "php", user this command
rpm -qf $(which php)
And the ldap extension, if available will be in the same namespace.
Notice switch the php stack from the cpanel provider to another repo can break it.

You need to understand that the base repos typically don't contain boutique builds for PHP. Your best bet is to install a different repo, like the Remi repo, which does contain that RPM.
While I'm at it, PHP 5.4 went End-of-life 4 days ago. Remi offers 5.5 and 5.6 so you should consider upgrading

Get the php version you are running by
php -v
if not worked try
rpm -qa |grep php
if the php version is 5.4 then use
sudo yum install php54w-ldap
if 5.6
sudo yum install php56w-ldap
and so on.

Related

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).

How to install php55-php-mcrypt with scl-utils?

It's a known fact that on Fedora/RHEL/CentOS 7.x based systems PHP 5.4.16 is the supported version. However, for my application I needed PHP 5.5 and I installed it from RHEL-recommended scl-utils repository as explained on https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/scl-utils.html
The problem is that I have successfully installed all required packages except php55-php-mcrypt:
yum install php55-php-mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.sonic.net
* epel: mirror.hmc.edu
* extras: mirror.keystealth.org
* updates: mirrors.easynews.com
No package php55-php-mcrypt available.
Error: Nothing to do
Could anyone recommend a way to get this package installed?
Explanation why "mcrypt" is a very bad idea, and is not part of standard repository : About libmcrypt and php-mcrypt
For people who want to use the official RHSCL packages on RHEL (which is also available in centos-scl repository), you can find additional packages in the community repositories:
php55 => php55more
rh-php56 => php56more
Else, yes my repository is an alternative, see the Configuration Wizard
Switch to the Remi repo. It has 5.5, 5.6 and 7.0 available and they are supported as long as the PHP project supports them. Better still, he breaks that support into separate repos, so you pick the one you want and install the php-* RPMs. When you're ready to upgrade, enable the next repo and just yum update.
RPM of PHP version 7.0.2 are available in remi-php70 repository for Fedora and Enterprise Linux (RHEL, CentOS).
RPM of PHP version 5.6.17 are available in remi repository for Fedora ≥ 21 and remi-php56 repository for Fedora and Enterprise Linux.
RPM of PHP version 5.5.31 are available in remi repository for Fedora 20 and in remi-php55 repository for Enterprise Linux.

I can't install any package related to PHP with yum

I can't install any package related PHP, I get a yum error: No package php available.
My PHP version is 5.4.37 on Centos 7. I installed remi for other purposes and I think that the repository is not compatible with PHP version but I don't know how to fix it.
[root#server ~]# sudo yum install php php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centosmirror.netcup.net
* epel: mirrors.n-ix.net
* extras: centosmirror.netcup.net
* remi: mirror5.layerjet.com
* remi-safe: mirror5.layerjet.com
* updates: centosmirror.netcup.net
No package php available.
No package php-pear available.
Error: Nothing to do
You have, in yum configuration:
exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* ftp exim* sendmail* php* bind-chroot*
This is very probably a "panel" enabled server (cpanel or others), which provides its own PHP stack.
So by design, you cannot install "php*" packages from standard repository or any other 3rd party repository. Such distribution is so altered, that it is often considered as "Not CentOS".
So, better to ask your php stack provider for how to update it (if possible, without breaking the panel application)
As suggested in other answer, this may be related to excludes set in yum.conf
The command below allows to run the installation of excluded packages without modifying the conf file:
yum --disableexcludes=main install php
BUT
It seems like it might be better to re-install PHP by the means of the control panel installed. IE Cpanel - EasyApache..

Laravel Is php-mcrypt necessary for https and Auth?

Everything is in the title : can I use https and the Auth:: class whithout having installed php mcrypt ? (I'm on a redhat enterprise linux 6.1 on architecture s390x, it's just impossible to find pre-compiled packages).
If it's possible then I would just use Laravel whithout Mcrypt...
mcrypt is a requirement of Laravel, you simply cannot run a laravel app without having mcrypt installed.
The following link may help with installing mcrypt:
http://injustfiveminutes.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
Excerpt:
The php-mcrypt extension is not available on Redhat Enterprise Linux 6
although some applications such as Magento or phpMyAdmin require it to
work properly. We can easily install it though from the Fedora Project
repositories.
1) Download the following RPM pacakges:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-1.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
2) Install them using YUM:
$ yum localinstall php-mcrypt-5.3.3-1.el6.x86_64.rpm
$ libmcrypt-2.5.8-9.el6.x86_64.rpm
3) Reload Apache server to load the extension up:
$ service httpd restart

Install libssh2-php on PHP 5.4.9 (x64)

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

Categories