Friday, January 22, 2016

Joomla: Fix "Allowed memory size exhausted" PHP error (increase memory_limit safely)

I hosted my website on a Linux server. While I accessed the Contact us page of the site I got the error below:

"Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php"

The error message included the full path to the PHP file, for example: public_html//plugins/system/xyz.php and the line number where the error occurred (in my case it was line 79).

What this error means

PHP enforces a memory limit per process (memory_limit). The message "Allowed memory size of 33554432 bytes exhausted" means a PHP script tried to use more than the configured limit (here 33554432 bytes = 32M).

Common causes:

  • Large data processing (big arrays, large file handling, image processing).
  • A plugin or extension requiring more memory.
  • A bug or infinite loop that consumes memory.
  • A default server-level limit (especially on shared hosting).

Quick, safe fixes (in recommended order)

1) Diagnose first

  • Check the file and the reported line number (e.g., public_html//plugins/system/xyz.php line 79). Look for obvious loops, large allocations or file reads.
  • Temporarily enable error reporting or check logs for fuller stack traces.
  • Use phpinfo() (create a small PHP file with ) to see the configured memory_limit.

2) Increase memory for a single script (temporary)

If you need a quick temporary increase for debugging, you can add an ini_set call near the top of the script that triggers the error. Example (original author snippet):

ini_set('memory_limit', '-1');

Warning: iniset('memorylimit', '-1') removes the limit entirely. This is not recommended on production systems because it can allow runaway processes to consume all server RAM. Prefer setting a specific larger limit, for example:

ini_set('memory_limit', '128M');

Place the iniset line just before the memory-intensive operation or near the top of the plugin file reported in the error (for example, just above line 79 in publichtml//plugins/system/xyz.php). This change affects only the running PHP process executing that file.

3) Make a permanent server-level change (preferred when you control the server)

  • php.ini (global change):

Open your php.ini and change or add:

memory_limit = 128M

Restart the web server (apache/nginx + php-fpm) after changing php.ini.

  • .htaccess (if PHP runs as an Apache module and your host allows it):
php_value memory_limit 128M
  • Joomla configuration (depending on setup):

If you cannot change system files, you can try adding iniset calls in a central place that runs early (but be cautious). On some hosts iniset is disabled.

4) Contact your hosting provider

If you are on shared hosting, the host may enforce a hard limit. Contact support to request a memory increase or upgrade your plan.

Diagnostic steps to avoid simply raising the limit

  • Review the plugin code (here: plugins/system/xyz.php). Try disabling the plugin temporarily to confirm it is the source.
  • Search for large data structures or excessive recursion.
  • Update the extension or check for known bugs.
  • If the operation is intended (e.g., processing very large files), consider reworking the code to use streaming, chunked processing, or temporary files instead of keeping everything in memory.

Example: where to insert ini_set in a plugin file

Open the PHP file referenced in the error (e.g., publichtml//plugins/system/xyz.php) and add an iniset line near the top, before the memory-intensive code runs. For example:

<?php
// plugins/system/xyz.php

// Temporary increase - prefer specific value over -1
ini_set('memory_limit', '128M');

// rest of the plugin code ...

Again: prefer a specific limit (e.g., 128M) over '-1'. Use '-1' only for controlled debugging on a development machine.

Safety and rollback

  • Always make a backup of any file before editing.
  • Test changes on a development or staging site first.
  • If you added ini_set and the page works, use that as a temporary measure while you find the root cause. Remove or reduce the override once you address the memory usage.

Summary checklist

  • Verify file and line number from the error message.
  • Inspect code for loops or big allocations.
  • Try a temporary iniset('memorylimit', '128M') if you control the environment.
  • Prefer changing php.ini or .htaccess for permanent needs.
  • Contact your host if limits are enforced at the server level.
  • Fix the root cause (optimize code, update plugin) rather than permanently removing limits.

That's it. Happy Coding

Thursday, January 21, 2016

How to Enable Google's reCAPTCHA in Joomla — Step‑by‑Step

Introduction

Captcha’s are parts of a website where you sometimes need to type in a word or recognize the images to prove you're a human. Captchas are a great way to prevent spam activity on your website because most "bots" that attempt to post spam cannot read the letters contained in the captcha image.

For years, using Captcha sites prompted users to confirm they aren’t robots by asking them to read distorted text and type it into a box.

Example of a text-based CAPTCHA

But Google released a new API that simplifies the reCAPTCHA experience by just directly asking the users whether or not they are robots. They called it "No CAPTCHA reCAPTCHA". This is how it looks:

No CAPTCHA reCAPTCHA checkbox example

In this article we're going to walk you through the steps for enabling CAPTCHA / reCAPTCHA (Google) in Joomla.

Prerequisites

  • A Joomla administrator account with access to Extensions > Plugin Manager and System > Global Configuration.
  • A Google account to create reCAPTCHA keys (Site key and Secret key).

Obtain your reCAPTCHA keys

  1. Sign in with your Google account at the Google reCAPTCHA admin panel and register your site to obtain Site and Secret keys:

Create a reCAPTCHA key: https://www.google.com/recaptcha/admin#list

  1. When registering, add your website domain and choose the appropriate reCAPTCHA type (the article refers to the No CAPTCHA checkbox flow; Google now offers v2/v3 and Invisible reCAPTCHA — confirm the current choice in Google's admin).

Step-by-step: Enable reCAPTCHA in Joomla

  1. Log in to your Joomla administrator back-end.

  2. Go to Extensions > Plugin Manager (or find Plugin Manager from the Control Panel).

Joomla Plugin Manager screenshot

  1. Edit the "Captcha - ReCaptcha" plugin.

Edit Captcha ReCaptcha plugin screenshot

a) Set Status to "Enabled".

b) Copy and paste the Site Key and Secret Key from the Google reCAPTCHA admin into their appropriate fields in the plugin settings.

  • You will get the Site and Secret keys by signing in with your Google account here: https://www.google.com/recaptcha/admin#list
  • Once you have registered your website domain, Google will provide your reCAPTCHA keys.

c) Click Save & Close.

Configure Global settings (Contact forms and Registration)

  1. To enable reCAPTCHA for Contact forms and Registration:

a) Go to System > Global Configuration and select the "Site" tab.

Global Configuration - Site tab screenshot

b) In the Default Captcha field choose "Captcha - ReCaptcha".

Default Captcha selection screenshot

c) Click Save & Close.

Configure Registration form-specific behavior

  1. To control reCAPTCHA behavior specifically for user registration (if you need different behavior from the Global Configuration):

a) Go to Users > User Manager.

User Manager screenshot

b) Click "Options" and open the Component tab.

User component options screenshot

c) In the Component tab choose one of the Captcha options:

  • Use Default — follows the Default Captcha setting in Global Configuration.
  • None Selected — ignores the Default Captcha; use this if you want reCAPTCHA in Contact forms but not in Registration.
  • Captcha - ReCaptcha — forces reCAPTCHA for registration even if Global Configuration is set to None.

User component captcha choices screenshot

Click Save & Close.

Troubleshooting and verification

  • Verify the Site and Secret keys are correct and correspond to the registered domain in the Google admin panel.
  • Clear Joomla cache and browser cache after saving plugin/global settings.
  • If reCAPTCHA does not appear, confirm the Captcha plugin is "Enabled" in Plugin Manager and that another extension is not conflicting.
  • Test your Contact form and the Registration form to ensure the reCAPTCHA widget displays and submission succeeds.

Notes

  • The article refers to Google's "No CAPTCHA reCAPTCHA" (checkbox flow). Google offers multiple reCAPTCHA variants (v2 checkbox, Invisible reCAPTCHA, and v3). Confirm the reCAPTCHA type you registered in the Google admin panel before copying keys.

  • Official Google reCAPTCHA admin: https://www.google.com/recaptcha/admin#list

That's it!

Wednesday, January 20, 2016

Android Studio Installation — Setup Guide for Windows, macOS & Linux

Earlier I used to develop android applications using Eclipse IDE. Recently Google has released their own android IDE called as Android Studio. This is now the official Android IDE. So I installed Android Studio and thought of recording and sharing the steps. Here we go.

Android Studio welcome image

Table of Contents

Why Android Studio

Code editor screenshot

At the core of Android Studio is an intelligent code editor capable of advanced code completion, refactoring, and code analysis. The powerful code editor helps you be a more productive Android app developer.

  1. Intelligent code editor

Project templates and GitHub integration

  1. Code templates and GitHub integration

New project wizards make it easier than ever to start a new project. Start projects using template code for patterns such as navigation drawer and view pagers, and even import Google code samples from GitHub.

  1. Multi-screen app development

Multi-screen layout editor

Build apps for Android phones, tablets, Android Wear, Android TV, Android Auto and Google Glass. With the new Android Project View and module support in Android Studio, it's easier to manage app projects and resources.

  1. Virtual devices for all shapes and sizes

AVD Manager and emulator screenshot

Android Studio comes pre-configured with an optimized emulator image. The updated and streamlined Virtual Device Manager provides pre-defined device profiles for common Android devices.

  1. Android builds evolved, with Gradle

Gradle build system screenshot

Create multiple APKs for your Android app with different features using the same project. Manage app dependencies with Maven. Build APKs from Android Studio or the command line.

More About the Studio

  • Built on IntelliJ IDEA Community Edition, the popular Java IDE by JetBrains.
  • Flexible Gradle-based build system.
  • Build variants and multiple APK generation.
  • Expanded template support for Google Services and various device types.
  • Rich layout editor with support for theme editing.
  • Lint tools to catch performance, usability, version compatibility, and other problems.
  • ProGuard and app-signing capabilities.
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine.

System Requirements

Windows

  • Microsoft® Windows® 8/7/Vista (32 or 64-bit)
  • 2 GB RAM minimum, 4 GB RAM recommended
  • 400 MB hard disk space
  • At least 1 GB for Android SDK, emulator system images, and caches
  • 1280 x 800 minimum screen resolution
  • Java Development Kit (JDK) 7
  • Optional for accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality

Mac OS X

  • Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks)
  • 2 GB RAM minimum, 4 GB RAM recommended
  • 400 MB hard disk space
  • At least 1 GB for Android SDK, emulator system images, and caches
  • 1280 x 800 minimum screen resolution
  • Java Runtime Environment (JRE) 6
  • Java Development Kit (JDK) 7
  • Optional for accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality

On Mac OS, run Android Studio with Java Runtime Environment (JRE) 6 for optimized font rendering. You can then configure your project to use Java Development Kit (JDK) 6 or JDK 7.

Linux

  • GNOME or KDE desktop
  • GNU C Library (glibc) 2.15 or later
  • 2 GB RAM minimum, 4 GB RAM recommended
  • 400 MB hard disk space
  • At least 1 GB for Android SDK, emulator system images, and caches
  • 1280 x 800 minimum screen resolution
  • Oracle® Java Development Kit (JDK) 7

Installing Android Studio

Android Studio provides everything you need to start developing apps for Android, including the Android Studio IDE and the Android SDK tools. If you didn't download Android Studio, go download Android Studio now, or switch to the stand-alone SDK Tools install.

Before you set up Android Studio, be sure you have installed JDK 6 or higher (the JRE alone is not sufficient)—JDK 7 is required when developing for Android 5.0 and higher. To check if you have JDK installed (and which version), open a terminal and type:

javac -version

If the JDK is not available or the version is lower than version 6, download the Java SE Development Kit 7: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

General notes before setup

  • Android Studio provides the IDE and manages SDK packages. Individual tools and other SDK packages are saved outside the Android Studio application directory (for example, \Users\\sdk\ on Windows or /Users//Library/Android/sdk/ on macOS).
  • If your launcher script does not find Java on Windows, set the JAVAHOME environment variable to point to your JDK installation (for example C:\Program Files\Java\jdk1.7.021).

To set up Android Studio on Windows:

  1. Launch the .exe file you just downloaded.
  2. Follow the setup wizard to install Android Studio and any necessary SDK tools. I have installed it on Windows 10. Here are the steps as below:

Android Studio installer step

Once you launched Android Studio, it's time to mention JDK path in android studio installer.

JDK path dialog

Below the image initiating JDK to android SDK:

JDK setup screenshot

On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location.

Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVAHOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.021.

The individual tools and other SDK packages are saved outside the Android Studio application directory. If you need to access the tools directly, use a terminal to navigate to the location where they are installed. For example:

\Users\<user>\sdk\

Need to check the components, which are required to create applications; below the image has selected Android Studio, Android SDK, Android Virtual Machine and performance (Intel chip).

Component selection

Need to specify the location of local machine path for Android studio and Android SDK, below the image has taken default location.

Paths selection

Specify the RAM for Android emulator (by default it takes 512MB of local machine RAM).

Emulator RAM selection

At final stage, it would extract SDK packages into our local machine; it would take a while to finish the task.

SDK extraction progress

After done all above steps perfectly, you must get finish button and it gonna be open android studio project with Welcome to android studio message as shown below:

Welcome to Android Studio

You can start your application development by calling start a new android studio project. In a new installation frame it will ask Application name, package information and location of the project.

To set up Android Studio on Mac OSX:

  1. Launch the .dmg file you just downloaded.
  2. Drag and drop Android Studio into the Applications folder.
  3. Open Android Studio and follow the setup wizard to install any necessary SDK tools.

If you need to use the Android SDK tools from a command line, you can access them at:

/Users/<user>/Library/Android/sdk/

To set up Android Studio on Linux:

  1. Unpack the downloaded ZIP file into an appropriate location for your applications.
  2. To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh.

You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.

  1. If the SDK is not already installed, follow the setup wizard to install the SDK and any necessary SDK tools.

Note: You may also need to install the ia32-libs, lib32ncurses5-dev, and lib32stdc++6 packages. These packages are required to support 32-bit apps on a 64-bit machine.

Troubleshooting and notes

  • If the launcher script does not find Java on Windows: set the system-level JAVA_HOME environment variable pointing to your JDK.
  • Emulator acceleration: to get best performance install Intel HAXM on Intel machines or use the platform hypervisor supported by your OS. (Follow official docs for current steps.)
  • SDK path: the SDK is installed outside Android Studio; note the path when you accept defaults.

Reference

Reference: developer.android.com

Saturday, December 12, 2015

Fix Joomla "Table xxxx_updates doesn't exist" Error When Installing Modules (Joomla 3.4+)

While I was installing a module to the joomla 3.4.X, I got the below error:

Table 'xxxx_updates' doesn't exist SQL=SHOW FULL COLUMNS FROM updates in joomla

And the installation failed.

Cause

The error occurs because the Joomla database table that stores available updates (named using your table prefix followed by _updates) does not exist in the site's database. In the article below the placeholder xxxx represents your database table prefix.

Safety first: BACK UP your database

Before making any change to your database, create a full backup of the database (and files). If you have shell access you can use:

mysqldump -u DB_USER -p DB_NAME > db-backup-YYYYMMDD.sql

Or use phpMyAdmin's Export feature to export the database.

Find your table prefix

Open your Joomla site's configuration.php file and look for the database prefix setting (for example public $dbprefix = 'jos_';). Replace the xxxx placeholder below with your actual prefix (for example jos or abc123).

Solution — recreate the missing updates table

If the xxxx_updates table is missing you can recreate it. You have two options:

  • Preferred: create the table only if it does not exist.
  • If a malformed table exists you can DROP it and recreate it (dangerous without backup).

Option A — create table if it does not exist (safer)

Replace xxxx_ with your table prefix and run the CREATE TABLE statement:

CREATE TABLE IF NOT EXISTS `xxxx_updates` (
  `update_id` int(11) NOT NULL AUTO_INCREMENT,
  `update_site_id` int(11) DEFAULT 0,
  `extension_id` int(11) DEFAULT 0,
  `name` varchar(100) DEFAULT '',
  `description` text NOT NULL,
  `element` varchar(100) DEFAULT '',
  `type` varchar(20) DEFAULT '',
  `folder` varchar(20) DEFAULT '',
  `client_id` tinyint(3) DEFAULT 0,
  `version` varchar(32) DEFAULT '',
  `data` text NOT NULL,
  `detailsurl` text NOT NULL,
  `infourl` text NOT NULL,
  `extra_query` varchar(1000) DEFAULT '',
  PRIMARY KEY (`update_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Available Updates';

Option B — drop and recreate (only if you are sure and have a backup)

DROP TABLE xxxx_updates;

-- then run the CREATE TABLE statement from Option A

Where to run these SQL statements

  • phpMyAdmin: open your database, go to the SQL tab, paste the SQL, and run it.
  • MySQL CLI: connect with mysql -u DB_USER -p DB_NAME and paste the statements.
  • If available, check Joomla admin: Extensions → Manage → Database (it can sometimes fix or report database schema issues).

After running the SQL

This solves the issue. Now try to install the new module — it should install successfully.

Troubleshooting

  • If you still see errors, verify the database user has CREATE and ALTER privileges.
  • Confirm the table prefix used in SQL matches the prefix from configuration.php exactly (including the trailing underscore if present).
  • Ensure your database engine supports InnoDB and your server uses utf8 charset (the CREATE statement uses ENGINE=InnoDB DEFAULT CHARSET=utf8).
  • If Joomla reports other missing schema items, check Extensions → Manage → Database and run any suggested fixes.

This procedure recreates the updates table and addresses the module installation failure caused by the missing table.

Wednesday, September 2, 2015

Kids App — Android Alphabet Learning App with Text-to-Speech (English & Kannada)

I was trying to develop an Android app for my son which will help him learn the alphabets. I thought it may be helpful to others also so I'm sharing it on Google Play: Kids Application.

Overview

Kids App is a simple alphabet learning application for Android that combines text-to-speech with image-based learning. The app uses its own local database to store images, alphabets, words and pronunciation data. It currently supports two languages (English and Kannada) and two modes of operation (Manual and Auto). This is a draft version — we plan to add more languages and features.

Main features

  • Text-to-speech pronunciation for alphabets and numbers
  • Image and word display for each alphabet
  • Local database to store user-configured images, words and pronunciations
  • Two languages supported now: English and Kannada
  • Two operation modes: Manual (tap letters) and Auto (play-through)
  • Settings to configure images (camera or gallery), words and pronunciations

Languages

  • English
  • Kannada

We are going to enhance it for other languages also.

Modes of operation

Manual

Tap any alphabet to see the associated word and image and hear the pronunciation. For example: A for Apple.

Auto

The app automatically walks through all the alphabets and numbers, showing each item and pronouncing it without user tapping.

Configuration (customization)

The best part of this application is the ability for the user to configure their own word, image and pronunciation for each alphabet. For example, if your child's name is Krishna, you can set that name, an image and pronunciation for the letter K.

How to configure:

  1. Open the app and tap the menu button on the alphabet screen.
  2. Select "Configure".
  3. Choose an image from the camera or gallery, set the word, and provide pronunciation if needed.
  4. Save — the data is stored in the app database. To revert to defaults, use the "SetDefault" option.

Screenshots

These are the original screenshots from the post (kept as-is):

Splash and selection screen

Mode and language selection

Manual mode: alphabet screen

Example: A for Apple (image + TTS)

Numbers view

Configure menu and options

Configure: set image and word

Auto mode walkthrough

Kannada alphabet screen

Kannada: examples

Additional Kannada screen

App icon / Google Play link

How it works (technical)

  • The core code is written in Java and the GUI is developed using XML (standard Android components).
  • The app maintains a local database with images, words and pronunciations. User changes are saved locally until the user selects the default dataset.
  • Text-to-speech leverages Android's TTS engine for pronunciation.

Download

You can download the app from Google Play: Kids App on Google Play

Roadmap / planned enhancements

  • Add more languages
  • Add additional configuration options and improvements to the UI
  • Improve accessibility and TTS language detection

Notes and contact

This is a draft version — we are planning more features. Keep watching this post for updates.

If you have feedback or feature requests, install the app from the Play Store and send feedback through the app or comment on this post.