Merubah Ukuran Memory Limit Php Di Server Apache



Memory limit merupakan alokasi memory server (RAM) yang di berikan ke service apache sehingga akan mensugesti kecepatan loading sebuah website. Default memory pada konfigurasi sistem di apache sebesar 8 MB, bagaimana cara mengubah konfigurasi default memory tersebut.

1. Remoter server dengan memakai ssh dengan putty.
2. Edit konfigurasi file /etc/php.ini atau /usr/lib/php.ini
root@admin[ ]#pico /etc/php.ini

3. Cari text
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB).

lalu edit menurut kapasitas RAM yang ada pada server:

RAM 1Gb = 32M
RAM 2Gb = 128M
RAM 3Gb = 256M
RAM 4Gb = 512M
RAM 5Gb = 1024M
dst…

agar tidak salah dalam penulisan, penulisan yang benar ialah menyerupai 32M, bukan32MB.

4. Save file yang sudah di edit
5. Konfigurasi file /etc/httpd/conf/httpd.conf 
root@admin[ ]#pico /etc/httpd/conf/httpd.conf

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

6. Restart apache dengan command :
root@user [ ]# /etc/init.d/httpd restart
atau
root@user [ ]# service httpd restart

7. Jalankan perintah top

# top top - 15:06:24 up 41 days, 16:18,  2 users,  load average: 3.58, 2.59, 2.34 Tasks: 204 total,   1 running, 203 sleeping,   0 stopped,   0 zombie Cpu(s): 14.6%us,  0.5%sy,  0.0%ni, 84.3%id,  0.3%wa,  0.0%hi,  0.3%si,  0.0%st Mem:  24676512k total, 14828220k used,  9848292k free,   343688k buffers Swap:  2102456k total,      188k used,  2102268k free, 10690524k cached    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 19965 apache    16   0  413m 113m 3980 S  5.7  0.5   3:11.01 httpd 20954 apache    16   0  383m  83m 3952 S  5.7  0.3   1:16.31 httpd 21274 apache    16   0  382m  81m 3988 S  5.7  0.3   0:29.20 httpd 21376 apache    16   0  371m  67m 3728 S  5.7  0.3   0:03.58 httpd 20943 apache    16   0  384m  83m 3948 S  5.3  0.3   1:18.98 httpd 20969 apache    16   0  384m  83m 3928 S  5.3  0.3   1:18.67 httpd 21264 apache    16   0  382m  80m 3796 S  5.3  0.3   0:27.93 httpd 21364 apache    16   0  379m  75m 3848 S  5.3  0.3   0:04.28 httpd 21370 apache    16   0  378m  75m 3712 S  5.3  0.3   0:04.31 httpd 21371 apache    16   0  378m  74m 3772 S  5.3  0.3   0:04.51 httpd 21374 apache    16   0  379m  74m 3804 S  5.3  0.3   0:03.50 httpd 21377 apache    16   0  379m  76m 3896 S  5.3  0.3   0:04.54 httpd 21043 apache    16   0  383m  82m 3976 S  5.0  0.3   1:17.40 httpd 21262 apache    16   0  382m  81m 3900 S  5.0  0.3   0:28.30 httpd
8. Selesai.

Subscribe to receive free email updates:

0 Response to "Merubah Ukuran Memory Limit Php Di Server Apache"

Posting Komentar