Enable PHP ZIP extension

897 views
Skip to first unread message

sebast...@gmail.com

unread,
Jan 30, 2020, 1:56:15 PM1/30/20
to PHP Desktop
Hi
I am building my PHP APP with phpdesktop,

When I tried to use ZipArchive PHP class it gives nor found Class error.

So I used this to check if zip extension is installed
echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';

And this tells me that extension is not installed/enabled

The thing is that if I do the same in LAMPP, it shows extension as  installed/enabled.

I could confirm this viewing phpinfo()

Many extensions are missing in phpdesktop while they are present in LAMPP

I tried editing php.ini but couldn´t make it

Please help. I really would like to use phpdesktop

Thanks in advance

Czarek Tomczak

unread,
Jan 30, 2020, 8:36:16 PM1/30/20
to PHP Desktop
What PHP Desktop version and what OS?

Sebas Rossi

unread,
Jan 31, 2020, 1:39:51 AM1/31/20
to PHP Desktop
Thanks for reply-

I have installed in /etc  folder of mi linux Manjaro/Arch  latest PHP version. .

php -v

Outputs:

PHP 7.4.2 (cli) (built: Jan 21 2020 18:16:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies





Czarek Tomczak

unread,
Jan 31, 2020, 4:32:44 AM1/31/20
to PHP Desktop
To enable more extensions modify the build-php-with-ext.sh script which builds PHP. It's in the linux72 branch. See: https://github.com/cztomczak/phpdesktop/blob/linux72/build-php-with-ext.sh

Sebas Rossi

unread,
Jan 31, 2020, 9:11:59 AM1/31/20
to PHP Desktop

I´m not experienced user of linux, but I do know that Manjaro/Arch does not uses apt-get

So I can hardly follow instructions in https://github.com/cztomczak/phpdesktop/blob/linux72/build-php-with-ext.sh .

I could handle the Postgresql extension this way:
 
sudo pacman
-S postgresql


But can´t find the build-php-with-ext.sh file to edit

¿Did I miss something

Here is what I have:



Czarek Tomczak

unread,
Jan 31, 2020, 8:27:29 PM1/31/20
to PHP Desktop
Linux is hard. If you want an easy way choose Windows :)

Sebas Rossi

unread,
Feb 1, 2020, 7:20:35 AM2/1/20
to PHP Desktop
You are soooo  right   Lol.

I think I´ll install Windows only to use phpdesktop.. 
I really liked it, it´s great.

Thanks !

Czarek Tomczak

unread,
Feb 1, 2020, 8:26:58 AM2/1/20
to PHP Desktop
PHP Desktop works fine. Your problem is with PHP. If you're developing on Linux you have to learn how to build PHP from sources and how to use package managers etc.

Sebas Rossi

unread,
Feb 1, 2020, 10:28:42 AM2/1/20
to PHP Desktop
I still don´t understand what s going on.

All extensions are installed in PHP. As I can confirm using phpinfo() or php -m

As I could deduce, phpdesktop is using same PHP installation than LAMPP, since it´s only PHP installation I have.

But in LAMPP all extensions are present,  phpdesktop, no.



Czarek Tomczak

unread,
Feb 1, 2020, 10:58:30 AM2/1/20
to PHP Desktop
PHP is in the php/ directory and you can put any PHP version you like there. You should ask on a general PHP forums if you're having issues with PHP.

Czarek Tomczak

unread,
Feb 1, 2020, 11:00:12 AM2/1/20
to PHP Desktop
Sorry on Linux we don't ship php/ directory, only on Windows. On Linux you have php binaries and you can replace them. You can set location to PHP via settings.json file.

Czarek Tomczak

unread,
Feb 1, 2020, 11:03:43 AM2/1/20
to PHP Desktop
PHP binary must support the CGI interface, so not all binaries will work. Binaries from apache instlalation probably won't work. I can't help you more at the moment.

Czarek Tomczak

unread,
Feb 1, 2020, 11:20:05 AM2/1/20
to PHP Desktop
The easiest way for you would be to find an existing php-cgi executable from some package, project or application already installed on your OS. For example with the "sudo find / -name php-cgi" command you can search your whole filesystem for php-cgi binary already installed somewhere. On my Ububntu it found these:

/usr/bin/php-cgi
/etc/alternatives/php-cgi
/var/lib/dpkg/alternatives/php-cgi

So I've executed:

/etc/alternatives/php-cgi -i > phpinfo.html
google-chrome phpinfo.html

To check what version of PHP that was and what extensions it has enabled by default. Turns out it has lots of extensions enabled and it includes the ZIP extension you're looking for. So the steps to make it work would be to copy that php-cgi to phpdesktop directory and point to it by editing settings.json "cgi_interpreter" option. I suggest you do the same on your OS and you should have it working in no time.

Czarek Tomczak

unread,
Feb 1, 2020, 11:21:50 AM2/1/20
to PHP Desktop
If you don't find php-cgi on your OS try to search for packages like "php-cgi" or "php7-cgi" or similar names that include "cgi" and "php" keywords, using your OS package manager.

Czarek Tomczak

unread,
Feb 1, 2020, 11:36:39 AM2/1/20
to PHP Desktop

Sebas Rossi

unread,
Feb 1, 2020, 11:58:34 AM2/1/20
to PHP Desktop
Great !
Many, many thanks for your detailed explanation.

I´ll try again later.

B. Regards

mapou...@gmail.com

unread,
Mar 5, 2020, 6:23:07 AM3/5/20
to PHP Desktop
Thank you. having the same issue, I follow your step and now zlib extension is enabled.
Reply all
Reply to author
Forward
0 new messages