[PHP] session woes
I had my script working beautifully on my box but when transferring to dev server no such luck Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the session.use_trans_id = 1 so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now. It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3. I'm also getting [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 where line 60 is my session_start(); I'm kinda clueless as to what to try next. Thanks for any ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session woes[RESOLVED]
Bingo ya know I knew that about the headers but it threw me since it worked on my box perfectly no matter where I put the session_start(); Lo and behold I check out the php.ini on my box and there it was: output buffering=4096 I did not know about the output buffering. BUT I just moved my session_start(); to the very tip top in we're in ship shape. Sorry for all the strange sayings Thanks so much to Jason, Stephen and John Ciao Stephen Johnson [EMAIL PROTECTED] 03/23/05 11:30AM You need to make sure that output_buffering is turned on in your php.ini file on the dev server. ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? From: Mignon Hunter [EMAIL PROTECTED] Date: Wed, 23 Mar 2005 11:20:24 -0600 To: php-general@lists.php.net Subject: [PHP] session woes I had my script working beautifully on my box but when transferring to dev server no such luck Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the session.use_trans_id = 1 so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now. It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3. I'm also getting [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 where line 60 is my session_start(); I'm kinda clueless as to what to try next. Thanks for any ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session in URL [RESOLVED}
I had my admin change the session.use_trans_sid = 1 to =0 no more sess ID in the URL - woo hoo I guess this has to be 0 or in later versions 4.3.0 session.use_only_cookies = 1 * Hello I have tested this app on my machine but it doesnt do this - but when testing on development server, my script is displaying the session in the url. I was reading in man about session.use_only_cookies can keep this from happening but the dev server has php 4.1.2 Is there another way to stop this? My script is such: while($row = mysql_fetch_row($res)) { echo lia href = sess_downloads_p2.php?$row[0]$row[1]/a/li; } where $row[0] is a filename like filename.pdf But when sess_download_p2.php loads in browser the URL has ...PHPSESSID=(rand number) Thanks for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file/array manipulation[RESOLVED]
Got it - never mind instead of $new_array = array($line_split[0] = $line_split[1] ); it's $new_array = array($line_split[0] , $line_split[1] ); But I'm still not sure how it works so well... Ok I got this to work but I'm not sure how -- and am having trouble re-producing the data: My script I have so far is: $lines = file('test2.csv'); foreach ($lines as $line) { $line_split = explode(,, $line); if(!(empty($line_split[0]) ) ){ //echo I'm not empty; $new_array = array( $line_split[0] = $line_split[1] ); } print(pre); print_r($new_array); print(/pre); //echo trtd . $new_array[0] . /tdtd . $new_array[1] . /td/tr;// this doesnt work } Here's what the printed format spits out (abbreviated): Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) So - I'm getting the write letters assigned to write companys which is great. But my echo line: echo trtd . $new_array[0] . /tdtd . $new_array[1] . /td/tr;// this doesnt work Do I have several arrays or a multidim array? Thanks for any guidance Richard Lynch [EMAIL PROTECTED] 03/15/05 10:39AM Hello I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line, but I need to write where column A is missing ColumnAColumnB RABC company ABC company ABC company ABC company OXYZ company XYZ company XYZ company XYZ company What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA while ColumnB equals $var (ABC company, XYZ company), so that I end up with: ColumnAColumnB RABC company RABC company RABC company RABC company OXYZ company OXYZ company OXYZ company OXYZ company Is this possible. What I've got so far to print out the file: $lines = file('test2.csv'); $category = ''; // Loop through our array, and show line and numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . $line . br /\n; //Assuming it's the FIRST character of each line that has space or category: //Check first character: if ($line[0] != ' ' $line[0] != \t){ $category = $line[0]; } echo $category\t, trim(substr($line, 1)), br /\n; } Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file/array manipulation
Ok I got this to work but I'm not sure how -- and am having trouble re-producing the data: My script I have so far is: $lines = file('test2.csv'); foreach ($lines as $line) { $line_split = explode(,, $line); if(!(empty($line_split[0]) ) ){ //echo I'm not empty; $new_array = array( $line_split[0] = $line_split[1] ); } print(pre); print_r($new_array); print(/pre); //echo trtd . $new_array[0] . /tdtd . $new_array[1] . /td/tr;// this doesnt work } Here's what the printed format spits out (abbreviated): Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [R] = ABC company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) Array ( [O] = XYZ company ) So - I'm getting the write letters assigned to write companys which is great. But my echo line: echo trtd . $new_array[0] . /tdtd . $new_array[1] . /td/tr;// this doesnt work Do I have several arrays or a multidim array? Thanks for any guidance Richard Lynch [EMAIL PROTECTED] 03/15/05 10:39AM Hello I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line, but I need to write where column A is missing ColumnAColumnB RABC company ABC company ABC company ABC company OXYZ company XYZ company XYZ company XYZ company What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA while ColumnB equals $var (ABC company, XYZ company), so that I end up with: ColumnAColumnB RABC company RABC company RABC company RABC company OXYZ company OXYZ company OXYZ company OXYZ company Is this possible. What I've got so far to print out the file: $lines = file('test2.csv'); $category = ''; // Loop through our array, and show line and numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . $line . br /\n; //Assuming it's the FIRST character of each line that has space or category: //Check first character: if ($line[0] != ' ' $line[0] != \t){ $category = $line[0]; } echo $category\t, trim(substr($line, 1)), br /\n; } Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file/array manipulation
Hello I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line, but I need to write where column A is missing ColumnAColumnB RABC company ABC company ABC company ABC company OXYZ company XYZ company XYZ company XYZ company What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA while ColumnB equals $var (ABC company then XYZ company), so that I end up with: ColumnAColumnB RABC company RABC company RABC company RABC company OXYZ company OXYZ company OXYZ company OXYZ company Is this possible. What I've got so far to print out the file: $lines = file('test2.csv'); // Loop through our array, and show line and numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . $line . br /\n; } Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file/array manipulation
Hello I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line, but I need to write where column A is missing ColumnAColumnB RABC company ABC company ABC company ABC company OXYZ company XYZ company XYZ company XYZ company What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA while ColumnB equals $var (ABC company, XYZ company), so that I end up with: ColumnAColumnB RABC company RABC company RABC company RABC company OXYZ company OXYZ company OXYZ company OXYZ company Is this possible. What I've got so far to print out the file: $lines = file('test2.csv'); // Loop through our array, and show line and numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . $line . br /\n; } Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file/array manipulation
Hello I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line, but I need to write where column A is missing ColumnAColumnB RABC company ABC company ABC company ABC company OXYZ company XYZ company XYZ company XYZ company What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA while ColumnB equals $var (ABC company then XYZ company), so that I end up with: ColumnAColumnB RABC company RABC company RABC company RABC company OXYZ company OXYZ company OXYZ company OXYZ company Is this possible. What I've got so far to print out the file: $lines = file('test2.csv'); // Loop through our array, and show line and numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . $line . br /\n; } Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP- accessing session var
Hi This will be real simple for you guys. When I print_r my session vars part of what get is: [_SESSION] = Array ( [cart] = shoppingcart Object ( [contents] = Array ( [37] = Array ( [qty] = 1 ) ) [total] = 70 [weight] = 0 [cartID] = [content_type] = physical ) SO I'm trying to capture the total(70). I'm trying $_SESSION['cart']['total'] But I'm not getting it. This is a multidimensional array isnt it ? -- Thx Mignon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP- accessing session var
Thanks Mike and Michael Smith. It works ! On Thu, 2003-08-14 at 05:57, Ford, Mike [LSS] wrote: On 13 August 2003 23:00, Mignon Hunter wrote: Hi This will be real simple for you guys. When I print_r my session vars part of what get is: [_SESSION] = Array ( [cart] = shoppingcart Object ( [contents] = Array ( [37] = Array ( [qty] = 1 ) ) [total] = 70 [weight] = 0 [cartID] = [content_type] = physical ) SO I'm trying to capture the total(70). I'm trying $_SESSION['cart']['total'] But I'm not getting it. This is a multidimensional array isnt it ? -- No, it's a 1-dimensional array containing an Object of class shoppingcart, so you want: $_SESSION['cart']-total Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP- accessing session var
Ps i'm a girl On Thu, 2003-08-14 at 08:53, Mignon Hunter wrote: Thanks Mike and Michael Smith. It works ! On Thu, 2003-08-14 at 05:57, Ford, Mike [LSS] wrote: On 13 August 2003 23:00, Mignon Hunter wrote: Hi This will be real simple for you guys. When I print_r my session vars part of what get is: [_SESSION] = Array ( [cart] = shoppingcart Object ( [contents] = Array ( [37] = Array ( [qty] = 1 ) ) [total] = 70 [weight] = 0 [cartID] = [content_type] = physical ) SO I'm trying to capture the total(70). I'm trying $_SESSION['cart']['total'] But I'm not getting it. This is a multidimensional array isnt it ? -- No, it's a 1-dimensional array containing an Object of class shoppingcart, so you want: $_SESSION['cart']-total Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Probs with Vars in shop cart app
Here's one to scratch your head. I wrote a function to call an external program from my shopping cart app: get_new_tax($state, $zip, $new_city, $amt); This function does a calculation and returns the results. In the main function function tep_get_tax_rate(){ the code returns $tax_multiplier. When I manually set this var to 8.25 for example, the amount is calculated and the tax is displayed into the shopping cart app in the correct place. When I assign the value from my new function to the $tax_multiplier var, (8.25 because I echo it out)- the tax amount is missing from the shopping cart in the place it should be. The value is the same both ways. I am returning $tax_multiplier each time back to the program. But I cannot figure out why it wont work when assigning the value: $tax_multiplier = $var_from_function; echo ** . $tax_multiplier . **;//this echos **8.25** $tax_multiplier = 8.25;//this echo 8.25 echo ** . $tax_multiplier . **;//this echos **8.25** return $tax_multiplier; The last one shows up in my cart application in right place. The first doesnt show at all, but I can get it to echo on screen. Any ideas My app is behind a firewall or else I'd do a demo... Thanks for any suggestions Mignon -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing commands via ssh
Hello all, I am trying to execute a command on another server from my web application. I need to execute the command via ssh for security reasons. I have a private key/passphrase installed for ssh so that I can run ssh without a password. The command: ssh -i vertex [EMAIL PROTECTED] TX 77041 COD 1.00 Works from my box's command line. The vertex 'key' for ssh is also in the same directory. But when I run system(ssh -i vertex [EMAIL PROTECTED] TX 77041 COD 1.00) from my script I get an error: Host key verification failed. Also, when including the return status var I get different values such as: 255 or 127 or 1But I do not know what these mean. This may not be a php issue but a webserver issue - sorry but I have no ideas at this point. Do I need to look in to some other functions to facilitate this? I did try passthru() and exec() with similar results. Any help is as always greatly appreciated. Thx Mignon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing commands via ssh
Thank you - I did change the ownership and group to webserver owner (apache)for both the key file and the directory it's in and the script itself. But unfortunately still the same error. I moved the vertex (key file) to key directory under my scripts directory and am pointing to it from the script. All 3 are apache apache. :( Do you know what status code 255 means when I run $b = ssh -i key/vertex [EMAIL PROTECTED] TX 77041 COD 1.00; system($b, $g); echo $g; Thank you for the invaluable usr/bin/id script. I had seen that path mentioned in posts... On Wed, 2003-07-09 at 15:49, Jeff Harris wrote: On Jul 9, 2003, Mignon Hunter claimed that: |Hello all, | |I am trying to execute a command on another server from my web |application. | |I need to execute the command via ssh for security reasons. I have a |private key/passphrase installed for ssh so that I can run ssh without a |password. | |The command: | |ssh -i vertex [EMAIL PROTECTED] TX 77041 COD 1.00 | |Works from my box's command line. The vertex 'key' for ssh is also in |the same directory. | |But when I run |system(ssh -i vertex [EMAIL PROTECTED] TX 77041 COD 1.00) |from my script I get an error: | |Host key verification failed. | [snip] |Any help is as always greatly appreciated. | |Thx |Mignon Do you have the private key/passphrase installed as a regular user or the httpd user of the local machine on the remote machine? PHP will run the scripts as the httpd user, not as the user who owns the script. ?php $line = exec(/usr/bin/id); print (PHP runs as $line\n/pre\n); ? Jeff -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec(), passthru()
hello all, I am trying to use either of the functions above to execute a compiled c program on linux. The command line works with ./a.out (a.out being the filename). Both my test.php and the exe are in the same directory. I've tried combinations of all the following. Thx Mignon ? error_reporting (E_ALL); error_reporting (E_ERROR | E_WARNING | E_PARSE); echo Here it comes:; $var1 = exec(a.out); echo $var1;//produces:Here it comes: //tried a.out'a.out'./a.out'./a.out' //./a.out *** $var = passthru(a.out, $ret); echo $var;//produces:(nothing) echo $ret;//produces: 127 ** $var2 = system(a.out); echo $var2; //produces:(nothing) ** $var6 = ./a.out; $var7 = exec($var6, $var_array[], $ret_var); echo $var7;//produces:(nothing) echo $var_array[];//produces:Array echo $ret_var;//produces:127 echo $var6;//produces:(nothing) *** $var3 = exec('./a.out', $var_array[], $ret_var); echo $var3;//produces:Here it comes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec() and passthru()
Jason, I'm only subscribed to digest and found your reply in archives and couldnt figure out how to reply :{ Anyway, right now I'm just trying to get something to work. The c exe is as follows: ** #include stdio.h #define NAME Mignon int main(void) { int q; q = 5; printf(Hello, %s,%d \n, NAME,q); return 0; } * I'm trying to return the Hello, Mignon, 5 which is what's outputted on the command line. After I get this to work, I'll be needing it to execute a complex function in c, and bring variables back to my php shopping cart. Here's my test.php: ? error_reporting (E_ALL); error_reporting (E_ERROR | E_WARNING | E_PARSE); echo Here it comes:; /*$var1 = exec(a.out); echo $var1;//produces:Here it comes: //tried a.out'a.out'./a.out'./a.out' //./a.out */ //*** /*$var = passthru(a.out, $ret); echo $var;//produces:(nothing) echo $ret;//produces: 127 */ //** /*$var2 = system(a.out); echo $var2; //produces:(nothing) */ //** /*$var6 = ./a.out; $var7 = exec($var6, $var_array[], $ret_var); echo $var7;//produces:(nothing) echo $var_array[];//produces:Array echo $ret_var;//produces:127 echo $var6;//produces:(nothing) */ //*** /*$var3 = exec(`/var/www/htdocs/vertex_test/a.out`, $var_array[], $ret_var); echo $var3;//produces:Here it comes echo $ret_var; echo $var_array[0]; */ // passthru(/var/www/htdocs/vertex_test/a.out, $res); echo $res; ? -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error handling
On my dev server the php.ini is set to log all errors and notices. Isnt there a way to over ride this on a per script basis to output to stdout (or my browser) ? Thx -- Mignon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: error handling
I looked in the manual (twice now). I want to keep logging to the log file but print to browser on this one script. I have in my script: error_reporting (E_ALL); error_reporting (E_ERROR | E_WARNING | E_PARSE); but they're still only being logged to file. I dont have access to php.ini. Yes, manual Error Handling and Logging Functions On Friday 20 June 2003 02:11, Mignon Hunter wrote: On my dev server the php.ini is set to log all errors and notices. Isnt there a way to over ride this on a per script basis to output to stdout (or my browser) ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exec() and passthru()
Still no out put here's my script test.php: $output = shell_exec(/var/www/htdocs/vertex_test/a.out); echo $output; tried and ''. Both test.php and a.out are in same directory and both have 777 perms. also tried $output = shell_exec(./a.out); * In that case what you want is shell_exec(): $output = shell_exec('/path/to/a.out'); // note the whole command line has // to be enclosed in '' or . echo $output; On Thu, 2003-06-19 at 12:56, Mignon Hunter wrote: Jason, I'm only subscribed to digest and found your reply in archives and couldnt figure out how to reply :{ Anyway, right now I'm just trying to get something to work. The c exe is as follows: ** #include stdio.h #define NAME Mignon int main(void) { int q; q = 5; printf(Hello, %s,%d \n, NAME,q); return 0; } * I'm trying to return the Hello, Mignon, 5 which is what's outputted on the command line. After I get this to work, I'll be needing it to execute a complex function in c, and bring variables back to my php shopping cart. Here's my test.php: ? error_reporting (E_ALL); error_reporting (E_ERROR | E_WARNING | E_PARSE); echo Here it comes:; /*$var1 = exec(a.out); echo $var1;//produces:Here it comes: //tried a.out'a.out'./a.out'./a.out' //./a.out */ //*** /*$var = passthru(a.out, $ret); echo $var;//produces:(nothing) echo $ret;//produces: 127 */ //** /*$var2 = system(a.out); echo $var2; //produces:(nothing) */ //** /*$var6 = ./a.out; $var7 = exec($var6, $var_array[], $ret_var); echo $var7;//produces:(nothing) echo $var_array[];//produces:Array echo $ret_var;//produces:127 echo $var6;//produces:(nothing) */ //*** /*$var3 = exec(`/var/www/htdocs/vertex_test/a.out`, $var_array[], $ret_var); echo $var3;//produces:Here it comes echo $ret_var; echo $var_array[0]; */ // passthru(/var/www/htdocs/vertex_test/a.out, $res); echo $res; ? -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exec() and passthru()
Thanks everybody system() worked in this case, but safe mode off, had to switch machines but at least i got something. The below produced my output: system('/var/www/html/vertex/a.out'); - not is more easy use system ? $output = system('/path/to/a.out'); -- -- Alberto Ferrer [EMAIL PROTECTED] http://www.barrahome.org On Thu, 2003-06-19 at 13:55, Mignon Hunter wrote: Still no out put here's my script test.php: $output = shell_exec(/var/www/htdocs/vertex_test/a.out); echo $output; tried and ''. Both test.php and a.out are in same directory and both have 777 perms. also tried $output = shell_exec(./a.out); * In that case what you want is shell_exec(): $output = shell_exec('/path/to/a.out'); // note the whole command line has // to be enclosed in '' or . echo $output; On Thu, 2003-06-19 at 12:56, Mignon Hunter wrote: Jason, I'm only subscribed to digest and found your reply in archives and couldnt figure out how to reply :{ Anyway, right now I'm just trying to get something to work. The c exe is as follows: ** #include stdio.h #define NAME Mignon int main(void) { int q; q = 5; printf(Hello, %s,%d \n, NAME,q); return 0; } * I'm trying to return the Hello, Mignon, 5 which is what's outputted on the command line. After I get this to work, I'll be needing it to execute a complex function in c, and bring variables back to my php shopping cart. Here's my test.php: ? error_reporting (E_ALL); error_reporting (E_ERROR | E_WARNING | E_PARSE); echo Here it comes:; /*$var1 = exec(a.out); echo $var1;//produces:Here it comes: //tried a.out'a.out'./a.out'./a.out' //./a.out */ //*** /*$var = passthru(a.out, $ret); echo $var;//produces:(nothing) echo $ret;//produces: 127 */ //** /*$var2 = system(a.out); echo $var2; //produces:(nothing) */ //** /*$var6 = ./a.out; $var7 = exec($var6, $var_array[], $ret_var); echo $var7;//produces:(nothing) echo $var_array[];//produces:Array echo $ret_var;//produces:127 echo $var6;//produces:(nothing) */ //*** /*$var3 = exec(`/var/www/htdocs/vertex_test/a.out`, $var_array[], $ret_var); echo $var3;//produces:Here it comes echo $ret_var; echo $var_array[0]; */ // passthru(/var/www/htdocs/vertex_test/a.out, $res); echo $res; ? -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling c function from php
hello, I thought I posted this yesterday but accidentally posted to php-db. Anyway, can any make a suggestion on how to connect to a c function from a php app? I have to connect to a sales tax calculation software. The function is being written for me but I have to figure how to call it - get the variable - and use it again in my php app. I've been told there's an api or module on the php site with documentation that I am trying to research. Has anybody ever done this ? Thx -- M Hunter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php