All commands. Using PHP from the command line. Spawning php-win.exe as a child process to handle scripting in Windows applications has a few quirks (all having to do with pipes between Windows apps and console apps). To do this in C++: // We will run php.exe as a child process after creating // two pipes and attaching them to stdin and stdout // of the child process // Define sa struct such that child inherits our handles SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) }; sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; // Create the handles for our two pipes (two handles per pipe, one for each end) // We will have one pipe for stdin, and one for stdout, each with a READ and WRITE end HANDLE hStdoutRd, hStdoutWr, hStdinRd, hStdinWr; // Now create the pipes, and make them inheritable CreatePipe (&hStdoutRd, &hStdoutWr, &sa, 0)) SetHandleInformation(hStdoutRd, HANDLE_FLAG_INHERIT, 0); CreatePipe (&hStdinRd, &hStdinWr, &sa, 0) SetHandleInformation(hStdinWr, HANDLE_FLAG_INHERIT, 0); std::string processed(""); char buf[128];
Linux and Web Development Intro. There’s a good chance you’ve heard of Linux. Recently there has been a whole lot of buzz going around the Internet about a particular distribution of Linux dubbed Ubuntu. There are a ridiculous amount of articles floating around regarding the operating system itself and all sorts of introductory pieces surrounding it. I’ll leave it to you and Google to read about that if this is the first time you’ve heard of Linux. This article isn’t going to focus particularly on Ubuntu, but Linux in general, as the subject matter will be surrounding Linux as an operating system for Web development, not Ubuntu as a distribution of choice. Software mentioned here is not specific to the Ubuntu distribution, but specific to Linux itself. I’m generally not a fan of Apple/Mac/Jobs and I’ve grown to dislike Microsoft/Windows/Gates. I don’t say that to offend anyone, so please don’t take it the wrong way. Why I Choose Linux Some months ago, I decided to give it another shot.
Enter Ubuntu. Getting Set Up.