Im using Debian testing, i have installed php-cli and when i try to execute a php script it output the source instead of executing it.
Example:
php test.php
<?
phpinfo();
?>
any ideas how to fix this behavior, i tried reinstalling and purging no results.
...
Hi,
I'm running a CLI PHP script.
I'm requesting data from a server that only lets me in if my domain is www.mydomain.com.
It runs fine when I run through Apache, but when I run through CLI I presume my domain has now changed to the server IP, i.e. 84.123.123.123
The external server obviously rejects me now.
How can I request as if I...
i wanna using curl in php script and run it in command line mode.
here is the script
<?php
//enable_dl("php_curl.dll");
$ch = curl_init();
$options=array(
CURLOPT_URL=>"http://test.com/wp-content/themes/bluefocus/images/desc_img.jpg",
CURLOPT_BINARYTRANSFER=>true,
CURLOPT_VERBOSE=>true
);
curl_setopt_array($ch,$options);
...
any solution to this ?
#!/usr/bin/php -q
<?php
set_time_limit(2);
sleep(5);
echo "it didn't work again";
...
I want to run a php script from the command line that is always running and constantly updating a variable.
I then want any php script that is run in the meantime (probably but not necessarily from the web) to be able to read that variable at any time.
Anyone know how I can do this?
Thanks.
...
Many of the component libraries and toolkits I'm familiar with lack CLI-specific libraries (zend, kohana, etc..). Are there any libraries/tools that are designed specifically for developing CLI application (such as an abstraction of php's multi-threading library, pcntl/posix)?
...
I am trying to use Zend Tool on my media temple Grid Server account. The problem is that the installed CLI version of PHP is 4.4.8 and Zend Framework needs PHP5. On an account basis its possible to choose PHP 4 or 5 but not so for CLI. Its possible to globally select to use PHP5 by using the extension .php5 but in the case of Zend Tool w...
Hi-- I've written a PHP script that runs via SSH and nohup, meant to process records from a database and do stuff with them (eg. process some images, update some rows).
It works fine with small loads, up to maybe 10k records. I have some larger datasets that process around 40k records (not a lot, I realize, but it adds up to a lot of wo...
Can someone point me in the correct direction for researching how to prevent users from breaking out of a php script with ctrl-z, ctrl-c?
...
I have managed to initiate php-cli script debug session from the IDE itself, but I need to start the debugging session from the shell / command line. These are rather complex maintenance PHP scripts which take a lot of input parameters, so entering arguments from within Netbeans is a bit cumbersome.
I have done it before with Zend studi...
I'd like to be able to run a line of PHP code on the command line similar to how the following options work:
:~> perl -e "print 'hi';"
:~> python -c "print 'hi'"
:~> ruby -e "puts 'hi'"
I'd like to be able to do:
:~> php "echo 'hi';"
I've read that there is a -r option that can do what I need for php, however it doesn't appear to b...
It appears that the php command line is using a different php.ini from the main php interpreter. I am using Ubuntu 10.4. My problem is that in the main php.ini I have included an extra path for an external library, but in the cli version this is not present, and so I have a path inclusion error.
thanks
...
Hi Folks,
I wish to create a shell "Menu"
Instead of using bash for my script, I wish to use PHP. Is it possible to run an external program using php, that will interact with the user?
For example, let's say I wanted the php script to run /bin/bash (Just an example), but then when exiting bash, got back to the start of the script (i.e...
Until now, I had been checking for the presence of argc and argv in my script to determine whether requests were coming from the CLI, which worked on several development machines. When placed on a particular shared host, though, the program went into fits. Looking at my routing code, I discovered that the host was setting both argc and a...
Where I'm stuck is the right parameter syntax to instantiate an object using PHP's com() and dotnet() classes to load .net assemblies, windows system applications and components beyond the usual MS Office apps. If successfully created, working with the objects isn't an issue here.
Can anyone explain what each part of each parameter mea...
Hi--
I'm writing a PHP script that I want to disable from web access (I will ask users to move it out of the web root and execute via CLI, but you never know if they'll listen!)
Is there a simple function that occurs to anyone to make the page die if it's requested by a browser?
Thanks for any ideas.
...
I have a simple cmd.php page to run commands I enter using shell_exec () and show the output.
PHP is running as CGI
Entering "php -v" and most commands just show "Content-type: text/html" and then the current page's HTML source.
However, calling PHP with an invalid parameter (/usr/bin/php -z) shows PHPs usage:
Usage: php [-q] [-h] [-s...
Hi folks,
I am running a PHP Script on the CLI (logged in as root). It is actually building a Zend Lucene Search index.
All output is logged to the command line. PHP directves like max_execution_time and memory_limit are set sufficient (0 resp. 1024M). The error reporting is set in the script as follows:
error_reporting(E_ALL | E_STR...
Below is partial code to an experimental http server app I'm building from scratch from a PHP CLI script (Why? Because I have too much time on my hands). The example below more closely matches PHP's manual page on this function. The problem I'm getting is when connecting to this server app via a browser (Firefox or IE8 from two separat...
Hi all,
i have some scripts that need GET and POST values to start, and i wanna test them over shell.
Is there some way to pass the values to that arrays to avoid using getenv() function?
Thanks in advance!
...