Can PHP do this?



  • 1. cannot get exec() or passthru() to work?
    I cannnot seem to get exec() or passthru() to execute a perl script; here's the code snippet: if ($debug) { echo "username1 = ".$username1."<br>"; echo "dbname = ".$dbname."<br>"; echo "SESSION[dbname] = ".$_SESSION['dbname']."<br>"; echo "Output file = ".$outputfile."<br>"; echo "Project name = ".$projectname."<br>"; echo "Study name = ".$studyname."<br>"; echo "The command to be run is: ".$cmd."<br>"; } // Run the command! exec($cmd,$myoutput,$rtnvar); echo "rtnvar = ".$rtnvar."<br>"; foreach ($myoutput as $line) { echo $line."<br>"; } Which produces the results: username1 = rick dbname = cgb_lab_data SESSION[dbname] = cgb_lab_data Output file = myoutput Project name = IBS11_1103 Study name = IBS 11 The command to be run is: perl /home/caseyr/projects/LIMSScripts/3100DataIO/ -n 'IBS 11' -b 1103 -o myoutput -p IBS11_1103 -i S rtnvar = 13 The command looks perfectly legit, and will run at the command line if I cut and paste it. I do not understand the return value of 13. I can get a simple perl script that takes no arguments to run ok; so I think this has something to do with the arguments. I've used escapeshellarg() to no avail. I've always tried the same with system() and the backtick operator -- nada! If anyone can spot what I might be doing wrong, I'd appreciate it! Rick
  • 2. PHP5 run problem
    When I attempt to run PHP from the command line I get a file not found error on "php4ts.dll". Followed imediately with: ---------------- >php PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\Maguma Studio\php\extensions\php_dbg.dll' - The specified module could not be found. in Unknown on line 0 ----------------------- I have uninstalled "Maguma Studio" and removed all references in the registry and win.ini and sys.ini files. Same for "php_dbg.dll" and "php_dbg.dll" but I still keep getting the messages. I downloaded "" and put it in the c:\php directory. Even running php from that directory gets the errors! What do I have to do to run PHP? Thanks in advance for any help!
  • 3. session id contains invalid characters
    hello, I am getting this error with php 4.4.0 (cgi mode), apache 1.3.26 on debian woody: [01-Nov-2005 03:31:06] PHP Warning: session_start(): The session id contains invalid characters, valid characters are only a-z, A-Z and 0-9 in /home/m2004018/ on line 270 [01-Nov-2005 03:31:07] PHP Warning: Unknown(): The session id contains invalid characters, valid characters are only a-z, A-Z and 0-9 in Unknown on line 0 [01-Nov-2005 03:31:07] PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/m2004018/tmp) in Unknown on line 0 The PHPSESSID in the browser address bar looks normal: index.php?cPath=3&XTCsid=cdfb58872455c72c81dafa5026e6dd92 This is an oscommerce (actually xt:commerce) shop and currently it fails to send order-mails (to shop owner) or sends empty mails to the customer. thank you! -- Felix Natter

Can php do this?

Postby kurdayon » Wed, 21 Jul 2004 04:20:05 GMT


I would like to construct a web site that can do following. It
contains a number of short stories, visitor can read this stories and
give to them marks (story was good or bed). Stories have to be ordered
(by php) according to the given notes. Any user can add a new story
(just fill field and press button "Send"). Can I do it with php?

Thank you.

Re: Can php do this?

Postby Justin Koivisto » Wed, 21 Jul 2004 04:27:54 GMT

Yes, and you can do it with perl, asp, phthon, etc. as well. It a matter 
of preference and support on the hosting server. You'll also need to 
know what RDBMS you'll use to accomplish this as well to interface with. 
Once you get the data from the RDBMS (or even flat text files I guess), 
it's just a matter of generating the HTML to display it with.

Justin Koivisto -  XXXX@XXXXX.COM 
PHP POSTERS: Please use comp.lang.php for PHP related questions,
              alt.php* groups are not recommended.

Re: Can php do this?

Postby Pedro Graca » Wed, 21 Jul 2004 04:28:17 GMT

You also need a HTTP server and you'd really like a database for that.

USENET would be a better place if everybody read:   | to email me: use |
 http://www.**--****.com/ ~esr/faqs/smart-questions.html  | my name in "To:" |
 http://www.**--****.com/ | header, textonly |
 http://www.**--****.com/ | no attachments.  |

Re: Can php do this?

Postby Artoo » Wed, 21 Jul 2004 04:29:15 GMT

Kurda Yon a exposle 19/07/2004 :
>> Hi,
>> I would like to construct a web site that can do following. It
>> contains a number of short stories, visitor can read this stories and
>> give to them marks (story was good or bed). Stories have to be ordered
>> (by php) according to the given notes. Any user can add a new story
>> (just fill field and press button "Send"). Can I do it with php?
>> Thank you.

Yes, it can.
Try it and ask if you have troubles.

Some ideas to start with (a solution in a million) :
Store the stories in files,
Manage stories and ranking in a db.
Use a form for visitors to vote/rank their favorite
Use another form to submit a story.

So learn how to retreive data from a HTML form,
how to read/wirte to files,
store/get data from database,

Some usefull links :

Ceci est une signature automatique de MesNews.
Site :  http://www.**--****.com/ 

Re: Can php do this?

Postby Westcoast Sheri » Wed, 21 Jul 2004 05:38:10 GMT

Question: you say, "store the stories in files..."
Well, what are your thoughts about storing the stories in a mySQL database?

Re: Can php do this?

Postby Pjotr Wedersteers » Wed, 21 Jul 2004 06:51:51 GMT

Personally I'd rather have the names and ranks etc in a db, and keep the
stories outside, in files/folders. Since the stories' contents are nowhere
used as a means of sorting one can do without in the db, and keep that small
in size. I do similar things with jpegs.
I don't know if that is wrong/stupid, but it works like a charm for me. Plus
I can simply view/edit the pictures without having to process a database.

Re: Can php do this?

Postby filesiteguy » Wed, 21 Jul 2004 06:57:40 GMT

On 19 Jul 2004 12:20:05 -0700,  XXXX@XXXXX.COM  (Kurda Yon) pecked

Many sites do this. Slashdot for one - and they provide their source
code for free. I don't know if they do it in PHP, however.

Check out various script repositories for a start.

kai ||
g2004 at

Re: Can php do this?

Postby Trevor Smith » Wed, 21 Jul 2004 19:30:05 GMT

You might want to look at WordPress. Its a free blog system written in
php/MySql that has the core of what you are looking for and its fairly
easy to build upon.


Re: Can php do this?

Postby For example John Smith » Wed, 21 Jul 2004 20:46:10 GMT

I found the wordpress code to be "a bit of a mess" and that's an
understatement. But opinions.... Yep I have one too.
Besides I am one of those perfectionists who want to invent it all for
themselves. Idiocy, I know, but I'm like that. Mostly after I have succeeded
in making it myself I am inclined to give other people's code a look... Call
me stupid.

Re: Can php do this?

Postby /.. » Tue, 27 Jul 2004 03:11:56 GMT

By Mon, 19 Jul 2004 20:38:10 GMT, Westcoast Sheri
 decided to post "Re: Can php do this?"  to

It's generally better, faster and easier to store, manipulate and maintain
relatively large (say, 1Kbyte and up) data in files external to a db and
use the db to store paths and other information about the files.  

store: use a script to obtain path, directory and filename info; use script
to update db with this data
manipulate: use features of the operating system for file manipulation:
renaming, editing, moving about, etc.
maintain: delete, add files, etc.

An obvious exception would be if you wanted full text searching using the
db.  Short of that function, which could be implemented in other ways (eg
php, perl, grep, etc.), storing large data files in db's adds another layer
of complexity and more processing requirements for access and manipulation,
while abstracting your ability to perform simple functions provided by the
operating system.  It might also be true that db's crash or suffer from
corrupted files more often than os's, so you would be at greater risk of
data loss.  Of course it's about as easy to backup the db as it is
filesystem based files:

## belt, suspenders and buttons: run db backup(s)

## remove old files from second backup directory
rm /hdx/x/mysql_backups/dbname/old2/*;

## move last backup to old2
mv /hdx/x/mysql_backups/dbname/old/* /hdx/x/mysql_backups/dbname/old2/

## backup all tables, individually to separate files in backup directory:
mysqldump -a dbname -u user table1>> \
/hdx/x/mysql_backups/dbname/table1_`date +%Y-%m-%d`_bak.sql

find / -iname "*gw*" -exec rm -rf {} \;

In heaven, there is no beer,
  That's why we drink it here,
      And when we're all gone from here,
Our friends will be drinking all the beer!
    -- Famous old Czech song about beer --

Can php do this?

Postby kurdayon » Wed, 25 Aug 2004 01:37:02 GMT


before to start study and use php I would like to ask what php can do?
Or to be more precise, I have more or less defined aim and would like
just to know whether it can be done in php. So, can one with the usage
of php create a web based e-mail service like Yahoo or hotmail? Can
one create with php web based forum like on
" http://www.**--****.com/ "? Is php a good chose for this?


Re: Can php do this?

Postby CJ Llewellyn » Wed, 25 Aug 2004 02:28:28 GMT

You'll find a gazzillion projects written in php that do both of these, no
programming needed.


Re: Can php do this?

Postby Phil Roberts » Wed, 25 Aug 2004 03:55:27 GMT

 XXXX@XXXXX.COM  (Kurda Yon) emerged reluctantly from the curtain 
and staggered drunkenly up to the mic. In a cracked and slurred voice 
he muttered:

Uhm, that forum *IS* written in PHP.

Phil Roberts | Deedle Doot Doo Dee Dee |  http://www.**--****.com/ 

I could be wrong here, You could be right
Please forgive me I have sinned - Not on your life
But that's how you want me, But I'll never fear thee
Why you and not me? Tell me Holy Man

Can PHP do this?

Postby zn » Tue, 28 Dec 2004 03:49:16 GMT

I'd like to automate the e-mailing of monthly customer account statements. 
Can PHP be used as a stand-alone scripting tool on an Oracle database 
server to do the following steps:

1. run a SQL query for a single customer
2. save those results to a file (text or PDF)
3. e-mail the file to the customer

I'm not trying to do this from within a web browser. I want to use Cron to 
run a script to complete the above steps on a monthly basis.


Re: Can PHP do this?

Postby Janwillem Borleffs » Tue, 28 Dec 2004 06:11:48 GMT

Of course PHP can do this, reference the manual for info on how to implement 
the steps:

1.  http://www.**--****.com/ (or  http://www.**--****.com/ ::DB from
2.  http://www.**--****.com/ ,  http://www.**--****.com/ (text 
3.  http://www.**--****.com/ 


Similar Threads:

1.[PHP] PHP timeout doing fread from Apache Coyote

* Thus wrote Robert Fitzpatrick ( XXXX@XXXXX.COM ):
> I am trying to communicate with an API of a vendors of ours. They provide a
> Perl example that works fast and well. I am trying to do the same thing with
> a PHP class. The response takes over a minute before the response comes
> back. I see from the response text that the API is running on Apache
> Coyote/1.0. Does anyone know of issues with this match-up, here is the
> snippet of code that seems to be hanging. Using my Komodo debugger, it
> points to the line with 'while($data=fread($fp, 32768))' while waiting for
> execution to continue. Using a Perl script provided by them, I get a
> response in seconds. Basically, my PHP page prepares content and variables
> and then uses this class to send XML formatted content to receive a
> response.
>       ...
>       $fp=fsockopen($this->server, $this->port, &$this->errno,
> &$this->errstr, $this->timeout);
>       if(!$fp) {
>         $this->errstr="Cant Connect to Service ($this->server:$this->port,
> $this->errno, $this->errstr)";
>         return;
>       }
>       if (!fputs($fp, $op, strlen($op))) {

which HTTP version are you requesting?  I know that if you send a
HTTP/1.1 then a lot of servers send the data in chunks, thus your
retrieval code needs to be different. If it is HTTP/1.1 try using
HTTP/1.0 instead.

>           $this->errstr="Write error";
>           return;
>       } else {
>        $ipd = "";
>        while($data=fread($fp, 32768)) {

Have you tried smaller requests mabey 512? although that shouldn't
matter, but you might be able to see if it is getting data back at

>       $ipd.=$data;
>    }


"I used to think I was indecisive, but now I'm not so sure."

2.[PHP] REVISED: PHP timeout doing fread from Apache Coyote

3.can we embedd perl script and Html, like we r doing in php

4.Who here has done PHP shopping carts before?

I need a back-to-basics shopping cart tutorial in PHP/mySQL.  I thought I
had it down and I failed, as usual. Here is what I mapped out as a spec:

3) initial work on bestilling.php to contain the following plan:

 1) Cookie: 'nordicnet_bestilling' to contain unique, random 16-char string
 2) Table: nnet_produkt_bestilling to contain ordering information bundled
           unique bestilling_id (16-char string)
  a) produkt_id
  b) farge_id
  c) storrelse_id
  d) quantity ordered
  e) bestilling_id
  f) nordicnet_registration_number
 3) *PROPOSAL* To make cookie a timed cookie - if user does not check out in
X hours
    the cookie will be deleted
 4) *PROPOSAL* CRON-based PHP script to systemically wipe out any stray rows
    nnet_produkt_bestilling that have not yet been checked out
 5) Idea plan for bestilling:
  a) User will order produkt in vis_varegruppen.php
  b) bestilling.php will do server-side checking of produkt, farge,
     and quantity based upon entry in nnet_produkt_farge_storrelse_assoc
  c) bestilling.php will then check if $_COOKIE['nordicnet_bestilling']
     already exists (meaning you have an order # - or, a cart ('bestill')
  d) If you have a cart then check if there is already a row in
     nnet_produkt_bestilling with same produkt_id/farge_id/storrelse_id with
     matching bestilling_id
  e) If so then increase quantity ordered by the quantity you ordered and
     quantity totals against nnet_produkt_farge_storrelse_assoc
  f) If NOT then add new row with produkt_id, farge_id, storrelse_id and
     quantity with your bestilling_id and registration number
  g) -- If you do NOT have a cart (no cookie) then generate a new cart
     id into a cookie
  h) If other people ordered the same item be sure to check their quantities
     ordered against yours and what is in stock before proceeding

So far this is what happens:

1) I enter products into the cart
2) If I delete items from the cart, they can be deleted; if I delete all
items from my cart, the cart cookie is deleted, I think.
3) I try to re-enter the same item into the cart, it inserts into the db w/
a NULL value for 'nnet_user_bestilling_id' which is
    the cart id (which it's not supposed to do) and browser-side logic
fails, you get the wrong screen and all kinds of garbage I cannot even go
into because it's in Norwegian

I have tried for nearly 24 hours to build a cart and I can't seem to get it
done.  I really need some help.


5.while php is doing its thing..

iv got a script that uploads 2 jpegs that the user defines..
which can get quite large.. avrage about 2 * 700kb images
so it can take a while.

i have a html form that posts the imagesto a php script.
i then go like this

        $path = '/home/username/public_html/upload/';
        $tempName1 = $_FILES['userFile1']['tmp_name'];
        $realName1 = $_FILES['userFile1']['name'];

        $path1 = $path.$realName1
        if (move_uploaded_file($tempName1, $path1)){
            // the above is repeated for image 2 but i cant be arsed to show

            // rest of the page here

            echo "could not move image";

this works fine but it can take ages for the page to be displayed..
is there any way i can display a page while the mages are being moved and
then update
to the actual page when that part of the script has run?

so i could  have a "please wait. your images are being uploaded" and then it
would change to my content
when the script has run successfully

6. need small PHP job done

7. How should i done this in PHP?

8. help on integrating RSS in site done in php

Return to php


Who is online

Users browsing this forum: No registered users and 42 guest