Thursday, April 18, 2013

Linux: check available space on each filesystem

To check used/available space on each filesystem, use the following command:

df -h

example output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             285G   16G  256G   6% /
none                  1.9G  288K  1.9G   1% /dev
none                  1.9G  3.6M  1.9G   1% /dev/shm
none                  1.9G  100K  1.9G   1% /var/run
none                  1.9G     0  1.9G   0% /var/lock


-h param stands for human-readable and if you don't specify it, sizes will be printed in bytes

Ubuntu: Add new domain / subdomain in apache

Navigate to /etc/apache2/sites-available. Create a file with your new domain name and add the following:

#file: mydomain.com
<VirtualHost *:80>
        ServerName mydomain.com
        DocumentRoot /root/directory/of/site
</VirtualHost>

Enable the configuration for the new domain with the following command:

a2ensite mydomain.com

 Restart Apache

service apache2 restart

Wednesday, April 17, 2013

change date.timezone in php

Open php.ini file and search for date.timezone directive. It should look something like this:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = 'America/New_York'

or you can use the ini_set() function. Just add at top of your script:

ini_set('date.timezone', 'America/New_York'); 

Here is a list of time zones: http://php.net/manual/en/timezones.php

create and delete symbolic links in linux

Create a symlink

ln -s /path/to/file/or/dir /path/to/symbolic/link

Delete a symlink

 unlink /path/to/symbolic/link

Example:

Create a symlink for file.gz which is placed in /home dir

ln -s /home/file.gz /home/user/file.gz

Delete the symlink for file.gz

unlink /home/user/file.gz

or simply delete the symbolic link with the rm command

rm /home/user/file.gz

Tuesday, April 16, 2013

PHP increase file upload size

 You can increase file upload size by setting upload_max_filesize to a higher value. Find the upload_max_filesize directive in php.ini and change the default value:
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 8M

Restart apache so the new configuration can take effect:
/etc/init.d/apache2 restart

PHP Disable File Upload

Open php.ini file and find the file_uploads directive. It should look something like this:
; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

To disable file uploads in php set the directive to Off:
file_uploads = Off

Restart apache with the following command
service apache2 restart

Note: In Ubuntu php.ini file can be found udner: /etc/php5/apache2

Linux: start / stop / restart apparmor daemon

Stop Apparmor

# /etc/init.d/apparmor stop

Start Apparmor

# /etc/init.d/apparmor start

Restart Apparmor

# /etc/init.d/apparmor restart

Apparmor status

# /etc/init.d/apparmor status

Monday, April 15, 2013

Restart Apache in all Linux distributions

Restart Apache

Ubuntu

service apache2 restart
/etc/init.d/apache2 restart
apache2ctl restart

CentOS

/etc/init.d/httpd restart 

service httpd restart
/sbin/service httpd restart

Debian

service apache2 restart
/etc/init.d/apache2 restart 
apache2ctl restart

Suse

/usr/sbin/rcapache2 restart
apache2ctl restart

Fedora

apachectl restart
/sbin/service httpd restart

RedHat

/etc/init.d/httpd status
service httpd restart
/usr/local/apache2/bin/apachectl restart

Wednesday, April 10, 2013

Updated Debian 6.0: 6.0.7 released

The Debian project is pleased to announce the seventh update of its stable distribution Debian 6.0 (codename squeeze). This update mainly adds corrections for security problems to the stable release, along with a few adjustments for serious problems. Security advisories were already published separately and are referenced where available.
Please note that this update does not constitute a new version of Debian 6.0 but only updates some of the packages included. There is no need to throw away 6.0 CDs or DVDs but only to update via an up-to-date Debian mirror after an installation, to cause any out of date packages to be updated.

source: http://www.debian.org/News/2013/20130223

Sunday, April 7, 2013

Ubuntu 13.04 (Raring Ringtail) Beta 2 released

The Ubuntu team is pleased to announce the final beta release of Ubuntu 13.04 Desktop, Server, Cloud, and Core products.
Codenamed "Raring Ringtail", 13.04 continues Ubuntu’s proud tradition of integrating the latest and greatest open source technologies into a high-quality, easy-to-use Linux distribution. The team has been hard at work through this cycle, introducing new features and fixing bugs.

source: http://fridge.ubuntu.com/2013/04/05/ubuntu-13-04-raring-ringtail-beta-2-released/