Centos Yum Install Php Ldap

Posted By admin On 16.01.20

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. Installing PHP 5.6 on RHEL 6/7 and CentOS 6/7¶. Red Hat Enterprise Linux and CentOS 6 still ship with PHP 5.3. Nextcloud requires PHP 5.6 or better.

  1. Centos Yum Install Apache
  2. Centos 7 Install Php-ldap
  3. Centos Install Ldapsearch
  4. Centos 7 Enable Php Ldap
  5. Centos Yum Install Php Ldap Authentication
  6. Centos Yum Install Php 5.6
Active7 months ago

I 've a working production server that runs PHP 7.0, and I want to upgrade to 7.2.

I haven't found anything online that would suggest that PHP7.0 and 7.2 can co-exist. What would be the proper procedure? Just remove all php70w* packages and install all php72w ones?

This is a production server, errors must not cause it to fail.

Thanks.

Michael ChourdakisMichael Chourdakis

4 Answers

This is solution for CentOS 6.x and 7.x:

then install Remi repo, for Centos 6.x:

and for Centos 7.x:

check which PHP packages installed:

remove current PHP:

install same packages as were installed for 7.0 using PHP 7.2, for example:

check version of PHP installed:

You don't need to PHP 7.0 and 7.2 coexist on Your server. If You got a problem using PHP 7.2 You can always reinstall older PHP 7.0.If not sure it will work for You on production server, try it on virtual machine first. But it worked for me on many production servers. PHP is not critical OS component, so server will never fail if PHP changed. It's just Your web app which may fail when change to 7.2, but as I wrote it's unlikely and You may reinstall older version if it happens.

I forgot about php.ini. If You want to keep Your php.ini customizations in another PHP version, make a copy of php.ini before running yum remove php*. After PHP reinstall diff saved_php.ini php.ini and look what is need to be merged.

Michael Hampton
185k29 gold badges349 silver badges682 bronze badges
NoAngelNoAngel

Yes, you can install multiple versions of PHP simultaneously, without having to build anything, only using RPM packages.

This is exactly why Software Collections were designed.

See: PHP Configuration Tips (about switching to FPM and using software collections for recent and/or multiple php versions)

For PHP 7.2 collection, also see the Configuration wizard (and choose Multiple versions)

But, indeed, solution from @NoAngel also works if you think a single version is enough, especially if you have a test environment.

Remi ColletRemi Collet

Yes, you can keep multiple version at the same time. Now you have 7.0 on server so you can download source from php official website and build it to another location.

Also you can use mod_fcgid or php-fpm to execute your PHP web applications with new php version. You can refer below steps to build php from source.

  1. Download php source archive from php official mirror.
  2. Extract archive in your server and then change directory to extracted directory.
  3. Install dependencies required for build

yum install libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel libicu-devel gcc-c++ libxslt-devel net-snmp-devel readline-devel aspell-devel unixODBC-devel libc-client-devel freetype-devel libvpx-devel enchant-devel libmcrypt-devel krb5-devel libtidy-devel bzip2-devel

  1. Use below commands to configure and build PHP.

Centos Yum Install Apache

./configure --prefix=/usr/local/php --enable-mbstring --with-curl --with-openssl --with-xmlrpc --enable-soap --enable-zip --with-gd --with-jpeg-dir --with-png-dir --with-mysqli --with-freetype-dir --enable-intl --with-xsl --with-mcrypt --with-zlib --enable-bcmath --enable-dba --enable-calendar --enable-exif --enable-ftp --enable-pcntl --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-opcache --with-gettext --with-bz2 --with-mhash --with-readline --with-tidy --with-libdir=lib64 Php count all files in directory.

note : you can change prefix if want to change installation directory.

make && make install

Ldap

It will install PHP binaries and libraries to the prefix directory you mentioned in configure command.

  1. Now install mod_fcgid module in apache to use new version for php scripts executions

yum install mod_fcgid

create a file with name php-fcgi in cgi-bin directory(possible path is /var/www/cgi-bin), and add below content.

Assign execute permission to the cgi file.

Now you can use this handler to any virtualhost where you want to use latest PHP version.

Before doing this on production you must have to try it on local/dev system to avoid any unexpected errors. Also ./configure --help can help you to choose php modules you currently using on production server.

Vaibhav PanmandVaibhav Panmand

The Remi repo instructions are linked below. For example if you have CentOS version 7.4 then at the command line:

All future updates for PHP will be for version 7.2.

Todd LahmanTodd Lahman

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

hi i transfer my dedicated to another i put same version on it php 5.2.9 and ldap module installed but couldnt activate it on new server is there something i missing ?
server centos 5
OLD SERVER
root@Server1 [~]# rpm -qa grep php
php-ldap-5.2.2-3
php-common-5.2.2-3
---------------------------------------
PHP Version 5.2.9
System Linux my.server2.com 2.6.18-194.8.1.el5xen #1 SMP Thu Jul 1 20:25:56 EDT 2010 i686
Build Date Jul 16 2010 18:42:08
Configure Command './configure' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-dir=/opt/xml2/' '--with-mm=/opt/mm/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-pcre-regex=/opt/pcre' '--with-png-dir=/usr' '--with-ttf' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr' '--with-ldap'
-----------------------------------------
/usr/lib/php.ini

Centos 7 Install Php-ldap


extension=mod_ldap.so
NEW SERVER

Centos Install Ldapsearch


root@nc1 [/home/cpeasyapache/src/php-5.2.9]# rpm -qa grep php
php-ldap-5.2.2-3
php-common-5.2.2-3
---------------------------------------
PHP Version 5.2.9
System Linux my.server2.com 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:40 EST 2010 i686
Build Date Jan 5 2011 14:36:34
Configure Command './configure' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-dir=/opt/xml2/' '--with-mm=/opt/mm/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-pcre-regex=/opt/pcre' '--with-png-dir=/usr' '--with-ttf' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr'
-----------------------------------------
/usr/lib/php.ini

Centos 7 Enable Php Ldap

extension=mod_ldap.so
new server php info --with ldap missing.

Centos Yum Install Php Ldap Authentication


thanks in advance

Centos Yum Install Php 5.6

:-(