Php-updater - a script to upgrade php in a safe way

Thanks. Yes, internet access and DNS working fine. I know when I ran the initial wget command though from the Ubuntu host nothing downloaded - I just ended up with a zero byte file. I opened https://global-social.net/script/php-updater in Chrome manually and the script appeared inline immediately, so I copy/pasted that into the file in Linux. Didn’t think anything of it really, but when I run it with sudo, it just fails on loading the modules every time.

Is it actually pulling the modules down from global-social.net, or from a general internet repo?

But that chrome-browser is not on the same host as your server, right?

It still looks like you have no access to the server from your linux host.

You can test the connection with these commands, which you should run on your linux server:

ping -c 4 global-social.net
nc -zv global-social.net 443
traceroute global-social.net
(( $(curl -I -o /dev/null -s -w %{http_code} https://global-social.net/status.php) == 200 )) && echo "connected" || echo "not connected"

You can send me the output per PM if you want


global-social.net is the module server

h.t.h.


Much and good luck,
ernolf

Hello Ernolf,

Firstly, thank you for investing your time in helping this community, very impressive and I extend my gratitude.

I am running into syntax errors and I hope you can direct me down a path to a resolution.

There is no log file in /tmp

root@castlegate:/# php-updater --list-installed

  ==============================================================================
  actual PHP related packages installed and managed by dpkg
X    Package                Version                                       Status
  ------------------------------------------------------------------------------
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  libapache2-mod-php     2:8.1+92ubuntu1                                 ia
SAPI libapache2-mod-php8.1  8.1.2-1ubuntu2.20                               im
     \apache2handler /usr/lib/apache2/modules/libphp8.1.so <ACTIVE> loaded
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php                    2:8.1+92ubuntu1                                 ia
/dev/fd/61: line 209: ((: q2 2 - 1 : syntax error in expression (error token is "2 - 1 ")
META php8.1                 8.1.2-1ubuntu2.20                               ia
   - php8.1-apcu            5.1.21+4.0.11-7ubuntu1                          ia
     \included module: apcu 
   - php8.1-bcmath          8.1.2-1ubuntu2.20                               ia
     \included module: bcmath 
SAPI php8.1-cli             8.1.2-1ubuntu2.20                               ia
     \php binary /usr/bin/php8.1 <ACTIVE> linked to generic /usr/bin/php
   - php8.1-common          8.1.2-1ubuntu2.20                               ia
     \included modules: calendar ctype exif ffi fileinfo ftp gettext iconv pdo 
       phar posix shmop sockets sysvmsg sysvsem sysvshm tokenizer 
   - php8.1-curl            8.1.2-1ubuntu2.20                               ia
     \included module: curl 
   - php8.1-gd              8.1.2-1ubuntu2.20                               ia
     \included module: gd 
   - php8.1-gmp             8.1.2-1ubuntu2.20                               ia
     \included module: gmp 
   - php8.1-imagick         3.6.0-4ubuntu1                                  ia
     \included module: imagick 
   - php8.1-intl            8.1.2-1ubuntu2.20                               ia
     \included module: intl 
   - php8.1-mbstring        8.1.2-1ubuntu2.20                               ia
     \included module: mbstring 
   - php8.1-mysql           8.1.2-1ubuntu2.20                               ia
     \included modules: mysqli mysqlnd pdo_mysql 
   - php8.1-opcache         8.1.2-1ubuntu2.20                               ia
     \included module: opcache 
   - php8.1-readline        8.1.2-1ubuntu2.20                               ia
     \included module: readline 
   - php8.1-smbclient       1.0.6-6                                         ia
     \included module: smbclient 
   - php8.1-xml             8.1.2-1ubuntu2.20                               ia
     \included modules: dom simplexml xml xmlreader xmlwriter xsl 
   - php8.1-zip             8.1.2-1ubuntu2.20                               im
     \included module: zip 
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-apcu               5.1.21+4.0.11-7ubuntu1                          im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-bcmath             2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-cli                2:8.1+92ubuntu1                                 im
   - php-common             2:92ubuntu1                                     im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-curl               2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-gd                 2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-gmp                2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-imagick            3.6.0-4ubuntu1                                  im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-intl               2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-mbstring           2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-mysql              2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-smbclient          1.0.6-6                                         im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-xml                2:8.1+92ubuntu1                                 im
/dev/fd/61: line 209: ((: q2 1 - 1 : syntax error in expression (error token is "1 - 1 ")
DEP  php-zip                2:8.1+92ubuntu1                                 im
  ------------------------------------------------------------------------------
  Status: - First letter (Desired Action):    - Second letter (Package Status):
            u=Unknown - i=Install - h=Hold      a=Automatic - m=Manual
  ------------------------------------------------------------------------------

Hi @sidewyz1,

Thank you for this valuable feedback!

I recently rewritten the code significantly. Since it happens in a test that is not carried out on my system because I have not installed any dependency packages, I unfortunately ā€œmissed itā€.

It’s been fixed.


Much and good luck,
ernolf

Worked like a charm!

Thank you. Coffee incoming…

1 Like

This was a great script. I use HanssonIT as an LXC. The script ran without issue and I was able to get up to php8.3 on Ubunutu22 LTS.

Thanks @ernolf. This was a great script with lots of ID ten T protections.

1 Like

Hi,

meine PHP Version ist auch zu alt für künftige Versionen. Google hat mir diesen Thread ausgespuckt.

Nextcloud lƤuft beim mir unter Proxmox in einem LXC noch mit Bullseye.

Sehe ich das richtig das dieses Script dann nicht funktioniert?

Danke

EDIT:

Hi,

My PHP version is also too old for future versions. Google spit out this thread for me.

Nextcloud is still running under Proxmox in an LXC with Bullseye.

Do I see correctly that this script does not work then?

Thanks for your help

Did the script say so?
Simply rund the script, it wil test if it supports your version.
Bullseye is supported untl its end of LTS-support end august 2026.


Much and good luck,
ernolf

Hi and thanks for quick answer.

Script didn’t say anything as i did not try but limitation is written at your initial post as restriction.

That’s why i ask.

But now I’ll give it a try.

Hi @Epo_Deluxe,

I don’t run LXC/LXD myself, so I’m not an expert in the field.

However, if it’s a privileged container with systemd on PID1, everything should normally work as intended. At least that’s what I’ve been told several times.

Feedback about success or failure is always helpful in this context.


ernolf

Script is running but I’m lost what i need to do now:

 php-updater --list-installed

  ==============================================================================
  actual PHP related packages installed and managed by dpkg
X    Package                Version                                       Status
  ------------------------------------------------------------------------------
   - php-common             2:95+0~20240927.54+debian11~1.gbpe0084c         im
   - php8.1-apcu            5.1.24-1+0~20241124.41+debian11~1.gbpff678c     im
     \included module: apcu
   - php8.1-bcmath          8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: bcmath
   - php8.1-bz2             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: bz2
SAPI php8.1-cli             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \php binary /usr/bin/php8.1 <<INACTIVE not linked
   - php8.1-common          8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included modules: calendar ctype exif ffi fileinfo ftp gettext iconv pdo
       phar posix shmop sockets sysvmsg sysvsem sysvshm tokenizer
   - php8.1-curl            8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: curl
SAPI php8.1-fpm             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \listening on unix socket /run/php/php8.1-fpm.sock <CONNECTED> nginx
   - php8.1-gd              8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: gd
   - php8.1-gmp             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: gmp
   - php8.1-igbinary        3.2.16-3+0~20241125.52+debian11~1.gbp2adcb2     im
     \included module: igbinary
   - php8.1-imagick         3.7.0-9+0~20241126.47+debian11~1.gbp7df923      im
     \included module: imagick
   - php8.1-intl            8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: intl
   - php8.1-ldap            8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: ldap
   - php8.1-mbstring        8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: mbstring
   - php8.1-mysql           8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included modules: mysqli mysqlnd pdo_mysql
   - php8.1-opcache         8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: opcache
   - php8.1-readline        8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: readline
   - php8.1-redis           6.1.0-2+0~20241127.62+debian11~1.gbp5ec001      im
     \included module: redis
   - php8.1-smbclient       1.1.2-2+0~20241126.30+debian11~1.gbpb221e0      im
     \included module: smbclient
   - php8.1-xml             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included modules: dom simplexml xml xmlreader xmlwriter xsl
   - php8.1-zip             8.1.31-1+0~20241121.67+debian11~1.gbp9e3dc4     im
     \included module: zip
SAPI php8.2-cli             8.2.27-1+0~20241224.69+debian11~1.gbp7d3194     im
     \php binary /usr/bin/php8.2 <<INACTIVE not linked
   - php8.2-common          8.2.27-1+0~20241224.69+debian11~1.gbp7d3194     im
     \included modules: calendar ctype exif ffi fileinfo ftp gettext iconv pdo
       phar posix shmop sockets sysvmsg sysvsem sysvshm tokenizer
   - php8.2-imagick         3.7.0-9+0~20241126.47+debian11~1.gbp7df923      im
     \included module: imagick
   - php8.2-opcache         8.2.27-1+0~20241224.69+debian11~1.gbp7d3194     im
     \included module: opcache
   - php8.2-readline        8.2.27-1+0~20241224.69+debian11~1.gbp7d3194     im
     \included module: readline
SAPI php8.4-cli             8.4.4-1+0~20250215.23+debian11~1.gbp9a7680      im
     \php binary /usr/bin/php8.4 <ACTIVE> linked to generic /usr/bin/php
   - php8.4-common          8.4.4-1+0~20250215.23+debian11~1.gbp9a7680      im
     \included modules: calendar ctype exif ffi fileinfo ftp gettext iconv pdo
       phar posix shmop sockets sysvmsg sysvsem sysvshm tokenizer
   - php8.4-imagick         3.7.0-9+0~20241126.47+debian11~1.gbp7df923      im
     \included module: imagick
   - php8.4-opcache         8.4.4-1+0~20250215.23+debian11~1.gbp9a7680      im
     \included module: opcache
   - php8.4-readline        8.4.4-1+0~20250215.23+debian11~1.gbp9a7680      im
     \included module: readline
  ------------------------------------------------------------------------------
  Status: - First letter (Desired Action):    - Second letter (Package Status):
            u=Unknown - i=Install - h=Hold      a=Automatic - m=Manual
  ------------------------------------------------------------------------------
  You can switch the <ACTIVE> and <CONNECTED> version with:
                                   php-updater --switch-version
  ------------------------------------------------------------------------------


Switching Version only or updating from 8.1 to ?

What is the version you want to switch to?

Did you not see or not read the help screen at the begining?

So if you have already installed several versions (at least partial) then you should run it like this:

php-updater $old $new

So if you want to switch to 8.3 and your actual version is 8.1 (as it looks in your quoted script-echo), simply run

php-updater 8.1 8.3

and answer the questions.

At the end it wil swicth to the new version and your version mismatch you have now will be resolved.

h.t.h.


Much and good luck,
ernolf

1 Like

Guess i will go with recommended, should be 8.3

I saw this but to the fact of several installed versions i was unsure how to proceed.

EDIT: Script went fine at Proxmox LXC

Hi @ernolf
First of all thank you for this script!
Can you help me.
today I run the script and get this error.

Hi @Vadim,

The script is constantly being improved and developed.
If you had read carefully what the error output says, you would have seen that I’ve already helped you (the red colored text).

If the changes are too major, 100 percent backward compatibility can no longer be guaranteed and the integrated updater then no longer works.

So run the command displayed (which is nothing else than an update) and start the script again:

sudo wget -O /usr/local/bin/php-updater https://global-social.net/script/php-updater
sudo php-updater

The integrity check is carried out again first, so there is no security gap.

h.t.h.


Much and good luck,
ernolf

Sorry, I understand it’s annoying when users don’t read what the program writes to them, but that’s exactly what I did before contacting you.
But it didn’t work

Oh! I am so sory. :flushed:

Could you please try to remove the old modules:

sudo rm -fr /root/.ebtb

That forces the binary to download the new ones.

I hope that works.

:crossed_fingers:


ernolf

Thank you for wasting your time with me.
I did that, now another error appears

It’s a new dependency on the package ansifilter, which is normally available in the apt sources of Debian and Ubuntu:

Are you using a different distribution or a rare architecture?

But to help you and others who might stumble upon this limitation, I removed the dependency on ansifilter and wrote a function that has the functionality of Ansifilter.
ansifilter will still be used if it’s installed, but if it’s not installed, the internal function will be used.

So please remove the ~/.ebtb directory one more time and start again.


ernolf

In this thread somone got the same error with th nc-who script, and I’d say they probably on Ubuntu have the universe repo disbaled for some reason.

In Debian the ansifilter package is in main, which of course always needs to be enabled to be able to use Debian, but in Ubuntu it’s in universe, which should also be enabled by default, but who knows, maybe it’s been disabled by the user, either intentionally or unintentionally when messing with the sources.list. Or maybe there are some Ubuntu based distros out there where it’s disabled for some reason… :man_shrugging:

@Vadim If you are on Ubuntu, try the following and then run the script again:

sudo add-apt-repository universe
1 Like