Solved

Switching to remi breaks mvc/yii app on a Centos7 server

Posted on 2016-07-24
9
50 Views
Last Modified: 2016-07-31
I switched over to remi 5.6 from Centos php 5.4 on a centos7 server. Everything worked perfectly before the change over so it would not seem to make sense that there is a code error. I got everything working but an mvc/yii app which is having trouble.
I believe I fixed this once on another server simply by adding a missing package. However, which, I cannot recall at this point.
If memory serves, it was related to the php-mysql package which I replaced with php-mysqlnd since the php-mysql package is deprecated with 5.6.

PDOException: SQLSTATE[HY000]
General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().
Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. (uncaught exception) at /var/www/vhosts/myapp/client_php/src/Service/ClientService.php line 51 {"exception":"[object]

PDOException(code: HY000): SQLSTATE[HY000]
General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().
Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. at
/var/www/vhosts/myapp/client_php/src/Service/ClientService.php:51)"} []

Open in new window


# yum list installed | grep "remi"
gd-last.x86_64                        2.2.3-1.el7.remi               @remi
libzip-last.x86_64                    1.1.3-1.el7.remi               @remi
memcached.x86_64                      1.4.29-1.el7.remi              @remi
php.x86_64                            5.6.24-1.el7.remi              @remi-php56
php-bcmath.x86_64                     5.6.24-1.el7.remi              @remi-php56
php-cli.x86_64                        5.6.24-1.el7.remi              @remi-php56
php-common.x86_64                     5.6.24-1.el7.remi              @remi-php56
php-devel.x86_64                      5.6.24-1.el7.remi              @remi-php56
php-gd.x86_64                         5.6.24-1.el7.remi              @remi-php56
php-gmp.x86_64                        5.6.24-1.el7.remi              @remi-php56
php-intl.x86_64                       5.6.24-1.el7.remi              @remi-php56
php-mbstring.x86_64                   5.6.24-1.el7.remi              @remi-php56
php-mysqlnd.x86_64                    5.6.24-1.el7.remi              @remi-php56
php-opcache.x86_64                    5.6.24-1.el7.remi              @remi-php56
php-pdo.x86_64                        5.6.24-1.el7.remi              @remi-php56
php-pear.noarch                       1:1.10.1-5.el7.remi            @remi
php-pecl-apcu.x86_64                  4.0.11-2.el7.remi.5.6          @remi-php56
php-pecl-jsonc.x86_64                 1.3.10-1.el7.remi.5.6          @remi-php56
php-pecl-jsonc-devel.x86_64           1.3.10-1.el7.remi.5.6          @remi-php56
php-pecl-memcache.x86_64              3.0.8-4.el7.remi.5.6           @remi-php56
php-pecl-zip.x86_64                   1.13.4-1.el7.remi.5.6          @remi-php56
php-php-gettext.noarch                1.0.11-12.el7.remi             @remi
php-phpseclib.noarch                  2.0.2-1.el7.remi               @remi
php-process.x86_64                    5.6.24-1.el7.remi              @remi-php56
php-recode.x86_64                     5.6.24-1.el7.remi              @remi-php56
php-symfony-class-loader.noarch       2.8.8-1.el7.remi               @remi
php-symfony-common.noarch             2.8.8-1.el7.remi               @remi
php-tcpdf.noarch                      6.2.12-1.el7.remi              @remi
php-tcpdf-dejavu-sans-fonts.noarch    6.2.12-1.el7.remi              @remi
php-tidy.x86_64                       5.6.24-1.el7.remi              @remi-php56
php-xml.x86_64                        5.6.24-1.el7.remi              @remi-php56
remi-release.noarch                   7.2-1.el7.remi                 @remi

Open in new window

0
Comment
Question by:projects
  • 5
  • 4
9 Comments
 
LVL 61

Assisted Solution

by:gheist
gheist earned 500 total points
ID: 41727394
REMI is known to break stuff. That is well documented on REMI and CentOS websites.
The fix is to revert back to working CentOS PHP and experiment with SCL PHP
1
 

Author Comment

by:projects
ID: 41727728
I've held back going to remi to get 5.6 for a long time but now need to because of the security changes in 5.6 so going back isn't really an option otherwise would never have even bothered with this :).

Also, I fixed this before so what ever the issue was, it wasn't all that big but I don't seem to have kept notes on what it was or how to fix it.

I'm not sure what you mean by this is well known. What is? That REMI breaks stuff or that 'what ever you're telling me the error is known as' is well documented somewhere? How well known could it be, I've been trying to find out more about it for hours but mainly am finding programming posts.

This 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY' suggests programming but I fixed this without any programming changes before.

BTW, the mvc/yii app is using composer which I suspect is where the problem is related to if memory serves. Last time, I seem to recall having to rebuild the modules or re-install or configure them, something along those lines.

 php composer.phar install --prefer-dist -o --no-dev

This won't run because it cannot find composer.phar
0
 

Accepted Solution

by:
projects earned 0 total points
ID: 41728107
I gave up and went back to Centos 5.4. It's not worth the headaches. I'll build another server to test this in the near future.
0
 
LVL 61

Expert Comment

by:gheist
ID: 41734907
Good luck...
Start with migrating to php-fpm, that way the replacement can be tested on same machine.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Closing Comment

by:projects
ID: 41736372
What ever the reasons are, I don't have time to look for them on a live server. This will have to be done on a dev server.
0
 
LVL 61

Expert Comment

by:gheist
ID: 41736628
Should not take more than 5 minutes to configure desktop virtual machine with 1GB RAM ;)
0
 

Author Comment

by:projects
ID: 41736632
I have pre-made templates so even less :)
0
 
LVL 61

Expert Comment

by:gheist
ID: 41736656
Take your time, make a new template.
You can have different FPM-s with different PHP versions on your server. https://www.softwarecollections.org/en/scls/?search=php
0
 

Author Comment

by:projects
ID: 41736684
Yes, we did that at one point but it was too complicated to maintain when there are multiple admins.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now