How to add a more recent version of PHP?

Discussion in 'General' started by schwim, Jun 19, 2018.

  1. schwim

    schwim Member

    Hi there everyone!
    I found this tutorial on adding 5.6 to your Debian 7 install but I would assume that some (maybe a lot) has changed in two major versions for both Deb and PHP.

    Is there a tutorial on how to add a later PHP version to ISPC 3.1.12 on Debian 9?

    Thanks for your time!
    Last edited: Jun 19, 2018
  2. elmacus

    elmacus Active Member

  3. schwim

    schwim Member

    Thanks very much, elmacus. I'm in the middle of running the script and have come to a screen requesting that I select an FPM port for php72:


    I searched but didn't find a preferred port(9000 was mentioned a lot, however). Is there anything in particular I should enter?
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The port must be free (not used yet). Port 9000 is probably already in use by the default php, use e.g. 8999 for the first php version, 8998 for the next one etc.
  5. schwim

    schwim Member

    Thank you! I set it at 8999. I swapped the PHP version for the site in ISPC but the version shows the same in PHPInfo so I'm assuming that I need to restart the services but I don't see a way to restart them in ISPC. I just see a page showing what services are activated for that server: Yes Yes Yes Yes Yes No No

    Am I supposed to uncheck services (like web), save, recheck and save to restart them or is there another page I should be at for this?

    Or does ISPC not handle service restarts?
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    No, you don't have to restart any services. ISPConfig restarts them automatically.
  7. schwim

    schwim Member

    Thank you very much, I see that it did show the change in PHP after another refresh. I've stumbled into another issue, however. It seems that the new PHP version is pretty bare bones and does not have the modules I need. As an example, 7.2 shows that I'm lacking the module intl. I used apt to install php-intl and it installed successfully but the 7.2 version still does not show as having it enabled. The ISPC included 7.0.27 doesn't show this warning, so it seems that I might need to do something to get my 7.2 install to load these.

    Could you tell me what I need to do to include these modules with my 7.2 install?
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

  9. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Find out the names of needed packages. Then apt-get install them. You can look up what php packages for php 7.0 are installed, and install the same for php 7.2. The package names may have changed, though.
  10. schwim

    schwim Member

    Sorry if I wasn't clear. I did try installing the modules I needed via apt and I did a service apache2 restart but the modules still show as missing. php7.0-intl was already installed and I installed php-intl. In spite of both of these being installed, it's still non-existent to 7.2.6.
  11. schwim

    schwim Member

    So I found the following in 7.2.6's ini:

    ; Dynamic Extensions ;
    ; If you wish to have an extension loaded automatically, use the following syntax:
    ;   extension=modulename
    ; For example:
    ;   extension=mysqli
    ; When the extension library to load is not located in the default extension
    ; directory, You may specify an absolute path to the library file:
    ;   extension=/path/to/extension/
    So I uncommented that and restarted Apache. Script still didn't find it.

    So I did a find in an effort to locate where resides. I found a copy here: /usr/lib/php/20151012/

    So I altered php.ini to reflect this:

    and restarted Apache. The script still did not recognize it as a satisfied dependency.

    I'm not sure how else to resolve this issue Any assistance would be most welcome!
  12. ahrasis

    ahrasis Well-Known Member

    As dicussed in here, you should know what are the difference and the location (path) between your compiled php and installed php (default or ondrej sury version).

    Normally, compiled php is in the /opt folder so its php.ini and extension should be in there too. Other than that each php version got its own date style folder so your compiled php7.2 shouldn't be using /usr/ folder or /20151012/ folder in it.

    The easiest way for most new users is to use Ondrej Sury version of compiled php as stated by @Jesse Norell above.
  13. schwim

    schwim Member

    Unfortunately, the easiest way uses Debian's repository which means you're only going to get 7.1 from it. Since I'd like to have 7.2, I'm better off sticking with what I have.

    I'm pretty sure I refuse to believe that it's not possible to add modules to this PHP install. That wouldn't make any sense at all.
  14. ahrasis

    ahrasis Well-Known Member

    From my readings elsewhere, (here, here and there) though the referred tutorial above did not mentioned php7.2 packages, they should already be available under that repo and easily be installed from it.

    And I didn't say that you cannot add any extensions or modules to compiled php, but you have to do it right for them to work properly.
  15. schwim

    schwim Member

    The links you posted all involve adding other unofficial repos to install the version of PHP. Also, as instructed in some of the linked articles, the intention is to replace the included version of PHP.

    I'm going to do a bit more research on the matter before I go around installing additional PHP versions. I'm clearly missing something when it comes to understanding this. I've got an installed version of 7.2 and I just don't understand how it could be easier to install other versions of the same 7.2 and not enable or add a module to the one I've got installed.

    Thanks so much for your thoughts on the matter, I greatly appreciate it!
    ahrasis likes this.
  16. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    To add a module to your compiled version, I suspect you'll need to recompile it using additional options to configure (though it's been a while since I've built php).

    Using the sury repo, it is as simple as 'apt-get install php7.2-intl'. You can make 7.2 the default version with update-alternatives. I know it's not recommended to change the system php version and does frequently break ispconfig; I don't know if you'll run into problems doing so with 7.2 on debian 9 or not, but don't be surprised if it does. (If so, the solution is of course to leave the system php version at the default and add additional php versions that are newer/older.)
    ahrasis likes this.
  17. schwim

    schwim Member

    Hi there Jesse, and thanks very much for taking the time to help.

    I also came to realize that it needed to be compiled with the needed module so I opened an issue with the developer of the PHP install script to see if they could help me figure out how to get the intl module included in the install.

Share This Page