Archive for December 5, 2009

freebsd check memory

Posted: December 5, 2009 in Freebsd

If you wanna check memory in freebsd use this script.

download from my server or original server

fetch http://bsd.mynux.net/freebsd-memory.pl.txt

or

fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt

mv freebsd-memory.pl.txt /usr/local/bin/free

chmod +x /usr/local/bin/free

than issued this command

free

you will see this output

[root@bsd /skrip]# free
SYSTEM MEMORY INFORMATION:
mem_wire:         133365760 (    127MB) [ 12%] Wired: disabled for paging out
mem_active:  +     54943744 (     52MB) [  5%] Active: recently referenced
mem_inactive:+    558706688 (    532MB) [ 53%] Inactive: recently not referenced
mem_cache:   +      6766592 (      6MB) [  0%] Cached: almost avail. for allocation
mem_free:    +    286863360 (    273MB) [ 27%] Free: fully available for allocation
mem_gap_vm:  +       708608 (      0MB) [  0%] Memory gap: UNKNOWN
————– ———— ———– ——
mem_all:     =   1041354752 (    993MB) [100%] Total real memory managed
mem_gap_sys: +     19181568 (     18MB)        Memory gap: Kernel?!
————– ———— ———–
mem_phys:    =   1060536320 (   1011MB)        Total real memory available
mem_gap_hw:  +     13205504 (     12MB)        Memory gap: Segment Mappings?!
————– ———— ———–
mem_hw:      =   1073741824 (   1024MB)        Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used:         221405184 (    211MB) [ 20%] Logically used memory
mem_avail:   +    852336640 (    812MB) [ 79%] Logically available memory
————– ———— ———– ——
mem_total:   =   1073741824 (   1024MB) [100%] Logically total memory

Other way is using Linux Style

# cd /usr/ports/sysutils/freecolor
# make install clean

To see memory details, enter:
$ freecolor -m -o

Sample output:

total       used       free     shared    buffers     cached
Mem:          4082        825       3256          0          0        117
Swap:         2048          0       2047

$ freecolor -t -m -o

Sample output:

total       used       free     shared    buffers     cached
Mem:          4082        825       3256          0          0        117
Swap:         2048          0       2047
Total:        6130 = (     826 (used) +     5421 (free))

Assume you have install freebsd and php5.

than let configure php5 to run with lighttpd

[root@bsd ~]# /usr/local/etc/lighttpd.conf

Make sure FASTCGI module is enabled:

server.modules += ( “mod_fastcgi” )

uncommend ths following code

fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/bin/php-cgi”
)
)
)

Save and close the file. Restart lighttpd:

[root@bsd ~]# /usr/local/etc/rc.d/lighttpd restart

test server using this foolowing code

[root@bsd ~]# pico phpinfo.php

<?php
phpinfo();
?>

Save and close the file.

open your browser

http://localhost/phpinfo.php

This tutorial cover how to install lighttpd + mysql + php-cgi in freebsd

Must update port

[root@bsd ~]#  portsnap fetch

[root@bsd ~]#  portsnap update

1. Install Lighttpd

cd /usr/ports/www/lighttpd

make

make install

make clean

2. Mysql server

cd /usr/ports/databases/mysql150-server/

make

make install

make clean

Mysql client

cd /usr/ports/databases/mysql150-client

make

make install

make clean

Mysq script

cd /usr/ports/databases/mysql150-scripts

make

make install

make clean

3. Install php5 for Lighttpd

cd /usr/ports/lang/php5

make

make install

make clean

Php5 must install with this module .

  • ctype: The ctype shared extension for php
  • curl: The curl shared extension for php
  • dom: The dom shared extension for php
  • gd: The gd shared extension for php
  • imap: The imap shared extension for php
  • mbstring: The mbstring shared extension for php
  • mcrypt: The mcrypt shared extension for php
  • mysql: The mysql shared extension for php
  • mysqli: The mysqli shared extension for php
  • pcre: The pcre shared extension for php
  • posix: The posix shared extension for php
  • session: The session shared extension for php
  • simplexml: The simplexml shared extension for php
  • xml: The xml shared extension for php
  • xmlreader: The xmlreader shared extension for php
  • xmlwriter: The xmlwriter shared extension for php
  • zlib: The zlib shared extension for php

4. Install php5 for Lighttpd

cd /usr/ports/lang/php5-extensions

make

make install

make clean

Auto start lighttpd and mysql service

[root@bsd ~]# pico /etc/rc.conf

mysql_enable="YES"
lighttpd_enable="YES"

Start Mysql Server Under FreeBSD

[root@bsd ~]# /usr/local/etc/rc.d/mysql-server start

Start Lighttpd Server Under FreeBSD

[root@bsd ~]# /usr/local/etc/rc.d/lighttpd start

try and good luck ;p