forum.coppermine-gallery.net

No Support => Announcements => Topic started by: phill104 on January 11, 2014, 07:50:57 pm

Title: PHP4 Support.
Post by: phill104 on January 11, 2014, 07:50:57 pm
Way back in 2008 the PHP Group ended support for PHP 4. Since then the Coppermine team have been considering when to withdraw support for PHP 4. We have decided on a phased approach with PHP 4 support being removed completely as of CPG1.6.x.

Why?
 
Since 2008 no more work was done on PHP 4 meaning any server still using it could pose a security risk. As a result, most hosts have removed PHP 4 and upgraded to PHP 5 but we are aware there are still a few out there.

Up to CPG 1.5.24, PHP 4 was fully supported but for those using newer versions of PHP could throw up warning messages depending on specific server setups. To remove these messages we have made a number of changes as outlined in the following thread.

http://forum.coppermine-gallery.net/index.php/topic,76493.0.html (http://forum.coppermine-gallery.net/index.php/topic,76493.0.html)

With these changes in place Coppermine will no longer work correctly on servers running PHP 4. In the short term we will be providing a patch package as part of the download which should be used just for those still running on outdated servers. This should only be used as a last resort and before doing so you should speak to your host with a view to updating to PHP5. In most cases it is a simple selection you can make in your cpanel, or the addition of a simple file in your root folder. Either way your host is the best source of the correct information as to how to do this.

OK, so I shall update to PHP 5. What are the main changes ?

PHP 5 is designed to be as compatible with earlier versions of PHP as possible with little functionality being broken in the process, but there are things that you need to be aware of as depending on your site, you may have some work to do. Coppermine is fully compatible out of the box, but some third party PHP scripts may not be as well as a possibility that some of you custom modifications could cause problems. The information below outlines some of the main changes that you need to be aware of.

Removal of register_globals

Register_globals will be removed due to major security concerns regarding the directive.
 If your website relies on register_globals being available, you will need to re-code your website to work without them. If you're running a site using a package like Joomla or Wordpress alongside Coppermine, this can be as simple as upgrading to the latest version. However, if you've written the PHP code yourself, you will need to check that it works under PHP version 5.

Removal of MySQL Libraries

The standard MySQL libraries have been flagged for removal in version 5. Although there is no confirmed date for removing these functions as yet, you should change your code to use one of the recommended methods of connecting to MySQL servers, such as PDO:MySQL.

More information about PDO is available here (http://www.php.net/manual/en/book.pdo.php)

More information about possible database issues can be found here (http://www.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5)

Removal of short tags

As of PHP 5.3 the use of short tags is no longer supported, you will need to convert any files that use these tags to the standard tags. One exception to this rule is the use of the short tag definitions, as these are enabled by default without the need for "short_open_tag" being enabled in php.ini as of PHP 5.4.

More information about the use of short tags can be found here. (http://www.php.net/manual/en/ini.core.php#ini.short-open-tag)

New object model

In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features.

More details about this can be found here. (http://uk3.php.net/manual/en/migration5.oop.php)

New Reserved Words and Keywords

There have been a number of words added to the reserved words list, meaning that you cannot use them anymore for variable names. Full details can be found here.
 (http://www.php.net/manual/en/reserved.keywords.php)
New Functions

There are a number of new functions available in version 5, which can be used instead of having to write your own. For example, in version 5 there is a string split function which converts a string into an array of letters whereas in version 4, you had to write your own to do this.

A full list of new functions is available here
 (http://www.php.net/manual/en/migration5.functions.php)
If you have no idea what we are talking about above don't panic as almost every webhost of note has already upgraded to PHP 5, if they have not then you should jump up and down, shout at them then ask why they are putting themselves and their customers at risk. If you are your own webhost or server owner still running PHP 4 then see me after class for detention and lines.

A more in depth article on upgrading to PHP 5 can be found here
 (http://php.net/manual/en/faq.migration5.php)

Title: Re: PHP4 Support.
Post by: Αndré on January 11, 2014, 08:54:19 pm
If you're stuck with PHP 4, we provide a patch package which can be applied to cpg1.5.26 and later. As this package is built like a regular upgrade package, the regular upgrade docs (http://[url=http://documentation.coppermine-gallery.net/en/upgrading.htm) apply. Please download (https://sourceforge.net/projects/coppermine/files/Coppermine/1.5.x/cpg1.5.26-php4-patch.zip/download) the patch package from the download page (http://sourceforge.net/project/showfiles.php?group_id=89658) and upload the extracted files to your gallery. Make sure to overwrite existing files.

Actually, the package contains files from an older release of cpg1.5.x, so versioncheck will mark those files as potential error:
Those files contain no security related issues, so you can simply ignore the warnings.

While the package's file name is cpg1.5.26-php4-patch.zip, you can still apply it to future releases of cpg1.5x.
Title: Re: PHP4 Support.
Post by: Johnson.Wang on December 07, 2015, 12:02:40 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 Coppermin? If NO, I will leave Coppermine and try to find other photo gallery.
Title: Re: PHP4 Support.
Post by: gmc on December 07, 2015, 12:18:08 pm
We are already testing a 'database abstraction' for CPG 1.6 that will support BOTH (your choice) mysqli and PDO...
We haven't discussed changes to 1.5, though changing MySQL to mysqli shouldn't be difficult.
I don't know how many people will require PHP7 support (many hosts just rolling out 5.5... Which CPG supports fine, but other projects don't have full support for yet....)