PDA

View Full Version : [ubuntu] PHP tools


quikone8
March 26th, 2009, 06:08 PM
I am running a web server and would like to be able to test some of my php scripts remotely. Are there any tools that will work with firefox or terminal to accomplish debug?

Bachstelze
March 26th, 2009, 07:35 PM
You can run PHP scripts from the command-line or run the PHP interpreter:

firas@hatchin ~ % cat test.php
<?php

$foo = "bar";
var_dump($foo);

firas@hatchin ~ % php test.php
string(3) "bar"
firas@hatchin ~ % php -a
Interactive shell

php > $foo = "bar";
php > var_dump($foo);
string(3) "bar"
php >

quikone8
March 26th, 2009, 07:54 PM
You can run PHP scripts from the command-line or run the PHP interpreter:

firas@hatchin ~ % cat test.php
<?php

$foo = "bar";
var_dump($foo);

firas@hatchin ~ % php test.php
string(3) "bar"
firas@hatchin ~ % php -a
Interactive shell

php > $foo = "bar";
php > var_dump($foo);
string(3) "bar"
php >


I don't mean to be thick, but is this an example or is this a script that would start command line testing?

Bachstelze
March 26th, 2009, 09:16 PM
I don't mean to be thick, but is this an example or is this a script that would start command line testing?

It was just an example, to illustrate how to run a PHP script from the command-line. ;)

Basically, php myscript.php executes a script, and php -a starts the interactive interpeter.

hyper_ch
March 27th, 2009, 08:32 AM
you need to have php5-cli package installed to run scripts from the terminal.

quikone8
March 27th, 2009, 02:53 PM
you need to have php5-cli package installed to run scripts from the terminal.

Okay, I have got that downloaded and installed on the server. I have a php script in ubercart that has a very slight error. Is there a way to debug remotely, if so, how? Do I need to right anything to make it work? Thanks for the help.

ddoom
March 28th, 2009, 12:20 AM
By the sound of it you need knowledge of PHP.

hyper_ch
March 28th, 2009, 09:23 AM
well, php5-cli is only needed if you want to run php script on the cli (e.g. a cron job).

What error do you get? By default the php.ini will display errors and line and then youhae to troubleshoot yourself...

quikone8
March 29th, 2009, 01:44 PM
well, php5-cli is only needed if you want to run php script on the cli (e.g. a cron job).

What error do you get? By default the php.ini will display errors and line and then youhae to troubleshoot yourself...

No error, the code is showing up in the field instead of the desired data. I am sure that I have it coded incorrectly. Is there a good place to figure out what I am doing wrong?

hyper_ch
March 29th, 2009, 03:21 PM
trysudo a2enmod php5

gregor171
March 29th, 2009, 04:40 PM
You might be missing open and close tag in script:

<?php
// your code
?>

Or you dont have php or php-cli installed. It should run without apache.