want to install php7-devel for php7.1 on centOS - php

centOS 7, when I try
yum install -y php7-devel
I got No package php7-devel available.Error: Nothing to do.
I want use php-x, it say I should install php7-devel. Anyone advice?

need to add yum repo. in my case i am using Webtatic repo.

what php yum rep you select?
i recommend remi php repo https://rpms.remirepo.net/
i can find php-devel in my vm
>
xxxx git:(change_format) ✗ yum search php70-php-devel
rh-php70-php-devel.x86_64 : Files needed for building PHP extensions

Which is you current PHP provider ?
CentOS provides PHP 5.4, and package name is php-devel
For more recent version, official solution (from Red Hat) is to use Software Collection which provide php 5.6, 7.0 and 7.1 which can be installed beside default version (without altering the base system).
You can read PHP Configuration Tips. In this case, package name is rh-php71-php-devel
Else you have to use some 3rd party repository.
Mine being a solution (dedicated PHP repository, with most extensions already packaged), see the Configuration Wizard. In this case, package name is php-devel (with the simplest "Single version" installation).
P.S. php-x not there for now, as I don't need it, no other extension use it.

Related

How to add php 7 extensions using remi on CentOS 7

Please help with php 7 extensions on CentOS 7.
When trying to isntall extension, for example memcache and memcached using the command yum --enablerepo=remi-php74 install php-memcache php-memcached I got the message that this packages are already installed.
php --modules also shows they are present. But I can't find them in /etc/opt/remi/php74/php.d and /opt/remi/php74/root/lib64/php/modules.
I attached screenshot of phpinfo() as well phpinfo, there are no additional extensions...
Please advice what I'm doing wrong, I'm not very strong in this DevOPS things :-)
Also added php --ini response php --ini
For a proper installation please follow the Wizard instructions
If you need a single version, php-* packages are simpler to install and use
If you need multiple versions, php74-php-* are available
You can read the repository FAQ: Difference between php-* and php##-php-* packages ?
So as you are running php74-php you need
yum install php74-php-pecl-memcache php74-php-pecl-memcached
But if you need a single version, probably better to remove all php74* packages and only use php-* ones.

I can not find a repository for CentOS 6.6 containing the PHP MySQL Native Driver (mysqlnd)

Recently I have decided to switch to the MySQL Native Driver for PHP: http://php.net/manual/en/book.mysqlnd.php
I am using CentOS 6.6 and I couldn't find a repository containing the php-mysqlnd. The default repositories does not include it. I do not want to recompile PHP from scratch since I have cPanel on top and I just don't want to mess up with it. Currently I just want to switch from php-mysql to php-mysqlnd and that's all.
What I have tried so far:
yum remove php-mysql
then
yum install php-mysqlnd
this has ended with:
No package php-mysqlnd available.
Error: Nothing to do
Then I have tried to add repositories like remi and webtatic. Neither of them worked.
Does any one knows a repository containing the php-mysqlnd?
cpanel is too much altered, cannot be considered as CentOS anymore.
cpanel provides its own PHP stack, so none of the 3rd party repo will be able to help you.
You should contact cPanel support.

How is PHP installed when you use yum or apt-get

I always get this weird questions about how stuff works behind the scenes. I know how to compile php from source, and I know that if you compile it from source and forget to add a module/library you need to re-compile php to add it. However, if you install php lets say using yum, and then you want to add another extension, you just need to install that extension. For example, today I was working on a recently installed Fedora 18 machine, and php was missing the DOM library, which is weird, since that library is enabled by default. It seems like yum installs php with that extension disabled. Anyway, since it was missing, I had to do this:
sudo yum install php-xml
And that solved the problem, but it made me wonder, how is the installation process in this case? Is php re compiled? and if so, how does it remember all the other extensions that may have been added before? Or is the xml extension installed separately and somehow linked into php?
I haven't found any info about this, and I'm really curious as to how it works.
When you install php extension packages using a package manager like yum or apt-get, the repositories have the already compiled so extensions for the version of php that came with the system. For example, if you're on Ubuntu 12.04, and you do a apt-get install php-mysqlnd, it fetches the deb package from the repository which contains the pre-compiled mysqlnd.so and a default mysqlnd.ini. This works because the deb package has the compiled version according to the default dependencies that are installed for the 12.04 release. If some dependencies are missing, the precompiled deb packages are fetched for the same, thus eliminating the need for configuration and make. This make it a lot faster and easier. Almost plug and play!
You can build extensions separately, you don't have to rebuild your php every time you need to add a new extension, you just need to define the extensions that needs to be loaded under [extensions] in your php.ini.
When your building php you can specify which extensions you need to be statically (included) in the php binary vs which once you want as a shared library.
configure --enable-http=static --with-openssl=shared
// http extension will be included in PHP
// openssl extension will be compiled as separate DLL
Yum connects to repositories of pre-compiled rpm's. Yum will download the rpm and its dependencies and install them.
Yum will use different repositories for different OS's. For example Fedora 18 has a different repostitory of pre-compiled rpms then Fedora 17 would have.
Yum is just a glorified dependency management system

Cannot Install any PHP PECL through Cpanel (WHM) or SSH

When I try to install a module through PHP PECL through cpanel or whm (CENTOS 6.3 x86_64 / WHM 11.34.0 (build 7) ) I always get this result:
ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed The
Imagick.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
Here in another example with html_parse:
ERROR: `/root/tmp/pear/html_parse/configure --with-ekhtml' failed The
html_parse.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
I have googled it, done the suggestions and always the same result.
What library are you trying to install?
I've found mixed results using pecl on Redhat, centos, or fedora machinces if I've ever used yum to install their versions of PHP libs. The easiest way around your issue would be to look to see if it's in the Yum repo and install it that way:
yum search 'modulename'
yum install 'packagename'
I usually just do a yum search php and scan down the list of modules.
If you want to use pecl or can't because the libraries aren't part of yum, I'd remove the natively included version and build your PHP from scratch. You can remove PHP and related libraries installed with the distro via yum as well.
I have a similar server setup and I needed pecl_http. Instead of using WHM (Home »
Software » Module Installers) I used command line. Simply typed: pecl install pecl_http
It should be the same for other modules like the html_parse, just change the module name, like: pecl install html_parse
Figured I'd add this for anyone else looking for this info.

Installing PEAR

phpinfo() function shows that my PHP version (5.1.6) is installed --without-pear in the configure command section.
How do I install pear?
The Getting and installing the PEAR package manager page should help you : it gives informations on how to install the PEAR package manager, on both windows, Linux, and Mac.
Basically, if your Linux distribution comes with a PEAP package, you should install it.
For instance, on Ubuntu1, there is a php-pear package ; so, you'd use :
apt-get install php-pear
Else, if it doesn't, with a version of PHP >= 5.3, you should be able to use this :
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
With PHP 5.1, though, this is not going to work, as phar support has been added in PHP 5.3...
As a sidenote : PHP 5.1 is really outdated !
PHP 5.3 is more than one year and a half old ; even PHP 5.2 is not maintained anymore... maybe you should consider upgrading ?
1It seems you are running some kind of Redhat-based distribution, but I don't have one of those, so I cannot say if there is a PEAR package for it -- there is probably one, though.
--without-pear only means that the PEAR bits were not immediately created when PHP was compiled.
This usually happens when an operating system vendor that provides packages and wants to split off bits and pieces into their own individually installable parts.
Given the age of the PHP you're talking about, you're probably on RHEL or a derivative like CentOS. Check the package manager for a php-pear package.

Categories