cli

Advantages of PHP CLI?

What are the benefits of PHP's CLI over other scripting languages/environments such as VBScript or even windows scripting? ...

Same server, same program but started once using one network card and after with another

Hello, I have a Linux server with multiple ips (so, multiple eth0, eth0:0, eth0:1 etc). The script I'm trying to start is a php CLI script which is downloading stuff from an another server API, and I would like to change the IP based on different parameters. Once the script is started, I don't need anymore to change the ip OF THAT SPECIF...

Creating a testing environment with php cli

I would use php in console mode and create an environment to test directly my functions. In fact i would not be force to use a web browser and create a new file each time i want to test a function. I want to get in input the function in the console and then it return the result. So can someone if it is possible and how do i do? ...

Anything wrong with moving CLI validation/logic server-side?

I have a client/server application. One of the clients is a CLI. The CLI performs some basic validation then makes SOAP requests to a server. The response is interpreted and relevant information presented to the user. Every command involved a request to a web service. Every time services are modified server-side, a new CLI needs to ...

How can I get PHP to use the same APC cache when invoked on the CLI and the web?

I'm using APC to cache user variables (with the apc_store/apc_fetch commands). I've also enabled APC for the CLI with the option "apc.enable_cli = 1". However, the CLI version of PHP seems to access a different APC cache from the version used by Apache. Is it possible to configure APC to use the same cache for both CLI and web invocati...

CLR and CLI - What is the difference?

I am quite new .NET framework, hence I want to know what exactly is the difference between CLR & CLI ? From whatever I have read so far, it seems to indicate that CLI is a subset of CLR. But isn't everything in the CLR mandatory ? What exactly may be left out of CLR to create a CLI? ...

Can one executable be both a console and GUI app?

I'm wanting to make a c# program that can be run as a CLI or GUI app depending on what flags are passed to it. Can this be done? I have found these related questions but they don't exactly cover my situation: How to write to the console in a GUI application How do I get console output in C++ with a Windows program? ...

Windows equivalent of the Mac OS X “open” command

Liu Chang asked a very similar question to this one here, http://stackoverflow.com/questions/264395/linux-equivalent-of-the-mac-os-x-open-command. Is there a windows equivalent for the Mac OS X "open" command. I'm trying to run a profiler that will open it's results, but it's looking for the "open" command. Basically, the command need...

What's a good profiler for a CLI based multi-threaded PHP application?

I've written a batch processor that runs multiple threads (pcntl_fork) and I'm getting some weird results when child processes go defunct and don't seem to let go of their resources. Is there a good code profiler, trace utility I can use to 'watch' the parent process and children to see what is going on? ...

Windows cygwin equivalent of Mac OS X open command

I realize this is almost identical to http://stackoverflow.com/questions/501290/windows-equivalent-of-the-mac-os-x-open-command and http://stackoverflow.com/questions/264395/linux-equivalent-of-the-mac-os-x-open-command, but I'm asking specifically about a command I can run in the Cygwin shell to use the current Windows UI application bo...

Is there any way to know if a php script is running in cli mode?

... or the other way around, is there any way to know if a php script is running inside a web server? ...

PHP Server Name from Command Line

I can't find a way to detect the name of the server running a PHP script from the command line. There are numerous ways to do this for PHP accessed via HTTP. But there does not appear to be a way to do this for CLI. For example : $_SERVER['SERVER_NAME'] is not available from the command line. Does anyone have suggestions? Thanks, Ju...

Command line instruction parsing

I've been all over google and haven't been able to find a regex that would parse (correctly) CLI arguments. Does anyone have in their code library such a thing? Ideally it would parse all styles of arguments (i.e.: -v -abc --arg=val --arg="val1 val2" --arg "val") Thanks! P.S.: This would be used in PHP context (preg) ...

Is there an HTML version of the ECMA-335 CLI Specification?

I'm currently writing a blog post about the internals of the CLI, and I try to cite where something gets said. Mainly in the Partition III docs. I'm currently linking to the ECMA page for it, where there are a bunch of pdf- and zip-files, and making section references where they are needed; but I would really like to link directly to t...

PHP Warning when attempting to use stat() or filemtime()

I am attempting to get the last modified time of a file that definately does exist: /document_root/myfile.pdf -rwxr-xr-x 1 11018 11008 198621 Nov 26 2007 myfile.pdf When i run the following statement (through PHP CLI as root): filemtime('/document_root/myfile.pdf'); I get errors: Warning: stat(): Stat failed for /document_r...

Download an offline version of a webpage

Duplicate of Suggestions for a site ripper. Hi I need to download an offline version of an specific page. Including all images and CSS files. I need to recreate the entire webpage again in my server. Something running in the console would be great. Thanks ...

Attach to a processes output for viewing

How would I 'attach' a console/terminal-view to an applications output so I can see what it may be saying? How would I detach from an applications output without killing the application? Normally if you fire up a talkative application using the command line you get to see all kinds of wonderful output. However lets say I have a particu...

How do I time a program executing in Windows?

I want to be able to do the Windows equivalent of this Unix/Linux command: time fooenter code here foo x cpu time y real time z wallclock time ...

Odd Behaviour in Removing .git

I tried to remove my Git-files: rm -R .git | yes My CPU becomes loud, and no file is removed. I cannot understand what is going on. How can I remove my .git-files? ...

Python module for editing text in CLI

Is there some python module or commands that would allow me to make my python program enter a CLI text editor, populate the editor with some text, and when it exits, get out the text into some variable? At the moment I have users enter stuff in using raw_input(), but I would like something a bit more powerful than that, and have it disp...