Centos 8, PHP 7.2 and MS Sql Server - pdo

I am planning moving on to the Centos 8 but it seems that I cannot get a working PDO connection with SQL server using just plain Centos 8 packages.
I have installed the unixODBC packages and after that from PECL sqlsrv and sqlsrv_pdo but I can't figure out how to make the actual connection or odbc configuration.
As most of my code to be transferred to the new environments is written using PDO, I wouldn't want to change it to sql server native.
Are there any step-by-step instructions how to build PDO ODBC connection to sql server without using freetds, which isn't available through the centos repositories (or RHEL either).

I faced the same issue and I solved it as follow:
sudo dnf install php-pear
sudo dnf install php-devel
sudo dnf install make
sudo pecl install sqlsrv
sudo dnf install unixODBC-devel
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
then:
sudo nano /etc/php.d/30-pdo_sqlsrv.ini
Add in the file 30-pdo_sqlsrv.ini:
extension=pdo_sqlsrv.so
then:
sudo nano /etc/php.d/20-sqlsrv.ini
Add in the file 20-sqlsrv.ini:
extension=sqlsrv.so
Download and install msodbcsql17-17.4.2.1-1.x86_64.rpm from https://packages.microsoft.com/rhel/8/prod/
sudo yum install msodbcsql17-17.4.2.1-1.x86_64.rpm
Then just need to restart php-fpm
sudo systemctl restart php-fpm.service
Good luck!

Related

lampp php5.6 install redis via pecl

I need to install redis on my lampp(php5.6.40) via pecl in mint 20
cd /opt/lampp/bin
sudo ./pecl install redis
but I got an error :
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/redis requires PHP (version >= 7.0.0), installed version is 5.6.40
can you help my to solve this issu, I need install redis on php5.6 because my project required php5.6 .
phpredis 5.x.x are drop PHP5 support
https://pecl.php.net/package-changelog.php?package=redis
try old version install.
pecl install redis-4.3.0

How to install gearman extension in php7 running on ubuntu 18.04

I am currently required to setup the new server running php7.2 and the server will have many background process for sending emails to customer. the recommendation I got was to use Gearman Job Server.
I have been searching but seems to have only post about gearman-job-server with php5 and below.
The process of installing Gearman Job Server with php7 will be covered in like 4 steps
Install and update the Gearman PPA
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:gearman-developers/ppa
sudo apt-get update
Install Gearman Job Server and some other required components and tools
sudo apt-get install gearman-job-server libgearman-dev php7.0-dev php-pear wget unzip re2c
sudo apt-get upgrade
Download, compile the gearman pecl module and add to php.ini
cd /tmp/
sudo wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
cd pecl-gearman-master
sudo phpize
./configure
sudo make
sudo make install
echo "extension=gearman.so" | sudo tee /etc/php/7.0/mods-available/gearman.ini
sudo phpenmod -v ALL -s ALL gearman
Restart webserver or PHP FPM
sudo service php7.0-fpm restart
sudo service apache2 restart
If you are running a different version of PHP make sure you make the appropriate changes to the commands or directories mentioned above. ie “/etc/php/7.0/” to “/etc/php/7.1/” etc.
Thanks to techearl.com for their tutorial which can be found
Here
The answer by Ruberandinda Patience is correct and will work but since the gearman pecl module is packaged for Ubuntu there is a much simpler way to achieve the same thing:
apt install gearman-job-server php-gearman

Weblogic server installation in Ubuntu 16.04

my setup,
am using virtual box vm for installation of weblogic server fmw_12.2.1.1.0_wls.jar on top of Ubuntu 16.04 server
installed oracle java using
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
now java is installed in /usr/lib/jvm/java-8-oracle/jre/bin/java and i have set java_home = /usr/lib/jvm/java-8-oracle
have placed the file fmw_12.2.1.1.0_wls.jar in /usr/lib/jvm/java-8-oracle
when trying to install weblogic server from /usr/lib/jvm/java-8-oracle using java -jar fmw_12.2.1.1.0_wls.jar it fails with the error message as
preparing to launch the oracle universal installer from /tmp/OralInstall2016
Exception in thread "main" java.long.UnsatisifiedLinkError: /usr/lib/jvm/java-8-oracle/jrelib/amad64/libawt_xawt.so:libXender.so cannot open shared object file: no such file or directory
Please advise
You're missing pre-requisites. Perhaps there are more, but the one you're referred is because of missing X-Windows subsystem. Easiest just to invoke:
$ sudo apt install -y xterm
I hope it will help,
Jarek

phpredis extension doesn't work, unable to load 'redis.so'

I installed nginx, php, php-fpm, php-pecl-redis by yum.
All of them work but the last one.
When I run /usr/sbin/php-fpm, I got this:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/redis.so' - /usr/lib/php/modules/redis.so: undefined symbol: igbinary_unserialize in Unknown on line 0
I don't know what igbnary_unserialize means and how to fix it.
I checked the redis.so file under right path. I add extension=redis.so to php.ini
PHP version: 5.3.3
PhpRedis version: 2.2.7
I had the same issue. I'm on Ubuntu 16.04 LTS. Running sudo apt-get install php-igbinary resolved the issue for me. I have other issues, but that's what solved this one.
For people who are upgrading their php from 7.0 to 7.4 like me, and not able to get php-redis working. These are the steps I used after following the answers above.
1) remove Redis
sudo apt purge php-redis
2) Install Igbinary
sudo apt-get install php-igbinary
3) Install php-redis again
sudo apt-get install php-redis
I did the steps above because it seems only php7.0 is recognising the php-redis install but not the currently enabled php7.4
I also recommend removing other versions of PHP if you have should your problem continue unsolved.
Probably an issue with igbinary, is this installed? (try for example: cat /etc/php.d/igbinary.ini).
Here you can find and install igbinary
Related to this bug https://bugs.launchpad.net/ubuntu/+source/php-redis/+bug/1762935
You should remove php-redis from packages:
apt purge php-redis , and install it via pecl install redis
You should add "extension=redis.so" to php.ini
and remove redis from config.d in your php directory:
rm /etc/php/7.2/fpm/conf.d/#20-redis.ini
and
rm /etc/php/7.2/cli/conf.d/#20-redis.ini
restart php fpm and you will see that problem solved
On Ubuntu 20 and PHP 7.4
I did this and it worked :
sudo apt purge php-redis
sudo apt intall php-redis php7.4-redis
TEST redis server :
$ php --ri redis
or
$ redis-cli ping
$ redis-cli info stats
just resolve the same problem:
php-pecl-redis installed by yum will cause this problem.
so you need to install the php-redis manually. wget the package and phpize - configure - make ....

mCrypt not present after Ubuntu upgrade to 13.10

After I have upgraded my system from Ubuntu 13.04 to 13.10 several problems have occurred with apache, mysql and php configurations.
I solved most of them but I can't seem to get mCrypt library working.
Package is installed so i don't need to apt-get it. Server works and everything seems fine, but when I try to run php artisan serve with Laravel 4, I get a message that mCrypt is required.
I did php --ri mcrypt and the output was Extension 'mcrypt' not present.
I have tried putting extension=mcrypt.so to /etc/php5/apache2/php.ini but it didn't work.
Any ideas?
Output of dpkg --get-selections | grep php5
libapache2-mod-php5 install
php5 install
php5-cli install
php5-common install
php5-gd install
php5-json install
php5-mcrypt install
php5-mysql install
php5-readline install
I think I found the solution at launchpad.net.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart
This worked for me.
I had this problem with Ubuntu 14.04 and I did the following to resolve it:
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
I also have this problem with Ubuntu 14.04 after install.
First enable the mcrypt
sudo gedit /etc/php5/apache2/php.ini
Add this command in any line
extension=mcrypt.so
Create conf.d folder in /etc/php5
sudo mkdir conf.d
And inside that folder create mcrypt.ini file
sudo gedit mcrypt.ini
Then add this command to that file
extension=mcrypt.so
Then create a link to file
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
Enable mcrypt module
sudo php5enmod mcrypt
Restart apache
sudo service apache2 restart
From Ubuntu 13.10 to 14.04:
sudo php5enmod mcrypt
sudo service apache2 restart
Works for me.
I also had this problem with Ubuntu 14.04 and Nginx,but the tip for me was restart the FPM service, so I did:
Install the library
apt-get install php5-mcrypt
Find the path
updatedb && locate mcrypt.so
Set the path of mcrypt.so inside the mcrypt.ini file located in /etc/php5/mods-available/mcrypt.ini
extension=/usr/lib/php5/20121212/mcrypt.so
And then restart the FPM service
service php5-fpm restart
Another solution if the package is already installed:
sudo aptitude reinstall php5-mycript
This worked for me after doing upgrade
Try this code:
ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
service apache2 restart
I had the same problem with PHP 5.5.14 running on Mac OS X Yosemite. I was trying to install Laravel 5.0. And when I tried to create a new project I got an error like below (even when I tried to start the laravel server with php artisan serve
Alejandros-MacBook-Pro:Documents Lexynux$ laravel new blog
Crafting application...
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Generating optimized class loader
Compiling common classes
Compiling views
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Application key [CCOPocoMjnJTx4AFXk64wqyTKyo3BlHq] set successfully.
Application ready! Build something amazing.
Alejandros-MacBook-Pro:Documents Lexynux$
So I just added the line below at the end of my php.ini file with the nano editor:
extension=mcrypt.so
sudo nano /etc/php.ini
Finally just restart the Terminal and restart the laravel app server with
php artisan serve
And it works fine!
just found on php.net
Note, for Ubuntu, simply installing php5-mcrypt did not get mcrypt to work. You need to execute the following commands as root to enable it:
apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart
http://php.net/manual/en/mcrypt.installation.php#114609
Sometimes, this "problem" occurs because you entered an artisan command on your local machine instead of on your virtual machine. If you are using Homestead, mcrypt is already installed. Consider it a reminder to homestead ssh