Error : 1067 the process terminated unexpectedly in mysql wamp

Recently I encountered a problem with MySQL, It was showing an error “Error : 1067 the process terminated unexpectedly” when I tried to start the service in services.msc

So I googled it but didn’t found the perfect solution. I will show how can you debug the issue. First look for file my.ini which can be found in “C:\wamp\bin\mysql\mysql5.6.17” , open that file on look for “log-error”, this will show you the path where error log is stored. In my case it is, “c:/wamp/logs/mysql.log”.

Open the log file and look for last error you got, you should be today’s date when you tried to start the wampmysqld from services. At this stage, you will get error and understand what it say. In my case it is,

Looking at error, it seems that there is some problem with “kmk\players.ibd” , here kmk it one of the my database. The folders for all databases are in “C:\wamp\bin\mysql\mysql5.6.17\data”. To fix I moved kmk folder to some other place. After this, wampmysqld in services.msc is getting started without any error.

That fixed my error.

Share your experience and error in log file in comment section. This will also prevent other from reinstalling wamp server.


ACID Properties – SQL Database

ACID is acronym of Atomicity, Consistency, Isolation and Durability


Atomicity requires that database modifications must follow an all or nothing rule. Each transaction is said to be atomic if when one part of the transaction fails, the entire transaction fails and database state is left unchanged. It is critical that the database management system maintains the atomic nature of transactions in spite of any application, DBMS, operating system or hardware failure.

An atomic transaction cannot be subdivided, and must be processed in its entirety or not at all. Atomicity means that users do not have to worry about the effect of incomplete transactions.

Transactions can fail for several kinds of reasons:

  • Hardware failure: A disk drive fails, preventing some of the transaction’s database changes from taking effect
  • System failure: The user loses their connection to the application before providing all necessary information
  • Database failure: E.g., the database runs out of room to hold additional data
  • Application failure: The application attempts to post data that violates a rule that the database itself enforces, such as attempting to create a new account without supplying an account number


The consistency property ensures that the database remains in a consistent state; more precisely, it says that any transaction will take the database from one consistent state to another consistent state.

The consistency property does not say how the DBMS should handle an inconsistency other than ensure the database is clean at the end of the transaction. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction could be rolled
back to the pre-transactional state – or it would be equally valid for the DBMS to take some patch-up action to get the database in a consistent state. Thus, if the database schema says that a particular field is for holding integer numbers, the DBMS could decide to reject attempts to put fractional
values there, or it could round the supplied values to the nearest whole number: both options maintain consistency.

The consistency rule applies only to integrity rules that are within its scope. Thus, if a DBMS allows fields of a record to act as references to another record, then consistency implies the DBMS must enforce referential integrity: by the time any transaction ends, each and every reference in the database must be valid. If a transaction consisted of an attempt to delete a record referenced by
another, each of the following mechanisms would maintain consistency:

  • Abort the transaction, rolling back to the consistent, prior state;
  • Delete all records that reference the deleted record (this is known as cascade delete); or,
  • nullify the relevant fields in all records that point to the deleted record.

These are examples of Propagation constraints; some database systems allow the database designer to specify which option to choose when setting up the schema for a database.

Application developers are responsible for ensuring application level consistency, over and above that offered by the DBMS. Thus, if a user withdraws funds from an account and the new balance is lower than the account’s minimum balance threshold, as far as the DBMS is concerned, the
database is in a consistent state even though this rule (unknown to the DBMS) has been violated.


Isolation refers to the requirement that other operations cannot access or see data that has been modified during a transaction that has not yet completed. The question of isolation occurs in case of concurrent transaction, (i.e. transaction occurring at the same time) and with the same database. To preserve the database consistency, the need of isolation arises. Each transaction must remain unaware of other concurrently executing transactions, except that one transaction may be forced to wait for the completion of another transaction that has modified data that the waiting transaction requires. If the isolation system does not exist, then the database may remain in an inconsistent state. This may happen as in case of concurrent transaction, one transaction may leave some data-items in mid process and at the same time another concurrent transaction may try to access/alter the same data-item which may cause data inconsistency and may leave the database in an inconsistent


Durability is the ability of the DBMS to recover the committed transaction updates against any kind of system failure (hardware or software). Durability is the DBMS’s guarantee that once the user has been notified of a transaction’s success, the transaction will not be lost. The transaction’s data changes will survive system failure, and that all integrity constraints have been satisfied, so the DBMS won’t need to reverse the transaction. Many DBMSs implement durability by writing transactions into a transaction log that can be reprocessed to recreate the system state right before any later failure. A transaction is deemed committed only after it is entered in the log.

Durability does not imply a permanent state of the database. A subsequent transaction may modify data changed by a prior transaction without violating the durability principle.

Thanks for reading the article.


Please comment if you have any questions or suggestions. Thanks

ORM – Object Relational Mapping in PHP

ORM- Object Relational Mapping is a tool which allows database row to refer as object in PHP programming.  What Wikipedia says about ORM is:

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language.

(Object-Relational Mapping) is a tool that allows you query database table and manipulate data from a database using an object paradigm (Object Oriented).

ORM is library which helps you in query the data using functions so that PHP developer do not have to write database query manually. It uses model objects to get the database table’s data.

Let understand this with simple example code. You have a book class and you want to fetch the books whose author is ‘Peter’. To get list of books, you may write similar kind of code as follow:

Above code using ORM can be written as simple as follow:

All the mechanical part is taken care by the ORM. You write almost no query  retrieving the data from table/s.


ORM saves time because:

  1. It uses DRY concept. You write your data model in only one place, it’s easier to update, maintain and reuse the code.
  2. A lot of stuff for database manipulation is done automatically, maintaining relation and fetching data is also some times automatically.
  3. It forces you to write code in MVC (Model-View-Controller) structure, so in the end your application code will be cleaner.
  4. You don’t have to write formed SQL statements, complex relational query are handled by ORM
  5. Sanitizing, using prepared statements or transactions are as easy as calling a method.

ORM is flexible to use:

  1. It fits in your natural way of coding.
  2. It abstracts the DB system, so you can change it whenever you want.
  3. The model is weakly bound to the rest of the app, so you can change it or use it anywhere else.
  4. It let you use OOP goodness like data inheritance without head ache.


  1. You have to learn it, and they are not lightweight tools;
  2. You have to set it up. Same problem.
  3. Performances are ok for usual queries, but a SQL master will always do better with his little hands for the big dirty works.
  4. It abstracts the DB. While it’s ok if you know what’s happening behind the scene, it’s a trap for the novice that can write very greedy statements, like a heavy hit in a “for” loop.

Available ORM in PHP are Propel and Doctrine. You can use any one.

Thanks for reading the article. I have taken the help from stackoverflow to write on ORM. Thanks to stackoverflow.

Please feel free to comment if you have any confusion.

What are DDL and DML statements in MySQL?

DDL and DML are different type of SQL queries in MySQL. The full form of DDL and DML is Data Definition language and Data Manipulation Language.

DDL – Data Definition Language:

This are the SQL statements which are most related to Database creating/changing structure. The List of DDL statements are as follow:

  • CREATE – statement is used to create database and other objects
  • ALTER – statement is used to change the database structure
  • DROP – statement is used to delete the database and other objects
  • TRUNCATE – statement  to remove all the records from a table, including all spaces allocated for the records are removed
  • COMMENT – add comments to the data dictionary
  • RENAME – rename is used to rename the objects

DML – Data Manipulation Language:

These are the SQL statements which are related to Database manipulation like fetching, adding, updating data to table. The List of DML statements are as follow:

  • SELECT – statement is used to retrieve/fetch data from the a database
  • INSERT – statement used to insert data into a table
  • UPDATE – statement used to  updates existing data within a table
  • DELETE – deletes all records from a table, the space for the records remain
  • CALL – call a PL/SQL or Java subprogram

DCL – Data Control Language

These are the SQL statements which are related to control the user access to the Database. The List of DCL statements are as follow:

  • GRANT – statement  allows specified privileges to database
  • REVOKE – withdraw access privileges given with the GRANT command

TCL – Transaction Control Language

There are the SQL statements which are related to control transactions. The List of TCL statements are as follow:

  • COMMIT – save work done
  • SAVEPOINT – identify a point in a transaction to which you can later roll back
  • ROLLBACK – restore database to original since the last COMMIT
  • SET TRANSACTION – Change transaction options like isolation level and what rollback segment to use


Thank you for reading the article. Please comment if you have any confusion.

OpenCart – Simple Age Verification PopUp – VQMOD Extension

Simple Age Verification PopUp OpenCart extension is nice plugin to verify the age before entering the site. This is helpful for adult site, smoking or alcohol sites to verify the age before visitor enters your website.

Simple Age Verification Popup plugin opens popup in cool lightbox with image and check box with it. See the below screenshop of popup.



This is VQMOD extension of OpenCart. VQMOD helps in not overwriting the core files of OpenCart.

You can find more info on VQMOD and Download here.

Steps to install this Extension:

  1. Install VQMOD, if it is not installed.
  2. Download the zip file, extract somewhere on your computer. 
  3. From extracted file, upload the the files/folder under “upload” folder to server using FTP, in root folder (where admin,catalog,system folder are available) of OpenCart installation and its done you do not have to do anything else to make it work.


Click Here to Download OpenCart – Simple Age Verification PopUp – VQMOD Extension

OpenCart – Show Reward Points of Customer In Header – VQMOD Extension

Show Reward Point of Customer in Header plugin do exactly what it’s name implies. In OpenCart, After login as Customer to view reward point customer have to go to My Account > Your Reward Points. This Free extension / plugin of OpenCart show Rewards points in Header under Login info.

Here is the screenshot how it looks like on default theme.



This is VQMOD extension of OpenCart. No Core file is updated using VQMOD.

You can download this plugin from here.

OpenCart – Auto Add Reward Points – VQMOD Extension

New OpenCart Extension, Auto Add Reward Points add product rewards points to customer immediately after purchase finished. Usually in OpenCart website admin have to add reward point to customer manually by clicking on link as show in below screenshot.



Using Auto add reward point extension / plugin for OpenCart do not require to add rewards point manually. It does automatically for admin. It helps admin in reducing tedious task of adding rewards point for every product purchased.

This is VQMOD extension so you require VQMOD to be installed on OpenCart website. You can find the information of installing VQMOD here.

Steps to install extension:

It is really easy to install this plugin.

  1. Install VQMOD, if it is not installed.
  2. Download the zip file, extract somewhere on your computer. 
  3. From extracted file, upload the the files/folder under “upload” folder to server using FTP, in root folder (where admin,catalog,system folder are available) of Opencart installation and its done you do not have to do anything else to make it work.

Click Here to Download OpenCart – Auto Add Reward Points – VQMOD Extension

PHP – Securing your Web Application : More information and Summary

This is a last article in this series.

More Information

The following resources can help you expand on this brief introduction:

Security Recap and Summary

Because security is such an important issue, we want to reiterate the main points of this series of tutorials as well as add a few additional tips:

  • Filter input to be sure that all data you receive from remote sources is the data you expect. Remember, the stricter your filtering logic, the safer your application.
  • Escape output in a context-aware manner to be sure that your data isn’t misinterpreted by a remote system.
  • Always initialize your variables. This is especially important when the register_globals directive is enabled.
  • Disable register_globals, magic_quotes_gpc, and allow_url_fopen. See for details on these directives.
  • Whenever you construct a filename, check the components with basename() and realpath().
  • Store includes outside of the document root. It is better to not name your included files with the .inc extension. Name them with a .php extension, or some other less obvious extension.
  • Always call session_regenerate_id() whenever a user’s privilege level changes.
  • Whenever you construct a filename from a user-supplied component, check the components with basename() and realpath().
  • Don’t create a file and then change its permissions. Instead, set umask() so that the file is created with the correct permissions.
  • Don’t use user-supplied data with eval(), preg_replace() with the /e option, or any of the system commands— exec(), system(), popen(), passthru(), and the backtick (`) operator.

Here is the list of of Article in this Series:

Please share the article if you like let your friends learn PHP Security. Please comment any suggestion or queries.


Thanks Kevin Tatroe, Peter MacIntyre and Rasmus Lerdorf. Special Thanks to O’Relly.

PHP – Securing your Web Application : Shell Commands

Be very wary of using the exec(), system(), passthru(), and popen() functions and the backtick (`) operator in your code. The shell is a problem because it recognizes special characters (e.g., semicolons to separate commands). For example, suppose your script contains this line:

If the user passes the value ” /tmp;cat /etc/passwd” as the $directory parameter, your password file is displayed because system() executes the following command:

In cases where you must pass user-supplied arguments to a shell command, use escapeshellarg() on the string to escape any sequences that have special meaning to shells:

Now, if the user passes ” /tmp;cat /etc/passwd“, the command that’s actually run is:

The easiest way to avoid the shell is to do the work of whatever program you’re trying to call in PHP code, rather than calling out to the shell. Built-in functions are likely to be more secure than anything involving the shell.

Here is the list of of Article in this Series:

Please share the article if you like let your friends learn PHP Security. Please comment any suggestion or queries.


Thanks Kevin Tatroe, Peter MacIntyre and Rasmus Lerdorf. Special Thanks to O’Relly.