PHP 7.2 upgrade

Sure! not problem 7.1

The PHP developers deprecated mcrypt in version 7.1, and removed support in version 7.2. Applications should use other solutionions like openssl for encryption needs.

If you do decide to install the mcrypt PECL module for PHP 7.2, you’d need to do so using the following commands FOR CPANEL:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install libmcrypt
yum install libmcrypt-devel
/opt/cpanel/ea-php72/root/usr/bin/pecl install channel://pecl.php.net/mcrypt-1.0.1

Did we just get spammed above? Moderator?

You can always use the flag underneath the post to report a post. This way all admins and moderators will get a notification.

May I ask kindly for PHP 7.3 Support.
Currently I’m running on PHP v7.2.13 but as all other Webapps are running on PHP 7.3 this would be awesome!
If I can help with logs let me know

#EDIT: I just post the Error after switching to PHP 7.3 here

#### A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: MX/Router.php

Line Number: 224

Backtrace:

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/application/third_party/MX/Router.php
Line: 224
Function: strpos

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/application/third_party/MX/Router.php
Line: 71
Function: set_class

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/index.php
Line: 325
Function: require_once

UPDATE:

think I have made it compatible with PHP v7.3.x
But I think this needs a bit of testing.

What I changed:

/application/third_party/MX/Router.php

Row 221-228

public function set_class($class)
    {
        $suffix = $this->config->item('controller_suffix');
        if (strpos($class, $suffix) === false) {
            $class .= $suffix;
        }
        parent::set_class($class);
    }

changed to:

public function set_class($class)
    {
        $suffix = (string) $this->config->item('controller_suffix'); 
        parent::set_class($class);
    }

I think casting $suffix to string is appropriate if controller_suffix is(or can be) empty.
Can someone pls confirm its working?

Just added it here: https://github.com/InvoicePlane/InvoicePlane/pull/680#issuecomment-453630154

4 Likes

ah great! Just also found out php 7.3 is not supported yet in Version 1.5.9
Would be great, as this has a great speed performance upgrade against php 7.2

Thanks Martin! I just upgraded my server to v7.3 and came across this article after seeing the Invoice Plane error. I just updated the router.php per your suggestion and the error went away. The site appears to be working correctly without any issues. Thanks for you help!

1 Like

You are very welcome!
Hope the Dev-Team will include this fix ASAP as it will not break anything in PHP 5.6 and adds support up to PHP 7.3 (and maybe even beyond).

Thanks for your feedback and for using the Forum instead of just opening another Thread with a Issue that already have been solved :wink:

2 Likes

Will make sure this is merged when I get back from working away.

3 Likes

I’m new to Invoice Plane and hosting.

So toady I was trying to install Invoice plane via Softaculous since it’s more easy for me and I recived those errors:

  The following errors were found :

Required PHP extension not found : mcrypt
Required PHP extension not found : mysqli

On my webhosting PHP 7.3 is installed

I’ve found that I could enable “nd_mysqli” here:

But I did not see anything about “mcrypt” so my question is how I could implement easily this fix to be able to use Invoice Plane ? :thinking:

I really like to be able to install it with Softaculous since I never used database in hosting before.

Or at least to have a step by step instructions on how to do it…

I have crated a subdomain to put InvoicePlane in the form of Invoiice.MyDomain.com.

Does it would be better to use the version 2 ?

Regards !

Pls open a new Thread for this problem, as this is not related to PHP 7.2/PHP7.3 Upgrade.

But pls do not use IP2 becasue this is not the right version 2.
Stay at IP1 untill they will release the official version 2.

1 Like

Sorry but it seem related since PHP 7.3 from what I understand has deprecated "mcrypt extension in favor of open ssl.

So I don’t understand how you could conclude that it’s not related to PHP 7.3

invoiceplane.com need "mcrypt to encrypt passwords/database

And the documentation state clearly that it should work witn PHP 7 or higher when in fact mcrypt was deprecated and removed from PHP 7.2/7.3

The depreciation of php-mcrypt is perhaps going to be a bit of a headache for a while, especially as more people move from the now unsupported php 5.6 to the likes of 7.2 and 7.3.

I’ll be going through and getting things updated as best I can in the coming days, the day job has had me travelling extensively these last weeks but some normality is on the horizon.

1 Like

I’m on Plesk (not cPanel) and installed IP1 (1.5.9) on PHP 7.2 and it never throw any errors.
Not anything related to the mcrypt extension.

On which IP version are you running?

For me IP1 is even running (after the fix mentioned in this thread above) fine at PHP 7.3 for me there are no errors. I know the doc says it needs this extensions but I never was a problem for me.

You got 2 errors:

Required PHP extension not found : mcrypt
Required PHP extension not found : mysqli

Pls try to install mysqli first and tell us when happens then.

In Plesk mysqli is installed by default.

Where do you get this errors?
When trying to install IP or while running and debugging it?

I debugged IP1 when switching to PHP 7.3 and did not found a error after the fix.
As I’m on Plesk and you on cPanel I think this is maybe related to cPanel and not to PHP in general as I never had any errors related to mcrypt. But maybe I have to double check this.

Could you provide us some more informations about your system?

  • which cPanel version are you running on?
  • which PHP version exactly?
  • which Invoice Plane Version (1.5.9 or a older one)?
  • what OS (Server) and which version?
  • where have you seen this errors?

Hope we can help you after providing the additional infos.

1 Like

Thanks for your reply,

It confirm what I was thinking but not sure since I’m pretty new to hosting/PHP but I work in IT so learn pretty fast in technology.

One solution that I see would be to develop a package in PHP PEAR package PEPr :: Package Proposals CPanel has a module to install those PEAR package easily for newbie like me :wink:

From my understanding PEAR Packages are derived from PECL packages and luckily there is already a Mcrypt PECL package that is maintained: https://pecl.php.net/package/mcrypt

So it would be to convert this package in PEAR and submit it to the maintainer of PEAR project:

However for the long term it would be better to change InvoicePlane to use the OpenSSL library instead of Mcrypt.

But since I’m new I really don’t know is those suggestions are realist or helpful since I see that Version 2.0 is developed but I don’t know if the release will be soon or in a few years.

If I was using a VPS I could install Mcrypt directly from the PECL packages but I use “shared hosting” so I don’t have access to the linux “root”.

Since you will fix it in the next days I’ve found that I will downgrade to PHP 7.1 in meantime but could you tell me if there is some security issue I should an eye on with PHP 7.1 ?

Thanks for your quick reply :+1:

Thanks Martin for your help but @Severenth answered clearly to my question.

I don’t know why you don’t see this bug on your installation maybe because the extension was already installed previously.

The issue is very simple, since PHP 7.2 mcrypt is no longer integrated in the PHP language as an “official” extension and InvoicePlane V1.x need mcrypt to work fine.

So when user like me use the Softaculous installer to install InvoicePlane before beginning the installation the installer check that all the PHP extensions needed are available and in my case 2 extensions were not available.

One was “nd_mysqli” and it was easy to ad it just by the Cpanel:

The second was mcrypt which is no longer available in PHP 7.2 and higher so it need to be fixed and @Severenth will fix it in the next days when he will be less busy with his day job.

In meantime I will downgrade with 7.1 but it’s not every hosting that allow user to choose their PHP version so it need to be fixed and I’m pretty sure too PHP 7.3 is more secure than 7.1 :wink:

Regards :blush:

I cant say a lot about security related to PHP 7.1 vs PHP 7.3 but in terms of performance, but this is not the topic now.

To reproduce your Errors I would still like to know these things:

  • which cPanel version are you running on?
  • which PHP version exactly?
  • which Invoice Plane Version (1.5.9 or a older one)?
  • what OS (Server) and which version?
  • where have you seen this errors?

Regards, Martin

1 Like

I’m sorry Martin, but I believe you left out the part where you concatenate/append the suffix to the class… in your suggested fix, you set the suffix, but you don’t do anything with it.

Thanks - that worked.