How to install zip extension for PHP7

Specifically for LAMP stack / webmin

First, install the module

sudo apt-get install php7.0-zip

Then restart the web server

sudo service apache2 restart
sudo service nginx restart

That’s it!

WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available

Reason: This module is not available for PHP 7.2 yet, you need to install the 7.1 version and link it to 7.2

 

Pointing to php7.1-mcrypt with php7.2 will solve the issue here. Below are the steps to configure 7.1 version mcrypt with php7.2

Install php7.1-mcrypt

sudo apt install php7.1-mcrypt

Create symbolic link to php7.1-mcrypt

sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available/

Enable mcrypt extension

sudo phpenmod mcrypt

Thanks StackOverflow!

Bug in PHP My admin on Ubuntu 18.04

I got this error every time I tried to query a table in PHPMyAdmin

Warning in ./libraries/sql.lib.php#601
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',

Turns out there’s a but in the PHP My Admin version that comes with Ubuntu 18.04 running on PHP 7.2

You need to edit /usr/share/phpmyadmin/libraries/sql.lib.php

Replace: (count($analyzed_sql_results['select_expr'] == 1) With:(count($analyzed_sql_results['select_expr']) == 1

 

Screen Shot 2018-06-26 at 4.13.04 PM.png

Thanks StackOverflow!

PHP result in blank page and 404 in nginx

If I go to a .php file, I got a blank page, if I add a query string ?something=something I got a 404.

I tried to search this error with the script I was trying to use on Google to no avail… and then I added this line

error_log /var/log/nginx/site.name-error.log error;

Who would have thought? Missing the error log result in a blank page!

Toy box

After finishing 7 years worth of Megatokyo drawings (you might have seen from the last post :P), I decided to wrap things up and finished polishing my toybox

It’s a collection of stuff I code from time to time. They were usable before, but wasn’t integrated and their look was so Web 1.0, I always wanted to “renew” them a little, now I am finally in the right condition to get it done :).

At the time of this post, my toy box contains:

You may read more about them from their page. If you have any comment for them, you can leave them here