Ancient old crusty decided to try PHP a week or so ago. Signed up with a provider who offer PHP. Bought book. Mastering PHP.. first few pages give example of passing a string via the command line. Code:
I'm trying to test some php script using the command line php.exe. Is there any way to pass the $_POST variables? I know how to pass the $_GET variables, but I don't know how to do this for the $_POST ones.
The output at the browser is: No of lines are : 3428 (This is wrong)While executing the same command using command line gives a different output.My code snippet for the same is: <?php $moreCommand = "more +3693 /var/log/apache2/access_log | grep -v -e '.jpg' -e '.jpeg' -e '.css' -e '.js' -e '.bmp' -e '.ico'| wc -l";
The output at the command line is: No of lines are : 279 (This is correct)While executing the same command directly in command line, gives me output as 279.I am unable to understand why the output of the same command is wrong in the browser.Its actually giving the word count of lines, ignoring the offset parameter.
Command Works From Command Line But Not Through System(),exec()?
PHP script which changes the date/time and timezone.The date and time change just fine, but I cannot get the timezone to change through the script.If I type the same command at a DOS prompt it works.This only runs on a closed server (client and host are always the same) so security is not an issue.I've checked that PHP is not in safe mode and I have tried using all options to run a command that I know of (system(), exec(), shell_exec(), passthru()).This is running on XP Pro SP3.
Here is my script: $timezone = $_POST['timezone']; $time = $_POST['time']; $date = $_POST['date'];
this specific command would not work?A PHP setting?Syntax?Windows Permissions?
Run An External Program In (via Command Line) Using Shel_exec Command?
basically i want to run an external program in PHP (via command line) and to do that i am using shel_exec command.
I understand that the shel_exec takes "String" parameter and my problem is exactly here:
I am trying to pass a variable (containing a file name) to the shel_exec, however it is not working. If I just type the content of my variable (i.e. file name) it will work but not when I am using the variable. here is the part of the code i am working in:
I have tried to print out "$pAddress" to make sure it is actually containing what I think it contains and it was fine; it DOES contain the file name, However when it is used inside the shel_exec it is not working.
Use Mcrypt_decrypt From Commond Line - Error - Call To Undefined Function Mcrypt_decrypt() In Command Line Code On Line 1?
i m trying to use mcrypt_decrypt from commond line but i m getting the folllowing error:-
Call to undefined function mcrypt_decrypt() in Command line code on line 1
and any other alternative solution because i m using os:cmd() from erlang to achive this.since erlang do have function to achieve this but i m unable to figure out whats worng in that.so thought of doing like this so that i verify the things.
all examples of phpunit I saw run the simple command line tool:phpunit TestClass but when I try the same on a directory other than the xampp php dir, I end up getting an "unknown command."Is there a way to execute the phpunit command from any directory in the Windows command line?
I'm using PHP 4.4.2, and use PHP on both the command-line and the web.
I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. Everything has been running flawlessly without problems. Very amazing to use VMware, it has worked beautifully.
Linux xxxxxxx 2.6.13-15.8-default #1 Tue Feb 7 11:07:24 UTC 2006 i686 i686 i386 GNU/Linux
php -v PHP 4.4.2 (cli) (built: Feb 7 2006 20:13:29) Copyright (c) 1997-2006 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
[PHP Modules] bcmath bz2 calendar ctype curl dbx dio domxml exif ftp gd gettext gmp iconv mcrypt mssql mysql ncurses openssl overload pcre posix session shmop sockets standard sysvsem sysvshm tokenizer wddx xml yp zlib
When I run the following program from the command line it prints out the source code as well as the output from the program. I run other PHP programs on the command-line and this doesn't happen. It's really peculiar. The error output is below.
I copied this off of php.net, and have modified it only slightly to allow command-line input. I was trying to find a CSV solution, which I ended up finding elsewhere, but am curious why this program would error out the way it does--have I misconfigured something? My php.ini is basically unchanged, if at all. I think I might have set the path to mysql but that's about it. When I run this program from the web it works without error.
Output Multiple Line Command-line Outputs As Different Lines?
PHP: Output multiple line command-line outputs as different lines. Sorry if the title is difficult to understand. Basically I want my output like A, instead of B. It currently looks like B. I have tried nl2br. The script I am trying to run is:
Cli - Command Line Progress Bar - Add Progress Bar To Command Line Script?
I am currently trying to add a progress bar to a command line script and I've tried various solutions (including Zend and Console_ProgressBar). The problem they both have in common is that the progress bar doesn't stick at the bottom of the window because during the script, new lines and other information is outputted. Is there any way to keep the progress bar at the bottom of the terminal but still be able to output other information while the script is running? [Edit] I figured it out: Instead of outputting directly to STDOUT I am actually grabbing the output inside a variable, I erase the screen with echo chr(27) . '[2J' and then output to STDOUT the contents of the variable and then append my progress bar.
DAL Library Which Has The Similar .Net's Feature: Command.Parameter?
ood DAL library for PHP which has the similar .Net's feature: ommand.Parameters.AddWithValue("@demographics", demoXml).mysqli extension is good but I want to have the aforementioned feature too. Putting many "?" does not look nice and rather confusing when a table has many fiends (>= 8).
I've got a script using com objects that will work in asp but not work with php.
The asp script creates an object that does something and returns a string. I want this sting to be passed to an php script without putting it in a getstring. The getstring will expose the value and thats not my intention. Encryption is an option but I'm not charmed by that solution. I'd rather do it behind the scenes.
I am implementing OpenId login in a CakePHP application. At a certain point, I need to redirect to another action, while preserving the information about the OpenId identity, which is itself a URL (with GET parameters), for instance[URL]How do I pass this data? The first attempt would be
I'm trying to work out how to pass a parameter to a PHP script so that I can use a URL as simple as: www.mysite.com/john
where "john" is actually a value to be passed to a script called index.php In other words, the full conventional URL of this would have been:
I've got as far as using the PATH_INFO environment variable to capture parameters from a URL like: www.mysite.com/index.php/john
but would like to be able to eliminate either the ".php" bit from "index.php", or the whole thing altogether. I know this is possible because I've seen plenty of sites use this URL style. I'm wondering if this involves messing with the DNS setup, which won't be possible for me as I'm running on a name-based shared server.