Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. LAMP
  3. Cannot change PHP version on Lamp

Cannot change PHP version on Lamp

Scheduled Pinned Locked Moved Solved LAMP
13 Posts 3 Posters 3.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • LaurDanielL LaurDaniel

    This is what PHP_VERSION file is containing
    "
    ; Set the desired PHP version in this file
    ; Restart app for changes to take effect
    PHP_VERSION="8.0"
    "

    girishG Offline
    girishG Offline
    girish
    Staff
    wrote on last edited by
    #4

    @LaurDaniel remove the quotes around 8.0 . So, just PHP_VERSION=8.0.

    LaurDanielL 1 Reply Last reply
    0
    • girishG girish

      @LaurDaniel remove the quotes around 8.0 . So, just PHP_VERSION=8.0.

      LaurDanielL Offline
      LaurDanielL Offline
      LaurDaniel
      wrote on last edited by
      #5

      @girish I tried that too, without success

      girishG 1 Reply Last reply
      0
      • LaurDanielL LaurDaniel

        @girish I tried that too, without success

        girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #6

        @LaurDaniel I feel I am missing something:

        • The default version of PHP in a new install in 8.0
        • I tried changing PHP_VERSION to 8.1 and restart the app. That worked.

        So.. Can you tell me:

        • Is this a new install or are you using an old PHP installation where we previously had PHP 7.4 as the default?
        • In the Update section of the app, can you check what the Appstore Id is? In the past, we had an old app which was PHP 7.2. Maybe you are using that one? The latest package is lamp.cloudronapp.php74@2.2.0

        My PHP_VERSION file looks like this:

        ; Set the desired PHP version in this file
        ; Restart app for changes to take effect
        PHP_VERSION=8.1
        
        LaurDanielL 1 Reply Last reply
        0
        • girishG girish

          @LaurDaniel I feel I am missing something:

          • The default version of PHP in a new install in 8.0
          • I tried changing PHP_VERSION to 8.1 and restart the app. That worked.

          So.. Can you tell me:

          • Is this a new install or are you using an old PHP installation where we previously had PHP 7.4 as the default?
          • In the Update section of the app, can you check what the Appstore Id is? In the past, we had an old app which was PHP 7.2. Maybe you are using that one? The latest package is lamp.cloudronapp.php74@2.2.0

          My PHP_VERSION file looks like this:

          ; Set the desired PHP version in this file
          ; Restart app for changes to take effect
          PHP_VERSION=8.1
          
          LaurDanielL Offline
          LaurDanielL Offline
          LaurDaniel
          wrote on last edited by
          #7

          @girish I checked the Appstore Id and it looks like it's the latest, lamp.cloudronapp.php74@2.2.0 and it's last updated 2 weeks ago.

          I will try a new installation and maybe that will do it. My question is, when uninstalling an lamp application, I will also delete the database credentials?

          girishG 1 Reply Last reply
          0
          • LaurDanielL LaurDaniel

            @girish I checked the Appstore Id and it looks like it's the latest, lamp.cloudronapp.php74@2.2.0 and it's last updated 2 weeks ago.

            I will try a new installation and maybe that will do it. My question is, when uninstalling an lamp application, I will also delete the database credentials?

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #8

            @LaurDaniel The default install is PHP 8.0 for a while now. Can you post the app logs, so we can try to see why it's resetting to PHP 7.4 ? BTW, how do you know it's PHP 7.4?

            And yes, deleting the app will delete the database as well.

            LaurDanielL 1 Reply Last reply
            0
            • girishG girish

              @LaurDaniel The default install is PHP 8.0 for a while now. Can you post the app logs, so we can try to see why it's resetting to PHP 7.4 ? BTW, how do you know it's PHP 7.4?

              And yes, deleting the app will delete the database as well.

              LaurDanielL Offline
              LaurDanielL Offline
              LaurDaniel
              wrote on last edited by
              #9

              @girish I know it's 7.4 because I run php -v command in terminal. I tried to download the logs file but I'm getting data only from 23.08 to 28.08.

              I see that I have an error in the logs and I'll try to paste it here directly from logs terminal. I also have to mention that I'm trying to get working an Laravel 9 application.

              Here is the error from my logs:
              Sep 01 15:52:40 [Thu Sep 01 12:52:40.022063 2022] [php:error] [pid 50] [client 172.18.0.1:43456] PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:1354\nStack trace:\n#0 /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()\n#1 /app/data/vendor/composer/ClassLoader.php(571): include('...')\n#2 /app/data/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()\n#3 /app/data/vendor/laravel/framework/src/Illuminate/Collections/helpers.php(15): Composer\Autoload\ClassLoader->loadClass()\n#4 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): collect()\n#5 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()\n#6 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()\n#7 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()\n#8 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(152): Illuminate\Foundation\Application->bootstrapWith()\n#9 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\Foundation\Http\Kernel->bootstrap()\n#10 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()\n#11 /app/data/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle()\n#12 {main} in /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php on line 11

              girishG 1 Reply Last reply
              0
              • LaurDanielL LaurDaniel

                @girish I know it's 7.4 because I run php -v command in terminal. I tried to download the logs file but I'm getting data only from 23.08 to 28.08.

                I see that I have an error in the logs and I'll try to paste it here directly from logs terminal. I also have to mention that I'm trying to get working an Laravel 9 application.

                Here is the error from my logs:
                Sep 01 15:52:40 [Thu Sep 01 12:52:40.022063 2022] [php:error] [pid 50] [client 172.18.0.1:43456] PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:1354\nStack trace:\n#0 /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()\n#1 /app/data/vendor/composer/ClassLoader.php(571): include('...')\n#2 /app/data/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()\n#3 /app/data/vendor/laravel/framework/src/Illuminate/Collections/helpers.php(15): Composer\Autoload\ClassLoader->loadClass()\n#4 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): collect()\n#5 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()\n#6 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()\n#7 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()\n#8 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(152): Illuminate\Foundation\Application->bootstrapWith()\n#9 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\Foundation\Http\Kernel->bootstrap()\n#10 /app/data/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()\n#11 /app/data/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle()\n#12 {main} in /app/data/vendor/laravel/framework/src/Illuminate/Collections/Collection.php on line 11

                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #10

                @LaurDaniel The CLI php is always 7.4. This is because of a packaging quirk . On ubuntu, the php is a meta symlink and this is not possible to change at run time easily when switching PHP versions. In your scripts, instead use php7.4, php8.0, php8.1 binaries instead.

                The apache PHP module is the correct way to test if the change worked. Can you check the output of phpinfo instead?

                From your error, it seems you are using an old laravel with newer PHP. See https://laracasts.com/discuss/channels/laravel/php-fatal-error-during-inheritance-of-arrayaccess-uncaught-errorexception-return-type-of-illuminatesupportcollectionoffsetexistskey and https://stackoverflow.com/questions/70245146/php-deprecated-issue-when-running-artisan-command . I am not an expert on PHP/laravel mismatch, but it looks like that is the root cause here.

                LaurDanielL 1 Reply Last reply
                0
                • girishG girish

                  @LaurDaniel The CLI php is always 7.4. This is because of a packaging quirk . On ubuntu, the php is a meta symlink and this is not possible to change at run time easily when switching PHP versions. In your scripts, instead use php7.4, php8.0, php8.1 binaries instead.

                  The apache PHP module is the correct way to test if the change worked. Can you check the output of phpinfo instead?

                  From your error, it seems you are using an old laravel with newer PHP. See https://laracasts.com/discuss/channels/laravel/php-fatal-error-during-inheritance-of-arrayaccess-uncaught-errorexception-return-type-of-illuminatesupportcollectionoffsetexistskey and https://stackoverflow.com/questions/70245146/php-deprecated-issue-when-running-artisan-command . I am not an expert on PHP/laravel mismatch, but it looks like that is the root cause here.

                  LaurDanielL Offline
                  LaurDanielL Offline
                  LaurDaniel
                  wrote on last edited by
                  #11

                  @girish The thing is that I run laravel 9, so that isn't the problem here. If I run phpinfo, I get that the php version is 8.1.5 but that's not really helping me. What should I do to manage an laravel 9 install?

                  girishG 1 Reply Last reply
                  0
                  • LaurDanielL LaurDaniel

                    @girish The thing is that I run laravel 9, so that isn't the problem here. If I run phpinfo, I get that the php version is 8.1.5 but that's not really helping me. What should I do to manage an laravel 9 install?

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #12

                    @LaurDaniel can you give me a small example of how to reproduce this? (as in, PHP code)

                    LaurDanielL 1 Reply Last reply
                    0
                    • girishG girish

                      @LaurDaniel can you give me a small example of how to reproduce this? (as in, PHP code)

                      LaurDanielL Offline
                      LaurDanielL Offline
                      LaurDaniel
                      wrote on last edited by
                      #13

                      @girish I think this might help https://stackoverflow.com/a/43586197, but I need help to make it working with Cloudron Lamp app

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search