RSS Feed

Archive for the ‘Ubuntu / Linux’ Category

Got a packet bigger than ‘max_allowed_packet’ bytes – MySql – Part 2

March 30, 2011 by admin No Comments »

This error appears when you are running a database import.

To fix this:
A:
1) If you can; open as administrator the my.cnf file under the mysqld or etc folder.
2) Locate the entry max_allowed_packet and set this to a bigger number as you wish. It should be around 1M by default.

B:
You can also, use mysql console to update the values as

set global net_buffer_length=[SOME_BIG_NUMBER]; 
set global max_allowed_packet=[SOME_BIG_NUMBER];

C:
You could also get away with only the following command. however in my case it seemed to work well with a combination of step A.

mysql --max_allowed_packet=[SOME_NUMBER]M -uroot -p [dbname] < dump.sql
 

Step Debugging with Netbeans XDebug – Part 2

March 18, 2011 by admin No Comments »

Open your netbeans and go to your project. Then do the following

 

Run A PHP File from a cron job – CPanel

by admin 1 Comment »

Here is how a command you can use to run a php script from a cron job. This has been done in CPanel

php /home/your_username/[public_html/www]/somefolder/somefile.php
 

Using Lynx in Cron Job

by admin No Comments »

Here is how to use lynx (browser) to run/access a URL from a cron task

lynx -source http://domain.com/myfile.php
 

How to open a folder from application launcher – Ubuntu

March 16, 2011 by admin 1 Comment »
gnome-terminal --working-directory=/path/to/directory/
 

Change Permissions on Directory and Files from command line

March 7, 2011 by admin No Comments »

Here is a snippet command for changing file/folder permissions via command line

find . -type d -exec chmod 755 {} \;

NOTE: Please also the permissions numbers as you prefer

 

Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)

March 3, 2011 by admin 1 Comment »

If you are getting this error while trying to run a command on the terminal window, especially an apt-get install command, chances are you are running the synaptic manager at the same time.

You must close the synaptic package manager and run the command again. All should be good now!

 

Extract / Unzip Plesk Backup files on Ubuntu Environment

February 7, 2011 by admin No Comments »

This solution uses the MPACK package (included in Debian)

1) install the package if you havent yet:

sudo apt-get install mpack

2) On your command terminal, navigate to the folder that contains your Plesk backup file. Run the following commands:

sudo zcat DUMP_FILE.gz > DUMP_FILE
sudo cat DUMP_FILE | munpack

3) In result you get the set of tar and sql files that contain domains’ directories and databases. Untar the needed directory. For example if you need to restore the httpdocs folder for the DOMAIN.TLD domain:

sudo tar xvf DOMAIN.TLD.htdocs

NOTE: According to Parallels (the makers of plesk) ‘munpack’ utility may not work with files greater then 2Gb and during dump extracting you may receive the error like

sudo cat DUMP_FILE | munpack

DOMAIN.TLD.httpdocs (application/octet-stream)
File size limit exceeded

For more information or tips on this refer to http://kb.parallels.com/en/1757

 

Zip and Unzip files with gzip

January 11, 2011 by admin No Comments »

to zip a file

gzip filename.ext

To unzip

gzip -d filename.ext.gz
 

install 7zip compression type

January 7, 2011 by admin No Comments »
 sudo apt-get install p7zip