Friday, May 6, 2016

Cannot allocate memory: fork: Unable to fork new process in ubuntu

There are three modules related to this settings. 
prefork, worker and event

First find which module is activated using

a2query -M

Now change its conf file in mods-available. 

In following case, prefork is enabled, so make changes in mpm_prefork.conf

MaxConnectionsPerChild
If MaxConnectionsPerChild is 0, then the process will never expire.
Setting MaxConnectionsPerChild to a non-zero value limits the amount of memory that process can consume by (accidental) memory leakage.

MaxRequestWorkers
A simple calculation for MaxRequestWorkers would be: 

(Total Memory – Critical Services Memory) / Size Per Apache process

In this case the server has 3400Mb of memory allocated, 

250Mb used by mySQL and each Apache thread averages about 30Mb. 
MaxRequestWorkers = (3400– 250) / 30
therefore MaxRequestWorkers = 105

/etc/apache2/mods-available/mpm_prefork.conf
 <ifmodule mpm_prefork_module>   
    StartServers          5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers       100
    MaxConnectionsPerChild  1000
</ifmodule>
Restart Apache.

Not able to change permission or execute files in ubuntu

When your file is in NTFS partition, you are not allowed to change permission or execute file.

You need to add permissions for the partition.

Find UUID of all partitions using
sudo blkid

Open file /etc/fstab
and add following line for each partition which should be auto-mounted with executable file permissions.
UUID=12102C02102CEB83 /media/root ntfs-3g auto,users,exec,permissions 0 0

UUID of the partition can be found using above mentioned command and /media/root is the directory where you want the partition should be mounted

Now partition files have changeable and executable permissions.

Sunday, April 10, 2016

XAMPP - wrong ELF class: ELFCLASS64

If you have added an extension in your php.ini and you are getting this error while restarting XAMPP or running command  /opt/lampp/bin/php -v as well as as extension is not working, it means you are using 64 bit .so file(extension) in 32 bit XAMPP.

You can get this error while installing ioncube loader .so file, mongo.so file or in similar extension.

Download 32 bit version of .so file and put it in right place in xampp directory.
Mention it in php.ini file and Restart xampp .

Your extension should not be failed this time.

Browse files of Android mobile on ubuntu by bluetooth

To browse files of Android phone (memory card), you should have obex installed on your Ubuntu.
sudo apt-get install obexfs obexftp

Now you should have a server on your android phone. Install app "Bluetooth File Transfer" on your Android phone. When you open the app, it starts FTP (File Transfer Protocol) and OPP (object push profile) services on two different ports.

Start Bluetooh of android device and ubuntu and make both discoverable. Now mount your Android device on Ubuntu.
sudo obexfs -b android:device:id /mount/directory
Make sure mounted directory is empty.

To find your android device id, run command 
hcitool scan
Make sure your phone is discoverable and bluetooth is turned on.

Suppose your device id is 00:19:99:4c:68:12 and mounted directory on Ubuntu is /mnt/user.
Run command on ubuntu
sudo obexfs -b 00:19:99:4c:68:12 /mnt/user
Make sure you have started Bluetooth File Transfer app in your phone.

Now you can see all your memory card files in the directory /mnt/user.

I got maximum transfer speed 30 kbps from phone to system or vice versa. The only advantage I found, I need not carry USB cable and my Laptop usb port is not used in this process. Otherwise it is not useful for bigger transfer, sometimes it loses the connection and sometimes it is really annoying.

Saturday, March 12, 2016

ProxySet: unknown lbmethod lbmethod=byrequests; balancer://mycluster

apache2 error : While creating Load Balancer
ProxySet: unknown lbmethod lbmethod=byrequests; balancer://mycluster

If you are getting above error after setting Load Balancer in your conf file while restarting apache, you need to enable following module in apache.

Run following command 
sudo a2enmod lbmethod_byrequests

Now Restart apache.

Tuesday, February 16, 2016

Not able to find sendmail log

If you are not able to see log in /var/log/mail.log and file is empty, check the mail logs in /var/log/syslog
tail -n 25 /var/log/syslog

pecl install stomp error

configure: error: Cannot find OpenSSL's libraries
ERROR: `/var/tmp/stomp/configure --with-openssl-dir=/usr' failed


Solution :
While installing stomp using pecl, it asks
OpenSSL install prefix (no to disable SSL support) [/usr] :
Type yes and press return key.


Do not leave the input blank.

Server sent passive reply with unroutable address. Using server address instead

Filezilla Error : Server sent passive reply with unroutable address. Using server address instead

Solution :
In FileZilla, click on Edit > Settings.
1) Under Connection, click on FTP and choose Active as the Transfer Mode.
2) Under Connection, under FTP, click on Active mode and choose “Ask your operating system for the external IP address” (the default setting).
3) Under Connection, under FTP, click on Passive mode and choose “Fall back to active mode” (this is an optional setting).

Remove Apache server info from web page header

If you are using Ubuntu or Debian
Edit file  /etc/apache2/conf-enabled/security.conf

Change “ServerTokens OS” to “ServerTokens Prod”

and
Change “ServerSignature On” to “ServerSignature Off”

Restart apache.

If you are using CentOS, RHEL or fedora
Edit file /etc/httpd/conf/httpd.conf

Change “ServerTokens OS” to “ServerTokens Prod”
and
Change “ServerSignature On” to “ServerSignature Off”

Restart apache. 

If there are no entries of these lines, add both lines in the file.
Restart apache

Apache remove php version info from the web page header


Edit your php.ini and set following attribute.

expose_php = off
Restart apache.