How to update PHP version to 8?

New to the forum? Introduce yourself, chit chat and chew the fat.
ov2rey
Posts: 27
youtube meble na wymiar Warszawa
Joined: Fri Aug 05, 2016 11:13 am

How to update PHP version to 8?

Post by ov2rey »

How to update PHP to latest version 8?

ASUSTOR PHP apps version is outdated running version 7
User avatar
father.mande
Posts: 2219
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: How to update PHP version to 8?

Post by father.mande »

Hi,
ov2rey wrote:How to update PHP to latest version 8?
ASUSTOR PHP apps version is outdated running version 7
Before a new Asustor delivery, you can use Entware APKG an opkg package php8 8.0.13
php8 - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains only the PHP config file. You must actually choose your PHP flavour (cli, cgi or fastcgi). Please note, that installing php5 and php8 in parallel on the same target is not supported in OpenWrt/LEDE/Entware.
php8-cgi - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the CGI version of the PHP8 interpreter.
php8-cli - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the CLI version of the PHP8 interpreter.
php8-fastcgi - 8.0.13-1 - As FastCGI support is now a core feature the php8-fastcgi package now depends on the php8-cgi package, containing just the startup script.
php8-fpm - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the FastCGI Process Manager of the PHP8 interpreter.
php8-mod-bcmath - 8.0.13-1 - Bcmath shared module
php8-mod-calendar - 8.0.13-1 - Calendar shared module
php8-mod-ctype - 8.0.13-1 - Ctype shared module
php8-mod-curl - 8.0.13-1 - cURL shared module
php8-mod-dom - 8.0.13-1 - DOM shared module
php8-mod-exif - 8.0.13-1 - EXIF shared module
php8-mod-fileinfo - 8.0.13-1 - Fileinfo shared module
php8-mod-filter - 8.0.13-1 - Filter shared module
php8-mod-ftp - 8.0.13-1 - FTP shared module
php8-mod-gd - 8.0.13-1 - GD graphics shared module
php8-mod-gettext - 8.0.13-1 - Gettext shared module
php8-mod-gmp - 8.0.13-1 - GMP shared module
php8-mod-iconv - 8.0.13-1 - iConv shared module
php8-mod-imap - 8.0.13-1 - IMAP shared module
php8-mod-intl - 8.0.13-1 - Note that this package depends in ICU library which is built without data by default. This is to satisfy programs build and run dependencies but to keep the installed footprint small on the target system(s). However, the data is required to make the ICU library useful - and thus directly affects PHPs ICU extension, too - so consider to also select/install package 'icu-full-data'.
php8-mod-ldap - 8.0.13-1 - LDAP shared module
php8-mod-mbstring - 8.0.13-1 - MBString shared module
php8-mod-mysqli - 8.0.13-1 - MySQL Improved Extension shared module
php8-mod-mysqlnd - 8.0.13-1 - MySQL Native Driver shared module
php8-mod-opcache - 8.0.13-1 - OPcache shared module
php8-mod-openssl - 8.0.13-1 - OpenSSL shared module
php8-mod-pcntl - 8.0.13-1 - PCNTL shared module
php8-mod-pdo - 8.0.13-1 - PHP Data Objects shared module
php8-mod-pdo-mysql - 8.0.13-1 - PDO driver for MySQL shared module
php8-mod-pdo-pgsql - 8.0.13-1 - PDO driver for PostgreSQL shared module
php8-mod-pdo-sqlite - 8.0.13-1 - PDO driver for SQLite 3.x shared module
php8-mod-pgsql - 8.0.13-1 - PostgreSQL shared module
php8-mod-phar - 8.0.13-1 - Phar Archives shared module
php8-mod-session - 8.0.13-1 - Session shared module
php8-mod-shmop - 8.0.13-1 - Shared Memory shared module
php8-mod-simplexml - 8.0.13-1 - SimpleXML shared module
php8-mod-snmp - 8.0.13-1 - SNMP shared module
php8-mod-soap - 8.0.13-1 - SOAP shared module
php8-mod-sockets - 8.0.13-1 - Sockets shared module
php8-mod-sqlite3 - 8.0.13-1 - SQLite3 shared module
php8-mod-sysvmsg - 8.0.13-1 - System V messages shared module
php8-mod-sysvsem - 8.0.13-1 - System V shared memory shared module
php8-mod-sysvshm - 8.0.13-1 - System V semaphore shared module
php8-mod-tokenizer - 8.0.13-1 - Tokenizer shared module
php8-mod-xml - 8.0.13-1 - XML shared module
php8-mod-xmlreader - 8.0.13-1 - XMLReader shared module
php8-mod-xmlwriter - 8.0.13-1 - XMLWriter shared module
php8-mod-zip - 8.0.13-1 - ZIP shared module
BUT take care about incompatibility and change in some numeric/text test from 7 to 8

Philippe.
Asustor updated :D to ADM 5.0
FS6706T / AS3302Tv2 / AS5202T / AS6602T
Asustor E.O.L. at A.D.M. 4.0 :(
AS5002T / AS1002T
Asustor past :mrgreen:
AS202T
ov2rey
Posts: 27
Joined: Fri Aug 05, 2016 11:13 am

Re: How to update PHP version to 8?

Post by ov2rey »

Do it work on wordpress?

How do i install Entware APKG an opkg package php8 8.0.13?
father.mande wrote:Hi,
ov2rey wrote:How to update PHP to latest version 8?
ASUSTOR PHP apps version is outdated running version 7
Before a new Asustor delivery, you can use Entware APKG an opkg package php8 8.0.13
php8 - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains only the PHP config file. You must actually choose your PHP flavour (cli, cgi or fastcgi). Please note, that installing php5 and php8 in parallel on the same target is not supported in OpenWrt/LEDE/Entware.
php8-cgi - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the CGI version of the PHP8 interpreter.
php8-cli - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the CLI version of the PHP8 interpreter.
php8-fastcgi - 8.0.13-1 - As FastCGI support is now a core feature the php8-fastcgi package now depends on the php8-cgi package, containing just the startup script.
php8-fpm - 8.0.13-1 - PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This package contains the FastCGI Process Manager of the PHP8 interpreter.
php8-mod-bcmath - 8.0.13-1 - Bcmath shared module
php8-mod-calendar - 8.0.13-1 - Calendar shared module
php8-mod-ctype - 8.0.13-1 - Ctype shared module
php8-mod-curl - 8.0.13-1 - cURL shared module
php8-mod-dom - 8.0.13-1 - DOM shared module
php8-mod-exif - 8.0.13-1 - EXIF shared module
php8-mod-fileinfo - 8.0.13-1 - Fileinfo shared module
php8-mod-filter - 8.0.13-1 - Filter shared module
php8-mod-ftp - 8.0.13-1 - FTP shared module
php8-mod-gd - 8.0.13-1 - GD graphics shared module
php8-mod-gettext - 8.0.13-1 - Gettext shared module
php8-mod-gmp - 8.0.13-1 - GMP shared module
php8-mod-iconv - 8.0.13-1 - iConv shared module
php8-mod-imap - 8.0.13-1 - IMAP shared module
php8-mod-intl - 8.0.13-1 - Note that this package depends in ICU library which is built without data by default. This is to satisfy programs build and run dependencies but to keep the installed footprint small on the target system(s). However, the data is required to make the ICU library useful - and thus directly affects PHPs ICU extension, too - so consider to also select/install package 'icu-full-data'.
php8-mod-ldap - 8.0.13-1 - LDAP shared module
php8-mod-mbstring - 8.0.13-1 - MBString shared module
php8-mod-mysqli - 8.0.13-1 - MySQL Improved Extension shared module
php8-mod-mysqlnd - 8.0.13-1 - MySQL Native Driver shared module
php8-mod-opcache - 8.0.13-1 - OPcache shared module
php8-mod-openssl - 8.0.13-1 - OpenSSL shared module
php8-mod-pcntl - 8.0.13-1 - PCNTL shared module
php8-mod-pdo - 8.0.13-1 - PHP Data Objects shared module
php8-mod-pdo-mysql - 8.0.13-1 - PDO driver for MySQL shared module
php8-mod-pdo-pgsql - 8.0.13-1 - PDO driver for PostgreSQL shared module
php8-mod-pdo-sqlite - 8.0.13-1 - PDO driver for SQLite 3.x shared module
php8-mod-pgsql - 8.0.13-1 - PostgreSQL shared module
php8-mod-phar - 8.0.13-1 - Phar Archives shared module
php8-mod-session - 8.0.13-1 - Session shared module
php8-mod-shmop - 8.0.13-1 - Shared Memory shared module
php8-mod-simplexml - 8.0.13-1 - SimpleXML shared module
php8-mod-snmp - 8.0.13-1 - SNMP shared module
php8-mod-soap - 8.0.13-1 - SOAP shared module
php8-mod-sockets - 8.0.13-1 - Sockets shared module
php8-mod-sqlite3 - 8.0.13-1 - SQLite3 shared module
php8-mod-sysvmsg - 8.0.13-1 - System V messages shared module
php8-mod-sysvsem - 8.0.13-1 - System V shared memory shared module
php8-mod-sysvshm - 8.0.13-1 - System V semaphore shared module
php8-mod-tokenizer - 8.0.13-1 - Tokenizer shared module
php8-mod-xml - 8.0.13-1 - XML shared module
php8-mod-xmlreader - 8.0.13-1 - XMLReader shared module
php8-mod-xmlwriter - 8.0.13-1 - XMLWriter shared module
php8-mod-zip - 8.0.13-1 - ZIP shared module
BUT take care about incompatibility and change in some numeric/text test from 7 to 8

Philippe.
User avatar
father.mande
Posts: 2219
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: How to update PHP version to 8?

Post by father.mande »

Hi,
Entware is an APKG available for all platform in AppCentral, so install as usual
when installed, just open a new terminal (ssh) with admin or root user your_admin_password, then use opkg tool as package manager
ex.
opkg iupdate (update list & version of packages)
opkh upgrade ... upgrade all package with an available update ... do this two command regularly
opkg install pakage_name (ex. php8 php8-mod-xxx ... etc. etc.

For ADM apache (if you don't use the apache provide in Entware, change the path to php and create if need link with extension ex. .php to 8, .php7 to 7 etc. etc.
generally for ADM 4.x in /usr/local/AppCentral/httpd-2.4.43/data/conf/mods-available/php.conf PATH and FilesMatch (if lib, path is generally /opt/lib/xxxx.so or in /opt/lib/xxx folder or file for Etnare package)

In some applications it's possible to define the php path to use inside the application ... search for each ...

Philippe.
Asustor updated :D to ADM 5.0
FS6706T / AS3302Tv2 / AS5202T / AS6602T
Asustor E.O.L. at A.D.M. 4.0 :(
AS5002T / AS1002T
Asustor past :mrgreen:
AS202T
Bennas
Posts: 8
Joined: Sun Nov 10, 2019 5:34 pm

Re: How to update PHP version to 8?

Post by Bennas »

Hi !
I have PHP 7 from App Central running on my AS5002T. I know I cannot expect PHP 8 updates anymore so I followed your advice to install PHP 8 through Entware.

Problem : No error or warning but PHP 8 does not seem to be set up properly.
entware/opt/etc/php.ini is present but I can't find extension_dir = "/opt/lib/php8" for example.

If I check its status, I get this

Code: Select all

root@AS5002T:/volume1/.@root # opkg status php8
Package: php8
Version: 8.1.7-2
Depends: libc, libssp, librt, libpthread, libpcre2, zlib, libxml2, zoneinfo-core
[b]Conflicts: php7[/b]
Status: install user installed
Architecture: x64-3.2
Conffiles:
 /opt/etc/php.ini 93d9e22f3b4bfe0b19be4f508f5a9fa23ab85df3776ca2d65df47691121dfae3
Installed-Time: 1668589005
I tried removing php7 from ADM but I can't do that without removing other much needed apps at the same time.

My original problem is : I updated Nextcloud in App Central (available, v. 25) but it won't upgrade because it needs PHP 7.4+ (not available for AS50...). No Nextcloud 24 apkg available to downgrade... I'm stuck here

If anyone can please help (getting php8 working would be the best solution IMO)...
User avatar
father.mande
Posts: 2219
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: How to update PHP version to 8?

Post by father.mande »

Hi,

Install a mod ... and after you can have /opt/lib/php8 and the module inside ...

to get the full list of file created ... do : find -L /opt/ -name *php*
to get full list of mod do : opkg list | grep php8 ( grep mod or cut -f 1-15 -d " " to have a shortest explain) ...

Take care that apache-mod-php8 ... don't go to lib/php8 but in /opt/lib/apache2/libphp.so

this is for the Apache provide by Entware, but can be used by Apache provide by Asustor by changing the configuration file with the path.

Philippe.
NB don't hesitate to put question in github Entware or openwrt ...
Asustor updated :D to ADM 5.0
FS6706T / AS3302Tv2 / AS5202T / AS6602T
Asustor E.O.L. at A.D.M. 4.0 :(
AS5002T / AS1002T
Asustor past :mrgreen:
AS202T
Bennas
Posts: 8
Joined: Sun Nov 10, 2019 5:34 pm

Re: How to update PHP version to 8?

Post by Bennas »

Thanks a lot for your quick reply.
I can install a module without any problem.

I get stuck at
For ADM apache (if you don't use the apache provide in Entware, change the path to php and create if need link with extension ex. .php to 8, .php7 to 7 etc. etc.
generally for ADM 4.x in /usr/local/AppCentral/httpd-2.4.43/data/conf/mods-available/php.conf PATH and FilesMatch (if lib, path is generally /opt/lib/xxxx.so or in /opt/lib/xxx folder or file for Etnare package)
I did found php.conf and I think the file need to look something like this :

Code: Select all

LoadModule php_module /opt/lib/libphp8.so
LoadModule php7_module /usr/local/AppCentral/php7/libphp7.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
except libphp8.so doesn't exist at /opt/lib/libphp8.so

Obviously if I try to run the upgrade command for nextcloud (./occ upgrade), all I get is : "This version of Nextcloud requires at least PHP 7.4<br/>You are currently running 7.3.33. Please update your PHP version."

If anyone cares to explain what I'm missing...
User avatar
father.mande
Posts: 2219
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: How to update PHP version to 8?

Post by father.mande »

Hi,

As I write ... but not clearly, the PHP8 Apache module is not in /opt/lib, but directly in /opt/lib/apache2 folder
Also the name is libphp.so but you can create a link to change the name (I don't know if changing really the name can be a problem) ...

so to keep your need for ex. do (after opkg install apache-mod-php8 ... if you don't do it one time before
ln -s /opt/lib/apache2/libphp.so /opt/lib/libphp8.so ... so now the line "LoadModule php_module /opt/lib/libphp8.so" will be now correct ...
ATTENTION you need certainly some php8 modules, so list the php7 existing one to install the same or look at nextcloud site if list of modules require exist.

Also don't forgot to restart ADM apache ... THE PROBLEM IS
/usr/local/AppCentral/httpd-2.4.43/CONTROL/start-stop.sh ... have only start working (stop and restart are NOP)
AND apachectl is not provide in ADM ...

A reboot is a solution (it's why I prefer using apache (2.4.52) but update can come ... tool like apchectl are include (stop stop / start etc.) ... even Asustor provide 2.4.54 (even APKG is name httpd-2.4.43)

Philippe.
Asustor updated :D to ADM 5.0
FS6706T / AS3302Tv2 / AS5202T / AS6602T
Asustor E.O.L. at A.D.M. 4.0 :(
AS5002T / AS1002T
Asustor past :mrgreen:
AS202T
User avatar
Nazar78
Posts: 2235
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Re: How to update PHP version to 8?

Post by Nazar78 »

Just to add few things:

1. Unless you know what you're doing, modifying to upgrade to PHP8 could break some other apps you install from the App Store due to ADM dependencies. Best is to run a separate latest instance of Apache2 and PHP8 (or even MariaDB), i.e. in Entware (simpler, much less overhead, but needs some manual setup and maintenance like configuring the app's requirements), chroot/LXC (more versatile but need lots of understanding) or docker container (easily done in ADM of course with the Nextcloud official image, includes Apache2 and PHP8-FPM, which is frequently updated where you can do automatically pull).

2. Related to point 1, you shouldn't use two different versions of PHP-mod, it will load but it could cause segment fault. To run them simultaneously, you'll need to switch the SAPI to FPM-mod and a way to differentiate the instances i.e. in MIME handler.

3. Even v2.4.43 `/usr/local/AppCentral/httpd-2.4.43/CONTROL/start-stop.sh start` doesn't work, it's missing the asustor.conf file read from `confutil`. Think it's a misconfiguration from Asustor when they introduce the recent Web Center where everything is now triggered from there. So instead of modifying it to work, I would use `/usr/local/AppCentral/httpd-2.4.43/data/binary/sbin/apache2 [-k start|restart|graceful|graceful-stop|stop]` (you need to specify the full path so it knows where to look for the config or provide one with the -f switch) or to just reload the conf by sending hang up signal to the PID `kill -1 $(cat /usr/local/AppCentral/httpd-2.4.43/data/var/run/apache2/httpd.pid)` (or simply `killall -1 apache2`).

Just to note, I'm not using Apache on the Asustor (I'm running Nginx in chroot) but have used it on several other platforms.
AS5304T - 16GB DDR4 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response