Adakalanya script php yang kita buat membutuhkan waktu komputasi melebihi standar waktu timeout yang diberikan oleh browser yaitu selama 30 detik. Hal ini kebetulan sedang terjadi dengan Tugas Akhir yang sedang saya kerjakan, dimana komputasi yang berjalan membutuhkan waktu pemrosesan yang lama dikarenakan adanya proses rekursif yang pengkodisian berhenti tidak pasti (bisa jadi setelah 2 kali proses pengulangan, 10 kali bahkan samapi 1000 kali).
Untuk mengatasi hal tersebut, php sendiri telah membundle productnya dengan CLI (command line interface). Untuk pengguna unix dan unix-like lainya dapat menjalankanya dengan menggunakan perintah berikut :
#!/usr/bin/php -q namafile.php
sedangkan bagi pengguna windows kita dapat memanfaatkan aplikasi yang bernama php.exe, Untuk php versi 4 file ini terdapat pada folder cli pada direktori instalasi php kamu.Dan untuk php versi 5 file ini terdapat pada folder induk instalasi php. Berikut contoh penggunaannya untuk php versi :
C:\PHP\CLI\php.exe -q simple.php
dan versi 5 :
C:\PHP\php.exe -q simple.php
sedangkan opsi parameter yang dapat digunakan adalah sebagai berikut :
| -q | Suppress HTTP headers output. Normally PHP prints out HTTP headers for the calling program (ie. webserver) to hand on to the browser. When writing command line applications these headers are useless. |
| -s | Display the color highlighted source of the file given with its name. This is the same as if you were printing out the source using the highlight_file() function in a PHP script. |
| -v | By calling PHP with this option, you can ask it to print out its version number, ie: 4.0.6. |
| -C | Normally PHP changes the working directory to the running scripts direcrory. This makes it possible for example, to open files in the same directory, with only specifying the name of the file. If you would like to disable this directory change, use this option. |
| -c | Using this option, you can specify an alternative php.ini path, so PHP will search your configurations file in this path instead of the default one. |
| -d | With this option, you can set individual php.ini settings in the time of running a script. |
| -m | Using this option, PHP prints out the built in (and loaded) PHP and Zend modules, the PHP and Zend version numbers, and a short Zend copyright notice. |
| -i | This command line option calls phpinfo(), and prints out the results. If PHP is not working well, it is advisable to make a php -i and see if any error messages are printed out before or in place of the information tables. |
| -h | With this option, you can get information about the actual list of command line options and some one line descriptions about what they do. |








7 Comments Received
July 15th, 2008 @8:50 am
Nih bos nambahin satu artikel lagi http://blu3vanda.wordpress.com.....-standard/
July 27th, 2008 @12:41 pm
itu buat localhost doang yah??
klo iya, tau ga gimana caranya ngakalin waktu proses yang lebih dari 30 detik klo lagi koneksi on-line?
July 27th, 2008 @5:42 pm
Hal tersebut dapat dilakukan di manapun, dan untuk koneksi manapun (alah bahasanya :D
, selama dikomputer yg dinginkan telah terinstal si php dengan baik dan benar.
July 28th, 2008 @11:13 pm
oh,, *sambil mangguk-mangguk*
btw, link saya dibenerin yah.. thx…
*mode promosi ON*
August 1st, 2008 @1:24 pm
wah…. bingung mode on
August 2nd, 2008 @8:05 pm
zan, eta judulna kelebihan huruf
August 14th, 2008 @11:58 am
wehhh lagi ngebahas TA nehh ya

CMIIW
kalo cem web service apakah juga dibatesin ma bruser time responnya?
prasaan di bruser bisa deh time responnya dilamain jan
Leave A Reply