Tag: PHP

phpMyAdmin and PHP 7 issues

Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”

It’s possible that when you installed phpMyAdmin, the version in the repository (phpMyAdmin v4.6.6) was not fully compatible with PHP 7.2. There is a newer version available on the official website (v4.8 as of writing), which fixes these compatibility issues with PHP 7.2.

This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php. If you don’t want to wait for the repositories to update with the latest version, you can manually upgrade to the latest version of phpMyAdmin yourself. Alternatively, you can make a small change to sql.lib.php to fix the error. Firstly, backup sql.lib.php before editing. sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak Edit sql.lib.php in…

Continue reading Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”

Installing Nginx, MySQL, PHP (LEMP) Stack on Ubuntu 18.04

Installing Nginx, MySQL, PHP (LEMP) Stack on Ubuntu 18.04

Ubuntu Server 18.04 LTS (Bionic Beaver) is finally here and is being rolled out across VPS hosts such as DigitalOcean and AWS. In this guide we will install a LEMP Stack (Nginx, MySQL, PHP) and configure a web server.

Video Tutorial

Prerequisites You should use a non-root user account with sudo privileges. Please see the Initial server setup for Ubuntu 18.04 guide for more details. 1. Install Nginx Let’s begin by updating the package lists and installing Nginx on Ubuntu 18.04. Below we have two commands separated by &&. The first command will update the package lists to ensure you…

Continue reading Installing Nginx, MySQL, PHP (LEMP) Stack on Ubuntu 18.04

Installing PHP for Nginx on Ubuntu 18.04

Installing PHP for Nginx on Ubuntu 18.04

In this guide we will install and configure PHP to work with Nginx on Ubuntu 18.04 LTS (Bionic Beaver). Unlike Apache, Nginx does not contain native PHP processing. For that we have to install PHP-FPM (FastCGI Process Manager). FPM is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites.

1. Install PHP-FPM Let’s begin by updating the package lists and installing PHP-FPM on Ubuntu 18.04. Below we have two commands separated by &&. The first command will update the package lists to ensure you get the latest version and dependencies for PHP-FPM. The second command will then download and install PHP-FPM. Press y and ENTER when asked to…

Continue reading Installing PHP for Nginx on Ubuntu 18.04

Installing Apache, MySQL, PHP (LAMP) stack on Ubuntu 18.04

Installing Apache, MySQL, PHP (LAMP) Stack on Ubuntu 18.04

Ubuntu Server 18.04 LTS (Bionic Beaver) is finally here and is being rolled out across VPS hosts such as DigitalOcean and AWS. In this guide we will install a LAMP Stack (Apache, MySQL, PHP) and configure a web server.

Video Tutorial

Prerequisites You should use a non-root user account with sudo privileges. Please see the Initial server setup for Ubuntu 18.04 guide for more details. 1. Install Apache Let’s begin by updating the package lists and installing Apache on Ubuntu 18.04. Below we have two commands separated by &&. The first command will update the package lists to ensure you get…

Continue reading Installing Apache, MySQL, PHP (LAMP) Stack on Ubuntu 18.04

Installing PHP for Apache on Ubuntu 18.04 Server

Installing PHP for Apache on Ubuntu 18.04 Server

In this guide we will install PHP 7 and configure it to work with the Apache web server on Ubuntu Server 18.04 (Bionic Beaver). The PHP Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic and interactive Web pages. As of 2018, PHP was used as the server-side programming language on 85% of 10 million most popular websites!

Video Tutorial

Prerequisites You should use a non-root user account as explained in the Ubuntu 18.04 Initial Server Setup. You should also have Apache already installed and be able to access a test web page in your browser as explained in our guide Installing Apache on Ubuntu 18.04 Server with Virtual Hosts. 1. Install PHP Let’s begin by…

Continue reading Installing PHP for Apache on Ubuntu 18.04 Server

PHP Fatal error: Uncaught Error: Call to undefined function curl_init()

This error indicates that the curl PHP extension is not installed. curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction. To install the curl extension,…

Continue reading PHP Fatal error: Uncaught Error: Call to undefined function curl_init()

Enable PHP short open tags in PHP.ini

How to enable PHP short open tag (short_open_tag)?

PHP short open tags is deprecated feature of PHP and is strongly discouraged. It’s been recommended for several years that you not use the short tag “short cut” and instead to use the full <?php and ?> tag combination.

With the wide spread use of XML and use of these tags by other languages, the server can become easily confused and end up parsing the wrong code in the wrong context. But because this short cut has been a feature for such a long time, it’s currently still supported for backwards compatibility, but we…

Continue reading How to enable PHP short open tag (short_open_tag)?

Guide: Installing PHP for Apache (Ubuntu 16.04 / 17.10)

In this guide we will install and configure PHP for Apache on  Ubuntu 16.04 / 17.10. 1. Install PHP Let’s begin by updating the package lists. sudo apt-get update Now install PHP and associated packages. sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql 2. Configure Apache We will need to alter the dir.conf file to tell Apache…

Continue reading Guide: Installing PHP for Apache (Ubuntu 16.04 / 17.10)

PHP / Apache: set max file upload and post size

Firstly, you need to locate your php.ini file. In this example, our php.ini file is located in /etc/php/7.2/apache2/php.ini sudo nano /etc/php/7.2/apache2/php.ini In nano, press CTRL + W and search for upload_max_filesize and change the value to 64M (for 64 megabytes). /etc/php/7.2/apache2/php.ini … upload_max_filesize = 64M … Press CTRL + W again and search for post_max_size and…

Continue reading PHP / Apache: set max file upload and post size