Zend - The PHP Company




Code Gallery: CHnuschti


Execute and terminate background processes in Windows  

Type: code fragment
Added by: chnuschti
Entered: 30/08/2004
Last modified: 09/12/2003
Rating: - (fewer than 3 votes)
Views: 8386
Execute AND terminate background processes in Windows whilst your PHP-Script continues to execute. This code fragment is useful if you want to execute AND terminate a background process (that can be invoked via commandline) in Windows OS using PHP, without having your script hanging. The problem with the given functions of PHP for this purpose (exec(), passthru(), backtick-operators etc.) is, your script will hang if you launch a process that should run whilst your script is continuing to execute (e.g. services). To terminate the process you'll need the utility "pskill". Not a big thing, but I hope it helps you, as I wasted a lot of time on this theme until i got a working solution. It was tested only "local" on Windows 2000, Apache 1.3 and PHP 5.0. Read the original contribution at: http://php3.de/manual/de/function.exec.php download pskill at: http://www.sysinternals.com/ntw2k/freeware/pskill.shtml


File & Folder Picker / Selector for PHP  

Type: code fragment
Added by: CHnuschti
Entered: 21/10/2003
Last modified: 02/11/2002
Rating: - (fewer than 3 votes)
Views: 9933
Hi. I wrote this one for "local" purposes. It allows to navigate and pick up an unlimited amount of files and folders. It returns a 2-dim-array with the file/folderpath and an index: 1=folder, 2=file. It requires javascript. It was tested "local" on Windows2000 and IE6, but not on an "external" server nore with other browsers. You'll have to adapt the list of the drives manually.


Permutation / Find all possible combinations of given elements  

Type: code fragment
Added by: chnuschti
Entered: 06/09/2004
Last modified: 09/12/2003
Rating: - (fewer than 3 votes)
Views: 9622
The code fragment (function) allows to find the scheme of all possible combinations of a given number of elements and will return the array with all combinations. Optionally it allows to find also the combinations that dont include all elements. The examples show how to apply the code. Idea/basics of the code were taken from a nice contribution here: http://www.phpfreaks.com/phpref/21.php


SSL/TLS enabled FTP-client to use on WINDOWS OS with PHP  

Type: code fragment
Added by: chnuschti
Entered: 11/02/2005
Last modified: 02/12/2004
Rating: - (fewer than 3 votes)
Views: 5894
I wasted a lot of time trying to get FTP over SSL/TLS working in PHP on WINDOWS OS (with precompiled SSL PHP-packages etc.). However, it never worked for me. While SSL/TLS may not be a complicate issue on Linux OS and others, on Windows OS it definitely is. I'm happy I found a nice solution now: using "MoveIt Freely", a commandline FTP-Client, freeware at http://www.standardnetworks.com. A nice tool that worked on all SSL/TLS-enabled FTP-servers for me. I know the issue is not related to PHP directly, anyway, I include an example that shows how to use it Hope it helps.




Search