My terminal shows php version as
[root#localhost modules]# php -v
PHP 5.6.25 (cli) (built: Oct 21 2016 17:57:17)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
and when I check for mbstring extension for php with php -m command I get
but when i check with yum list installed php* i get this
php-mbstring.x86_64 5.6.30-1.el6.remi #remi-php56
when I check with phpinfo() I get result as
1) i get related result in Additional ini file parsed section as
I try with new installation of php56w-mbstring also then also same problem.
Diagnostic
1/ find which php command is used:
which php
2/ find which package provides this command
rpm --query --file $(which php)
If this fails, this probably means you are using a manually installed PHP version, built from sources, usually in /usr/local.
Installation
As, in your case php is provided by rh-php56-php-cli, you need to install needed extensions, from the same repository (centos-sclo) and in the same namespace (rh-php56):
yum install rh-php56-php-mbstring
Its small mistake here...
In my setup there are two version for php
1)php with apahce and
2)php cli
[root#localhost modules]# which php
/opt/rh/rh-php56/root/usr/bin/php
[root#localhost modules]# find / -name php.ini
/opt/rh/rh-php56/register.content/etc/opt/rh/rh-php56/php.ini
/etc/opt/rh/rh-php56/php.ini
/etc/php.ini
here i select /etc/opt/rh/rh-php56/php.ini and after this check for mbstring in terminal by i fine mbstring.so file
as
[root#localhost modules]# find / -name mbstring.so
/usr/lib64/php/modules/mbstring.so
/usr/lib64/php-zts/modules/mbstring.so
with gedit /etc/opt/rh/rh-php56/php.ini i added that extension and related path with it as
extension=/usr/lib64/php/modules/mbstring.so
after that check with
php -m
now i get mbstring with this command.
Related
I'm trying to install Magento (2.3.0) on macOS Mojave. Magento shows PHP Extension intl. is missing.
I tried the below to resolve:
Made a copy of php.ini using cp /etc/php.ini.default php.ini
Removed ";" before extension=php_intl.dll
Restart Apache sudo apachectl restart
But the above did not resolve.
On checking php -v, i'm seeing the below error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll,
0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-
non-zts-20160303/php_intl.dll in Unknown on line 0
PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
There are only 2 files under /usr/lib/php/extensions/no-debug-non-zts-20160303 namely opache.so and xdebug.so
How can i install or enable "PHP Extension intl" on my macOS Mojave?
Here's a solution that worked for me:
Find all PHP versions installed brew list | grep php
Remove all versions of PHP brew remove --ignore-dependencies --force php70 php71 php72 (based on what you see above)
Install PHP brew install php72 (i chose 7.2, 7.3 is not supported yet by several vendors)
Run the command which php should show you the path to the installed PHP. Copy the path.
Update your bash_profile vi ~/.bash_profile and add this line to the file:
export PATH=/usr/local/php5/bin:$PATH
Save and run this source ~/.bash_profile
Check if PHP Intl Extension is installed using php -m | grep intl. If the installation went well, we will see intl listed. If not the extension is not installed.
I think from PHP 7 (not sure of the version), the extensions are available by default and we need not enable them in php.ini file explicitly.
If you installed Homebrew's php, linking it to a directory in your path will fix the issue.
brew link --force php#7.3
I had the same issue and that fixed it.
Here is a link where I got a detailed answer from
Got help from the link and able to compile https://donatstudios.com/Install-PHP-Mcrypt-Extension-in-OS-X
Next we will download the PHP source. Verify the exact version of PHP you are running. This can be retrieved as follows. The version is highlighted.
$ php --version
PHP 7.1.19 (cli) (built: Aug 17 2018 18:03:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Now we move into a working directory and download the source making sure to update the following for the version from above.
$ cd /tmp
$ curl -L http://php.net/get/php-{{php-version}}.tar.bz2/from/this/mirror > php.tar.bz2
$ open php.tar.bz2
Now we will compile and test the extension.
$ cd php-{{php-version}}/ext/{{extension}}
$ phpize
$ ./configure
$ make
$ make test
$ sudo make install
If all that goes well finally we'll need to add the following to our php.ini - I usually add at it at the end of the file.
extension = {{extension}}
.so
You can verify your installation with the following:
$ php --info | grep {{extension}}\\.
Lastly, depending on your setup now you may want to restart apache.
$ sudo apachectl restart
I have overlook at this issue Linux - PHP 7.0 and MSSQL (Microsoft SQL)
and I am sure did exactly what MS told me to do in this page
installing-the-drivers-on-red-hat-7
howevey, i stiil got the error when type 'php -v':
PHP Warning: PHP Startup: Unable to load dynamic library
'pdo_sqlsrv.so' (tried: /usr/lib64/php/modules/pdo_sqlsrv.so
(/usr/lib64/php/modules/pdo_sqlsrv.so: undefined symbol:
php_pdo_register_driver), /usr/lib64/php/modules/pdo_sqlsrv.so.so
(/usr/lib64/php/modules/pdo_sqlsrv.so.so: cannot open shared object
file: No such file or directory)) in Unknown on line 0
PHP 7.2.10
(cli) (built: Sep 15 2018 07:10:58) ( NTS ) Copyright (c) 1997-2018
The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend
Technologies
with Zend OPcache v7.2.10, Copyright (c) 1999-2018, by Zend
Technologies
I never modify the php.ini,
[user#tssvr php.d]$ pwd
/etc/php.d
[user#tssvr php.d]$ ls
20-sqlsrv.ini ctype.ini fileinfo.ini gmp.ini mbstring.ini pdo.ini shmop.ini tokenizer.ini xmlwriter.ini
30-pdo_sqlsrv.ini curl.ini ftp.ini iconv.ini mysqli.ini pdo_mysql.ini simplexml.ini xml.ini xsl.ini
bz2.ini dom.ini gd.ini intl.ini opcache-default.blacklist pdo_sqlite.ini sockets.ini xmlreader.ini zip.ini
calendar.ini exif.ini gettext.ini json.ini opcache.ini phar.ini sqlite3.ini xml_wddx.ini
[user#tssvr php.d]$ cat 20-sqlsrv.ini
extension=sqlsrv.so
[user#tssvr php.d]$ cat 30-pdo_sqlsrv.ini
extension=pdo_sqlsrv.so
it seems that the sqlsrv.so is good, but the pho_sqlsrv.so just can't work correctly,,although i notice that double 'so' appear: 'pdo_sqlsrv.so.so' ,
can any guys can help me through this ,many thanks.
Type in terminal linux centos 7 :
php --ini
find /etc/php.d/20-pdo.ini
Edit the file and append extension=sqlsrv.so extension=pdo_sqlsrv.so
note: comment extension extension=sqlsrv.so , extension=pdo_sqlsrv.so in /etc/php.ini
reboot system
php -m - you see loaded module
The proper order to load the modules is:
extension=pdo.so
extension=pdo_sqlsrv.so
extension=sqlsrv.so
One can either put these into one .ini file - or use numbered .ini files.
Loading them in alphabetical order (which is the default) won't work.
I ran into the same issue with Ubuntu 18.04 and 20.xx. I finally got it to work on Ubuntu 18.04 and pretty sure this will work on 20.xx as well.
This is for PHP 7.1 so if you are not using 7.4 or 8.0 you will have to specify the version in pecl.
pecl install sqlsrv-5.7.0preview
pecl install pdo_sqlsrv-5.7.0preview
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.1/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.1/mods-available/pdo_sqlsrv.ini
phpenmod -v 7.1 sqlsrv pdo_sqlsrv
service apache2 restart
The trick that got everything working was the printf and phpenmod command. You still need to add the extension to your php.ini file as well. Not sure if the order really matters but the driver does not appear to get installed properly using the pecl installer.
After restarting apache I can now see pdo_sqlsrv listed in php.ini and my php application can connect to the local Microsoft SQL server.
BTW, I got this working on WSL2 for Windows.
This is the way I solved this on CentOS 7.
First I've installed pdo_dblib extension
[root#localhost html]# yum list *dblib*
Complementos cargados:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.airenetworks.es
* centos-sclo-rh: mirror.airenetworks.es
* epel: ftp.uma.es
* extras: mirror.airenetworks.es
* remi-safe: mir01.syntis.net
* updates: mirror.tedra.es
Paquetes instalados
php73-php-pdo-dblib.x86_64
Paquetes disponibles
php70-php-pdo-dblib.x86_64
php71-php-pdo-dblib.x86_64
php72-php-pdo-dblib.x86_64
php74-pdo-dblib.x86_64
php74-php-pdo-dblib.x86_64
php80-php-pdo-dblib.x86_64
php81-php-pdo-dblib.x86_64
[root#localhost html]# yum install php73-php-pdo-dblib.x86_64
I have php 7.3 installed so I've chosen matching version extension. After installation, tried a simple test script I created to test connectivity but still got error.
Used locate command to find out if pdo_dblib.so library was correctly installed and found it under /opt/remi/php73/root/usr/lib64/php/modules path which looked a bit strange
With the command locate php.ini I discovered that there were 2 php.ini files on the machine. With the command php -i and by creating a simple file to test it from the web browser:
<?php
phpinfo()
I checked what php.ini file was in use both from Cli and from Apache. It was /etc/php.ini.
With php -m I saw PDO was loading correctly, so I searched the location of pdo.so library. Copied pdo_dblib.so library on previous search location. Searched for pdo_dblib.ini file and copied it under the location of pdo.ini file (which full name was 20-pdo.ini).
After all of these changes, restarted Apache systemctl restart httpd and checked again that pdo_dblib was loading both from cli and web whith php -i and the phpinfo() file.
I'm new to server and linux and I ran into some problems. I'm trying to update my PHP by looking for linux commands through the net. Some commands ran perfectly but some not.
I tried using this command to install php-gd since I have this error message 'Required GD library is missing'. So, I tried to run this below:
yum install php-gd
However, it give me this error message below:
php56w-common conflicts with php-common-5.3.3-46.el6_6.x86_64
Here are some info on my server:
[root#uat ~]# rpm -ql php
package php is not installed
[root#uat ~]# rpm -qa php\*
php56w-pdo-5.6.11-1.w6.x86_64
php56w-5.6.11-1.w6.x86_64
php56w-cli-5.6.11-1.w6.x86_64
php56w-common-5.6.11-1.w6.x86_64
php56w-mysql-5.6.11-1.w6.x86_64
[root#uat ~]# rpm -Va php\*
S.5....T. c /etc/php.ini
[root#uat ~]# which php
/usr/bin/php
[root#uat ~]# php -v
PHP 5.6.11 (cli) (built: Jul 10 2015 22:43:20)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Do you know what have I done wrong upgrading my php? Should I remove all php files on my server and reinstall? How?
Solved it by removing all php using "yum remove php php-common"
and modified the filename "remi.repo" under the folder /etc/yum.repos.d like below:
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
making sure that php56 is enabled=1.
You should run:
yum install php56w-gd
So when install php-extension have error:
*-common conflicts with php-common-5.3.3-46.el6_6.x86_64
Just type *-extension
Example:
yum install php-fpm have error
Error: php56u-common conflicts with php-common-5.3.3-46.el6_7.1.x86_64
then you should run
yum install php56u-fpm
The reason of this error is you install a php version don't match the system repo version. So yum get a version of the system repo, but this don't compatible with the php version you have installed. When you specific the php version, yum get the right version, so happy!
Go to /etc/yum.repos.d.
Remove the extra repository that you can see in your complete error message.
Nima
If you are using Centos 6.7 and have php 5.6 installed, the following command worked for me:
sudo yum install php56w-pecl-xdebug.x86_64 (I was installing xdebug, not GD)
I found this by running yum search php56
I would tring to update my php version to the version 5.5+ latest
When I'm looking via /usr/local/bin/php -v in the console I see the version 5.5+ and with php -v it tell me there is the version 5.4 installed.
How can I remove the older version 5.4 and install latest 5.5+ latest?
Typically I've used the PHP package from liip.ch
From terminal, run:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
It will not remove the default installation of PHP 5.4 from your system, but it does not have any impact on using PHP 5.5. They address the issue with php -v in their FAQ.
Prerequisites
Xcode and it's Command line utilities (install form preferences) will give you a gcc compiler to build the php with libjpeg, libpng etc. if you want to build with these.
OR run this command on terminal to install Command line tools
xcode-select --install
Building and installing php:
Download the distribution from www.php.net/downloads.php
Untar the archive and point your console into the location
Now, having still the original old php installed, run php -i | head in the console. What you want is to configure your new php with these flags to ensure you have proper pcre support and everything works just fine.
In the php source directory you untarred, run the ./configure script with the flags you just got
Build php by running make and sudo make install afterwards. That will actually replace the original php distributed with OS X.
Example sample run terminal commands:
Download latest version from http://php.net and after ruin below commands
tar -zxvf php_scource.tar.gz
cd php_source/
php -i | head
./configure --prefix=/usr --with-snmp # ... same flags as previous build
make
sudo make install
end of the workflow for building php and just check latest version from terminal commands
$ php -v
sample output of php -v
PHP 5.5.10 (cli) (built: Mar 27 2014 16:50:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
OSX Mavericks runs PHP from /usr/bin/php so in order to run the new version that you want from /usr/local/bin/php, you need to copy this file over to the /usr/bin directory. If you want to save your old version of php, first go to the /usr/bin directory
cd /usr/bin
and rename your old php file
sudo mv php php.old
Then go to the /usr/bin/local directory:
cd /usr/local/bin
and then copy the php file over to /usr/bin using sudo:
sudo cp php /usr/bin
OSX Mavericks has /usr/bin first in its environment path, so the php in /usr/bin is found before it gets to the php in /usr/local/bin. Once you copy your new php file over, when you run
php -v
Which will display something like:
PHP 5.6.23 (cli) (built: Jun 24 2016 21:08:07)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
It will have your new version that was installed at /usr/local/bin/php that you copied over to /usr/bin/php instead of version 5.4. If you're running Apache and want your webserver to also use the new php version, you'll also need to update the httpd.conf file to point at the new php_module, but that's a different question.
Now I have installed php 5.3.* via apt-get on my Ubuntu PC, but I need to work with 5.4.5 for some issue.
According to this reason, I try to compile and install new version php 5.4.5 with mongo driver into separete place:
I did next steps:
sudo su
cd /opt
tar xfz php-5.4.5.tar.gz
cd php-5.4.5
./configure --prefix=/opt/php545 --enable-phar --with-config-file-path=/opt/php545/php.ini
make & make install
after above commands I had got working php:
/opt/php545/bin/php -v
PHP 5.4.5 (cli) (built: Aug 15 2012 09:04:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
after it I did next:
/opt/php545/bin/pecl install mongo
and it return me
Build process completed successfully
Installing '/opt/php545/lib/php/extensions/no-debug-non-zts-20100525/mongo.so'
install ok: channel://pecl.php.net/mongo-1.2.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini
I added into /opt/php545/php.ini next line
extension=/opt/php545/lib/php/extensions/no-debug-non-zts-20100525/mongo.so
but mongo not loaded as module:
/opt/php545/bin/php -m | grep mongo
!!!Nothing here!!!
What did I do wrong?
PS:
/opt/php545/bin/php -i | grep php.ini
return
Configuration File (php.ini) Path => /opt/php545/php.ini
(php.ini seting up properly)
php config doesn't accept absolute path for extensions line, please use extension_dir.
Not load the extension from php.ini, load from ini file parsed as follows:
nano /usr/local/php-5.x.xx/php.d/mongo.ini
x.xx is you PHP version.
Then load the extension:
;Enable mongo extension module
extension=mongo.so
mongo.default_port=27017
save with ctrl + o and close white crtl + x
Then restart the services:
service php-fpm restart
service httpd restart
// php-fpm If it has
So you should already loaded.