Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2   Go Down

Author Topic: PHP7 / MySQLi / PDO support in Coppermine?  (Read 58598 times)

0 Members and 1 Guest are viewing this topic.

Johnson.Wang

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
PHP7 / MySQLi / PDO support in Coppermine?
« on: December 07, 2015, 12:05:33 pm »

Now PHP7 has been released.

No more tranditional mysql_connect support in PHP7, cause Coppermine is not working in PHP7 environment.

Is there any plan to support mysqli or PDO in the futere Coppermine? If NO, I will leave Coppermine and try to find other photo gallery.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #1 on: December 08, 2015, 10:49:16 am »

Much of the work has already been done in the CPG1.6 branch on our new Git repository where a huge amount of effort has been put in creating a @database abstraction layer'. So the answer is yes, the future will allow both MySqli and PDO. It will be a while until 1.6 is released* but I do not see many hosts adopting PHP7 for quite some time yet.

*This is because the development team is relatively small. We are always on the lookout for anyone wiling to join and assist.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

cheigu

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #2 on: December 25, 2015, 12:08:33 pm »

For the mysql_connect support in PHP7, there is a library on http://sourceforge.net/projects/mysqlwithmysqli/ (usefull also for other projects and temporarly solutions)

cpg1.5.x has other problems with PHP7 and should not be used with it, altough the galery itself runs with the above mysql solution there are issues to solve in the admin section.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #3 on: December 25, 2015, 09:14:59 pm »

CPG1.6 is currently a work in progress which should support later versions of PHP. Currently very few outside testing environments are using PHP7 so it is not really an urgent matter.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Daggers

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #4 on: January 27, 2016, 07:54:28 am »

Just been forced by my service provider to upgrade to PHP7.0 or they will start to charge me to continue with the administration of PHP 5x, any news on the CPG1.6 release.

This is what I am now presented with after the PHP upgrade.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /homepages/18/d267387953/htdocs/include/functions.inc.php:183 Stack trace: #0 /homepages/18/d267387953/htdocs/include/init.inc.php(171): cpg_db_connect() #1 /homepages/18/d267387953/htdocs/index.php(26): require('/homepages/18/d...') #2 {main} thrown in /homepages/18/d267387953/htdocs/include/functions.inc.php on line 183
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #5 on: January 27, 2016, 01:13:18 pm »

Its coming... but certainly not today... (or tomorrow...)

For the mysql functions - I would look at the post from cheigu as a workaround - translates the mysql function calls to mysqli. I see no reason why that won't work with CPG.
For the mysql_connect support in PHP7, there is a library on http://sourceforge.net/projects/mysqlwithmysqli/ (usefull also for other projects and temporarly solutions)

cpg1.5.x has other problems with PHP7 and should not be used with it, altough the galery itself runs with the above mysql solution there are issues to solve in the admin section.

Just need to add an include for this script - adding something like this to the beginning of include/functions.inc.php:
Code: [Select]
if (!function_exists('mysql_connect')) {
    require 'mysql_mysqli.inc.php';         //* adjust to correct path based on where you placed the file...
}
EDIT: actually the 'if' logic isn't required - as the included file already checks and bypasses:
Code: [Select]
if(!is_callable('mysql_query')) {
END EDIT

The plugin API isn't yet initialized when the database connection is made (it needs DB info to initialize) - so no opportunity to add this logic via a plugin..


As for other requirements of PHP7 - I don't believe we have addressed that at all as of yet.  CPG 1.6 will require PHP5 as a minimum. But I know I haven't done any testing beyond that as of yet - perhaps others here have.
I don't know the specific issues that cheigu referred to.

This is certainly first I've heard of an ISP requiring use of PHP7 - most don't even have it available as an option yet - at least in shared hosting packages. I expect CPG is far from the only package that will have an issue in a PHP7 environment today.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #6 on: January 27, 2016, 02:36:38 pm »

There are more issues with CPG 1.5.40 than just mysql when it comes to PHP7. So some sort of patch for mysql won't keep it from failing on PHP7.
If push-comes-to-shove (probably a US expression :) ), and you really need to have a PHP7 compatible version, I will provide you with a pre-release, developer version that I have tested with PHP7.
Logged

IvarSnaaijer

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #7 on: May 03, 2016, 07:58:16 am »

I'm not allowed to PM as a newby, but would still like to have access to the beta with PHP7 support. I just moved to Ubuntu 16.04 and it comes with PHP7. I was able to fix it up a bit with the include mentioned but there is room for improvement ;)
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #8 on: May 03, 2016, 12:43:22 pm »

I'm not allowed to PM as a newby, but would still like to have access to the beta with PHP7 support.

Do you want to upgrade over an existing install or do a fresh install?
Logged

IvarSnaaijer

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #9 on: May 05, 2016, 07:12:52 pm »

I would like to upgrade from an existing installation. If this is impossible I should be able to recreate the new site from scratch, there are no real relevant comments on it, only images.
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #10 on: May 05, 2016, 09:50:09 pm »

I would like to upgrade from an existing installation. If this is impossible I should be able to recreate the new site from scratch, there are no real relevant comments on it, only images.
If you want to do a new site from scratch, follow the link in this post to download a beta version of CPG 1.6.
http://forum.coppermine-gallery.net/index.php/topic,78708.msg381574/topicseen.html#msg381574

If you want to upgrade in place, download the file attached here and place it in the root of your current CPG install (as upgrader.php). Make sure you are logged in as admin, then access <yourCPGsite>/upgrader.php. Select "CPG Release 1.6.04" (or whatever may be newer) and perform the upgrade/update. Ignore any message about a newer version available, and complete the update. I have had success upgrading CPG 1.5.20 in place but, if you value your current installation, you may want to make sure it is backed up first.

Please be very aware that there may be compatibility issues between CPG 1.6 and a plugin or theme that you are using.

Good luck!

[ those of you using this upgrade in place method ... please let us know how it worked for you ]

Update: v2.2 additional checks made prior to install
Update: v2.3 better check for file placement errors
« Last Edit: August 16, 2019, 03:03:18 pm by ron4mac »
Logged

MarioKnight

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #11 on: July 07, 2016, 05:41:43 pm »

I was preparing to do a manual update to 1.6.01 using the files in the Github repo this weekend, and came across this post when checking for any information I may have missed.  I'm very happy to have seen this updater script and figured I had time right now to give that a try where I could still go about my original plans if needed.  I made my backups and ran it as instructed (I did not get a message about a newer version available).  Everything appears to have completed successfully!  For reference, my server is CentOS 6.x with PHP 5.6.23 using suPHP.  I do not use any plugins or extensions so there was no worry about potential issues there.  I do use a one line modification within /include/functions.inc.php that someone here helped me with some time ago, and in applying it to the same query, this also works as it was meant to.

This makes an already smooth updating process even smoother and easier.  Thank you very much for this script and I look forward to the official release!  =D
Logged

sah62

  • Coppermine newbie
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 19
    • Mustang 428 Cobra Jet Registry
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #12 on: October 06, 2016, 03:40:51 pm »

I just updated my gallery to version 1.5.44. If you're using PHP 7.x (and some versions of PHP 5.x) and attempt to run update.php you will probably encounter an error on line 33:

Code: [Select]
set_magic_quotes_runtime(0);
This function has been deprecated: http://php.net/manual/en/function.set-magic-quotes-runtime.php

The fix? Just comment that line out and run update.php again.
Logged

jflash

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #13 on: October 18, 2016, 08:45:51 pm »

Hello! My ISP changed PHP to 7... How to manual update to cpg16?
Logged

jflash

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #14 on: October 19, 2016, 12:59:54 pm »

Hello! My ISP changed PHP to 7... How to manual update to cpg16?
I made offline website and renewed to 1.6, but now i cant log in, i put username and password, after push button i get blank page and web browser address is http://www.mywebpagename.ee/login.php?referer=
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #15 on: October 19, 2016, 05:45:31 pm »

Did you make sure you ran update.php after the update?

Is so, you will need to either check your servers logs to see what the actual error is, or enable the displaying of errors. A blank page is usually displayed when your server cannot process something but is set to not display errors.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

jflash

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #16 on: October 19, 2016, 09:02:13 pm »

Did you make sure you ran update.php after the update?

Is so, you will need to either check your servers logs to see what the actual error is, or enable the displaying of errors. A blank page is usually displayed when your server cannot process something but is set to not display errors.
Ooo, update.php logs in, makes some changes and now all website has blank page :( But, then i renamed plugins directory and all works! So i have some incompatible plugins too.
Logged

jflash

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #17 on: October 19, 2016, 09:03:18 pm »

Thank you Phill!  ;)
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #18 on: October 20, 2016, 11:11:51 am »

A lot of the plugins are not yet ready for CPG1.6, but many are. Some will require minor modifications and others a little more extensive efforts to make them work. With such a small team things take longer than we would all like. We have been extremely lucky to have had ron4mac, Andre and gmc spend their valuable time making CPG1.6 ready for PHP7, particularly ron4mac in this case.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

BillR

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: PHP7 / MySQLi / PDO support in Coppermine?
« Reply #19 on: December 10, 2016, 03:04:33 am »

I know it's been a few months for this topic, but I just happened across while searching for a solution. I'm in the same boat, I need to run php7 for my store software. I do still have a working copy of my gallery in a folder running php5.6 but it's not going to be for much longer.

Anyway, when I try the upgrader.php, I get this error -

 Error
Releases of CPG not found at Github

Any easy way to fix that or have things moved somewhere else now?

Thanks,
- Bill
Logged
Pages: [1] 2   Go Up
 

Page created in 0.058 seconds with 20 queries.