Installing cURL Ubuntu Server

I was trying to configure ShareYourCart on WordPress WooCommerce plugin running on Ubuntu Server and kept getting the error

Call to undefined function curl_init() in /wp-content/plugins/woocommerce/classes/integrations/shareyourcart/sdk/class.shareyourcart-api.php on line 77

I got this error because cURL wasn’t installed and activated

To install, active and configure cURL

$ sudo apt-get update
$ sudo apt-get install php5

In your browser open phpinfo(), check property:

extension_dir   /usr/lib/php5/20090626+lfs

In that folder you should now have
If not install it

$ sudo apt-get install php5.6-curl

Depending on your php version you may need to change the number from 5.6 to something else.

Edit php.ini

$ nano /etc/php5/apache2/php.ini

find “dynamic extensions” add code below:

Restart Apache

$ /etc/init.d/apache2 restart

check your phpinfo() and there will be a new table named cURL


Alternative way to enable the extension
check if curl module is available

$ ls -la /etc/php5/mods-available/

enable the curl module

$ sudo php5enmod curl

Data Log

When building a site or managing a server its very beneficial to look at data and error logs.

To check if php error logs is enabled run phpinfo() and under Core table and the error_log row if ‘no value’ it means its not enabled. To enable PHP error logging open C:\wamp\bin\apache\Apache2.2.17\bin\php.ini and uncomment error_log line. See below

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; Example:
;error_log = php_errors.log
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog
error_log = "c:/wamp/logs/php_error.log"


Ubuntu Server:
PHP error logs is enabled and shows up /var/log/apache2/error.log

For MySQL logging uncomment the general_log_file and general_log line in /etc/mysql/my.cnf see example below

# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
general_log_file        = /var/log/mysql/mysql.log
general_log             = 1

log_error                = /var/log/mysql/error.log

Then restart MySQL
$ /etc/init.d/mysql restart


Communication between Arduino and Computer using Python

Python code:

#communications between arduino and computer using python
import serial

#enter your device file
ser = serial.Serial('/dev/<your_device_file>', 9600) //windows: '/dev/com4' | linux: '/dev/ttyACM0'
while 1:
	print ser.readline().strip('\n')

Arduino Code:

 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff


int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
  irrecv.enableIRIn(); // Start the receiver

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value

Additional information

Adding product images to Woocommerce

Working on WordPress woothemes for woocommerce and wanted to add multiple images to a product without adding to the description post. I couldn’t find anything inside WordPress to do that so I went straight to the MySQL database to see what was linking it. In “wp-posts” table under “post_parent” field where the image record is if you change the post_parent number to a product id post number it will show up as one of the product images.



wordpress change image parent, pictures, woothemes

Search in all fields from every table in a database

Sometimes we need to find out a small piece of string in big Database. Like where is the configuration saved, or where is Jon’s birth date saved. This PHP code can search all the tables, all the rows and columns in a MYSQL Database. To download


If you have phpMyAdmin installed use its ‘Search’ feature.

  • Select your DB
  • Be sure you do have a DB selected (i.e. not a table, otherwise you’ll get a completely different search dialog)
  • Click ‘Search’ tab
  • Choose the search term you want
  • Choose the tables to search

MySQL – Search in all fields from every table from a database
search all records mysql