php-general Digest 16 Jun 2005 10:30:35 -0000 Issue 3515

Topics (messages 217033 through 217059):

Re: Anyone ever upgraded PHP at GoDaddy?
        217033 by: Greg Donald
        217034 by: Brian Dunning
        217037 by: Laurent Duchesne
        217038 by: Greg Donald

Re: Apache fails to start (oracle path problem?)
        217035 by: Shane Presley

COM integration problems
        217036 by: Jonathan Kart

Re: Converting [and] to XML format- help/advise requested
        217039 by: Dotan Cohen
        217040 by: Dotan Cohen
        217056 by: Sebastian Mendel

ftruncate() and stream wrappers
        217041 by: Justin Hannus

passthru() passing variables
        217042 by: Chris Herold
        217048 by: Richard Lynch

Re: incrementing a register global
        217043 by: Richard Lynch
        217057 by: Sebastian Mendel

Re: Sessions
        217044 by: Richard Lynch

How to print variable name and contents
        217045 by: nntp.charter.net
        217046 by: Richard Davey

Re: Retrievable weather service info?
        217047 by: xfedex

Re: php/osx and firebird
        217049 by: Richard Lynch

Re: Compiling problem (apxs)
        217050 by: Richard Lynch

OT Major Release Versions
        217051 by: Richard Lynch

Re: unable to load php_gd2.dll
        217052 by: Nadim Attari

Re: Image upload form
        217053 by: Nadim Attari

Re: htmlArea - a 'client editor'
        217054 by: Kim Madsen
        217058 by: Kim Madsen

Re: autocomplete a field
        217055 by: Kim Madsen

Freing memory resources?
        217059 by: Gustav Wiberg

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 6/15/05, Brian Dunning <[EMAIL PROTECTED]> wrote:
> GoDaddy's "Virtual Dedicated Servers" come with PHP 4.2 - anyone ever
> upgraded this to 4.3 or later? I've never done any command line stuff
> or anything like that - is there an easier way?

Make yourself a phpinfo() page.  Your PHP configuration will be at the
top of the page.  You can use that configure line to build/upgrade to
a newer PHP.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Jun 15, 2005, at 2:28 PM, Greg Donald wrote:

Make yourself a phpinfo() page.  Your PHP configuration will be at the
top of the page.  You can use that configure line to build/upgrade to
a newer PHP.

I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line?
--- End Message ---
--- Begin Message ---
Hi,

you need to get the appropriate php tarball from
http://www.php.net/downloads.php and check out this page:

http://www.geocities.com/tipsforlinux/articles/27.html

It will tell you how to:

 - extract the sources
 - run configure (this is where you use the configure line from phpinfo)
 - install compiled binaries

Laurent


2005/6/15, Brian Dunning <[EMAIL PROTECTED]>:
> On Jun 15, 2005, at 2:28 PM, Greg Donald wrote:
> 
> > Make yourself a phpinfo() page.  Your PHP configuration will be at the
> > top of the page.  You can use that configure line to build/upgrade to
> > a newer PHP.
> 
> I see that, thanks - but if you'll forgive an ignorant question, what
> do I do with that configure line?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
On 6/15/05, Brian Dunning <[EMAIL PROTECTED]> wrote:
> On Jun 15, 2005, at 2:28 PM, Greg Donald wrote:
> 
> > Make yourself a phpinfo() page.  Your PHP configuration will be at the
> > top of the page.  You can use that configure line to build/upgrade to
> > a newer PHP.
> 
> I see that, thanks - but if you'll forgive an ignorant question, what
> do I do with that configure line?

You use it to configure your PHP for compilation.

See http://www.php.net/manual/en/install.php


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--- End Message ---
--- Begin Message ---
Thank you! That fixed it.  I just had to define the Oracle env
variables on the httpd startup script.

So that was a huge help :)

Shane

On 6/15/05, Kristen G. Thorson <[EMAIL PROTECTED]> wrote:
> I ran into a similar problem trying to get ODBC working with a Progress
> database.  I managed to solve it by setting the environment variables in
> the httpd startup script.
> 
> Not much help, I know, but a suggestion. ;)
> 
> good luck
> kgt
> 
> 
> 
> 
> Shane Presley wrote:
> 
> >Hello,
> >
> >I'm having trouble compiling and running PHP with oracle support.
> >
> >I was able to compile with the appropriate configure script, but only
> >after I set my Oracle environment variables in my shell.  That was no
> >problem.
> >
> >The problem is, when Apache goes to load the php module, it fails,
> >because it can't find the oracle library.  Interactively I had to do
> >this...
> >
> >export LD_LIBRARY_PATH=$ORACLE_HOME/lib
> >
> >But Apache..
> >Starting httpd: Syntax error on line 207 of /etc/httpd/conf/httpd.conf:
> >Cannot load /usr/lib/httpd/modules/libphp4.so into server:
> >libclntsh.so.10.1: cannot open shared object file: No such file or
> >directory
> >[FAILED]
> >
> >
> >Not sure how I could set that for Apache?
> >
> >Shane
> >
> >
> >
> 
> 
>

--- End Message ---
--- Begin Message ---
Hi all,

I'm trying to interface with verisign's payflow pro on windows using
the COM workaround.

This code was originally taken from an example listed with the manual
as a workaound for the fact that the php pfpro functions are not
supported on windows.  It worked for some time until the server was
upgraded to windows 2003 server. Now, all calls to instantiate a COM
object return the boolean value 'true'

               $pfpro_client = new COM('PFProCOMControl.PFProCOMControl.1');

// this line outputs 'true'
               echo $pfpro_client;
               //Connect to Verisign via COM object...
// this line gives a "call to a member function on a non object" error
               $pfpro_context =
$pfpro_client->CreateContext($this->getURL(), 443,
24,"",0,"","");

I've tried other COM objects like "new
COM(InternetExplorer.Application)" and it also returns 'true'.  Other
tests of the pfpro install are sucessful (asp, pfpro.exe), so i
believe the payflow config is correct.  It just seems like the php com
integration is screwed up.

Any ideas?
thanks,
jon

--- End Message ---
--- Begin Message ---
On 6/15/05, Tom Rogers <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> Wednesday, June 15, 2005, 4:42:24 AM, you wrote:
> DC> On 6/14/05, Sebastian Mendel <[EMAIL PROTECTED]> wrote:
> >> Dotan Cohen wrote:
> >> > Hi gurus. I'm having fun replacing the text within [ and ] to XML
> >> > format on 4000+ files on a windows XP machine. I installed php (and an
> >> > apache server) on the machine because it is the only language the I am
> >> > remotely familiar with.
> >> >
> >> > I want and text that is with [ and ] to be enclosed with <note> and
> >> > </note>. Going through the archives I found this nice regex (I changed
> >> > it a bit- I hope that I didn't break anything important) that fits
> >> > into str_replace:
> >> >
> >> > str_replace("/[([a-zA-Z]+?)]/", "<note>".$what
> >> > was_inside_the_parethesis."</note>", $string);
> >>
> >> str_replace doesnt support regular expressions
> >>
> >> http://www.php.net/str_replace
> >>
> >> what you need is preg_replace()
> >>
> >> http://www.php.net/preg_replace
> >>
> >> > But how on sweet mother Earth do I get the $what
> >> > was_inside_the_parethesis variable to stick into the note tags? I
> >> > tried functions that would remove the [ and ], then do
> >> > $new_str="<note>".$what was_inside_the_parethesis."</note>";
> >> > and then replace the whole [$what was_inside_the_parethesis] with
> >> > $new_str. I did get that far.
> >>
> >> preg_replace( '/\[([^\]]+)\]/', '<note>\1</note>', $string);
> >>
> >> > Now the catch! If $what_was_inside_the_parethesis contains the word
> >> > 'algebra' then I want nothing returned- in other words [$what
> >> > was_inside_the_parethesis] should be cut out and nothing put in it's
> >> > place. I added an if function in there that checked the presence of
> >> > the word algebra, but it ALWAYS returned blank.
> >>
> >> preg_replace( '/\[(algebra|([^\]]+))\]/', '<note>\2</note>', $string);
> >>
> >> just to mention, you need only the second example, the first ist just to
> >> explain the step toward the final ocde.
> >>
> >> Sebastian Mendel
> >>
> >> www.sebastianmendel.de
> >> www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet
> >>
> 
> DC> Thank you very much Sebatian! I can't believe that you got that out of
> DC> one line of code! I often feel that i have a lot to learn, but now I
> DC> see that I also have a lot to improve...
> 
> DC> The code works great for [] tags that do not contain the word algebra.
> DC> If the word algebra is alone between the tags then it returns
> DC> <note></note>, which I can easily remove with one more line of code.
> DC> But if the word algebra appears with another word, then it is
> DC> converted to a note just as if it did not contain the word.
> 
> DC> I tried adding asterisks and plus-signs at stratigec places within the
> DC> regex, but I am not succeeding in getting them to do what I want. I
> DC> suppose that I would be overstaying my welcome if I asked just where
> DC> to put them?
> 
> DC> Dotan
> DC> http://lyricslist.com/lyrics/artist_albums/402/pink_floyd.php
> DC> Pink Floyd Lyrics
> 
> DC> --
> DC> PHP General Mailing List (http://www.php.net/)
> DC> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> You can use preg_replace_callback to give you a bit more control, so
> using Sebastions first expression you could do
> 
> function check_string($matches){
>   if(preg_match('/algebra/i',$matches[0])) return '';
>   return '<note>'.$matches[0].'</note>';
> }
> 
> preg_replaec_callback('/\[([^\]]+)\]/','check_string',$string);
> 
> --
> regards,
> Tom
> 

Thanks, I did not know about the preg_replace_callback function. I'll
start playing with that now. Something new every day!

Dotan
http://lyricslist.com/lyrics/artist_albums/108/carey_mariah.php
Mariah Carey Lyrics

--- End Message ---
--- Begin Message ---
On 6/15/05, Sebastian Mendel <[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
> 
> >>> Hi gurus. I'm having fun replacing the text within [ and ] to XML
> >>> format on 4000+ files on a windows XP machine. I installed php (and an
> >>> apache server) on the machine because it is the only language the I am
> >>> remotely familiar with.
> >>>
> >>> I want and text that is with [ and ] to be enclosed with <note> and
> >>> </note>. Going through the archives I found this nice regex (I changed
> >>> it a bit- I hope that I didn't break anything important) that fits
> >>> into str_replace:
> >>>
> >>> str_replace("/[([a-zA-Z]+?)]/", "<note>".$what
> >>> was_inside_the_parethesis."</note>", $string);
> >> str_replace doesnt support regular expressions
> >>
> >> http://www.php.net/str_replace
> >>
> >> what you need is preg_replace()
> >>
> >> http://www.php.net/preg_replace
> >>
> >>
> >>> But how on sweet mother Earth do I get the $what
> >>> was_inside_the_parethesis variable to stick into the note tags? I
> >>> tried functions that would remove the [ and ], then do
> >>> $new_str="<note>".$what was_inside_the_parethesis."</note>";
> >>> and then replace the whole [$what was_inside_the_parethesis] with
> >>> $new_str. I did get that far.
> >> preg_replace( '/\[([^\]]+)\]/', '<note>\1</note>', $string);
> >>
> >>
> >>> Now the catch! If $what_was_inside_the_parethesis contains the word
> >>> 'algebra' then I want nothing returned- in other words [$what
> >>> was_inside_the_parethesis] should be cut out and nothing put in it's
> >>> place. I added an if function in there that checked the presence of
> >>> the word algebra, but it ALWAYS returned blank.
> >>
> >> preg_replace( '/\[(algebra|([^\]]+))\]/', '<note>\2</note>', $string);
> >>
> >>
> >> just to mention, you need only the second example, the first ist just to
> >> explain the step toward the final ocde.
> >
> > The code works great for [] tags that do not contain the word algebra.
> > If the word algebra is alone between the tags then it returns
> > <note></note>, which I can easily remove with one more line of code.
> > But if the word algebra appears with another word, then it is
> > converted to a note just as if it did not contain the word.
> 
> 
> $search = array(
>     '/\[[^\]*algebra[^\]*\]/',
>     '/\[([^\]]+)\]/',
> );
> 
> $replace = array(
>     '',
>     '<note>\1</note>',
> );
> 
> preg_replace( $search, $replace, $string);
> 
> 
> --
> Sebastian Mendel
> 
> www.sebastianmendel.de
> www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet
> 

Thank you Sebastian. Know that I not only appreciate your assistance,
but that I also make a genuine effort to learn from your example. I
think that it's about time that I learned to brew regexes. On my to
google now...

Dotan
http://lyricslist.com/lyrics/artist_albums/321/madonna.php
Madonna Lyrics

--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
> On 6/15/05, Sebastian Mendel <[EMAIL PROTECTED]> wrote:
>> Dotan Cohen wrote:
>>
>>>>> Hi gurus. I'm having fun replacing the text within [ and ] to XML
>>>>> format on 4000+ files on a windows XP machine. I installed php (and an
>>>>> apache server) on the machine because it is the only language the I am
>>>>> remotely familiar with.
>>>>>
>>>>> I want and text that is with [ and ] to be enclosed with <note> and
>>>>> </note>. Going through the archives I found this nice regex (I changed
>>>>> it a bit- I hope that I didn't break anything important) that fits
>>>>> into str_replace:
>>>>>
>>>>> str_replace("/[([a-zA-Z]+?)]/", "<note>".$what
>>>>> was_inside_the_parethesis."</note>", $string);
>>>> str_replace doesnt support regular expressions
>>>>
>>>> http://www.php.net/str_replace
>>>>
>>>> what you need is preg_replace()
>>>>
>>>> http://www.php.net/preg_replace
>>>>
>>>>
>>>>> But how on sweet mother Earth do I get the $what
>>>>> was_inside_the_parethesis variable to stick into the note tags? I
>>>>> tried functions that would remove the [ and ], then do
>>>>> $new_str="<note>".$what was_inside_the_parethesis."</note>";
>>>>> and then replace the whole [$what was_inside_the_parethesis] with
>>>>> $new_str. I did get that far.
>>>> preg_replace( '/\[([^\]]+)\]/', '<note>\1</note>', $string);
>>>>
>>>>
>>>>> Now the catch! If $what_was_inside_the_parethesis contains the word
>>>>> 'algebra' then I want nothing returned- in other words [$what
>>>>> was_inside_the_parethesis] should be cut out and nothing put in it's
>>>>> place. I added an if function in there that checked the presence of
>>>>> the word algebra, but it ALWAYS returned blank.
>>>> preg_replace( '/\[(algebra|([^\]]+))\]/', '<note>\2</note>', $string);
>>>>
>>>>
>>>> just to mention, you need only the second example, the first ist just to
>>>> explain the step toward the final ocde.
>>> The code works great for [] tags that do not contain the word algebra.
>>> If the word algebra is alone between the tags then it returns
>>> <note></note>, which I can easily remove with one more line of code.
>>> But if the word algebra appears with another word, then it is
>>> converted to a note just as if it did not contain the word.
>>
>> $search = array(
>>     '/\[[^\]*algebra[^\]*\]/',
>>     '/\[([^\]]+)\]/',
>> );
>>
>> $replace = array(
>>     '',
>>     '<note>\1</note>',
>> );
>>
>> preg_replace( $search, $replace, $string);
> 
> Thank you Sebastian. Know that I not only appreciate your assistance,
> but that I also make a genuine effort to learn from your example. I
> think that it's about time that I learned to brew regexes. On my to
> google now...

there are just two things you need to learn regular expressions:

the PHP-manual:

http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

http://www.php.net/manual/en/ref.pcre.php
http://www.php.net/manual/en/ref.regex.php

and the regex coach:

http://www.weitz.de/regex-coach/


-- 
Sebastian Mendel

www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

--- End Message ---
--- Begin Message --- I dont see support for using ftruncate() on user defined stream wrappers. When I try to truncate one I get an E_WARNING:

Warning: ftruncate() [function.ftruncate]: Can't truncate this stream!

Does anyone know of a way to truncate a user defined stream wrapper using php's file system or stream functions?

-justin

--- End Message ---
--- Begin Message ---
Hi,

I have been told that in order to pass variables via passthru() to another script (in my case, a perl script) one can do the following ...

passthru("home/test.cgi $var")

and that $var will then be passed through to the cgi.

I have tried this and failed.

Is this the proper format or is there something that I am missing.

Thanks,
chris

--- End Message ---
--- Begin Message ---
On Wed, June 15, 2005 5:36 pm, Chris Herold said:
> I have been told that in order to pass variables via passthru() to
> another script (in my case, a perl script) one can do the following ...
>
> passthru("home/test.cgi $var")
>
> and that $var will then be passed through to the cgi.
>
> I have tried this and failed.
>
> Is this the proper format or is there something that I am missing.

You may want to use exec first, so you can more easily capture the error
output and error codes.

exec("home/test.cgi $var", $output, $error);
if ($error){
  //You should probably use error_log here in your real code...
  //ASSUME this is going to break some day, for whatever reason.
  //You'll need it logged unless you like dealing with error reports like:
  //"Hey, the website broke yesterday."
  echo "OS Error:  $error<br />\n";
  echo implode("<br />", $output);
  exit;
}
echo $output;

Meanwhile, odds are *REALLY* good that you're not even calling the
test.cgi script because you haven't provide a path that PHP can use.

home/test.cgi would be assuming that home was in the same directory as
your PHP script, and even that is kinda iffy depending on where you do
this from the webserver or CLI...

I would recommend using FULL PATH to *everything* in exec (and passthru)

/full/path/to/home/test.cgi /full/path/to/any/args.txt

Also be sure to use the escapeshellargs function to make your $var data
kosher if it comes from the outside world.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Wed, June 15, 2005 12:43 pm, Aaron Todd said:
> I dont know it this is possible, but here it goes.  Hopefully I cac
> explain
> it well enough for someone to understand.
>
> I am posting data to a php script.  I have several variables that are the
> same except the number at the end is different.  So the url of the called
> script will be something like:
>
> http://www.something.com/test.php?name1=Sam&name2=Bill&name3=Joe
>
> On my script I am using substr() and strrchr() to get the number of last
> variable:
>
> $names = substr(strrchr($_SERVER['QUERY_STRING'],"&"),7,1);
>
> I am then trying to run a loop to call each variable and just print it on
> the screen:
>
> for($i=1;$i<=$boxes;$i++){
>   echo $_GET['name'].$i;
> }
>
> This is where my problem is.  And I dont know if this is even possible,
> but
> if you look at the echo line in the loop I am trying to add the number of
> $i
> to the register global.  I dont get an error in doing this, but when I run
> the script I get the number of $i instead of the value of $_GET['name1']
>
> Like I said, I hope I explained this good enough for someone to know what
> I
> am trying to do.  If anyone has any suggestions or comments about doing
> something like this please let me know.

You could use variable variables, but what you REALLY should do is change
your $foo1 $foo2 $foo3 into an array of $foo[1] $foo[2] $foo[3]

It will be MUCH easier!

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Aaron Todd wrote:

> I am posting data to a php script.  I have several variables that are the 
> same except the number at the end is different.  So the url of the called 
> script will be something like:
> 
> http://www.something.com/test.php?name1=Sam&name2=Bill&name3=Joe
> 
> On my script I am using substr() and strrchr() to get the number of last 
> variable:
> 
> $names = substr(strrchr($_SERVER['QUERY_STRING'],"&"),7,1);
> 
> I am then trying to run a loop to call each variable and just print it on 
> the screen:
> 
> for($i=1;$i<=$boxes;$i++){
>   echo $_GET['name'].$i;
> }

did you tried foreach() with $_GET ( or $_REQUEST ) ?


foreach ( $_GET as $key => $var )
{
    echo $key . ' => ' . $var;
}


but this is not "incrementing a register global" but 'accessing a
superglobale array'


-- 
Sebastian Mendel

www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

--- End Message ---
--- Begin Message ---
On Wed, June 15, 2005 10:38 am, Brian D. McGrew said:

> I call session_start() on all my pages and then <? echo session_id(); ?>
> and everything is the same from all the pages.  However if I stuff a
> variable into $_SESSION it's never transferred between pages.  So if I
> do a <? $_SESSION["Username"] = "Brian"; ?> and then go to another page
> and say <? echo $_SESSION["Username"]; ?> it comes back blank.
>
> It doesn't seem to matter if I enclose the Username in double quotes """
> or single quotes ''' or nothing; I have no data.  But like I said, the
> session id is being passed around just fine.

Check your php.ini settings to be sure the ECGPS settings haven't revoked
$_SESSION getting populated...

It's pretty odd for somebody to do that, but it would fit the symptoms....

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
I want to write a trace procedure and call it with variable names, and I am 
having trouble with the syntax.  My goal is to have a procedure that will 
echo lines such as:

Trace: $myvar="the contents of $myvar

My attempt that didn't work is to write a function:

function my_trace($m){
   echo ("\n<br>TRACE: $m = ");
   eval("\$t=\"$m\";");
   echo($t."<br>\n");
 }

and call it with statements like:

my_trace("\$my_var");
my_trace("\$_ENV[\"COMPUTERNAME\"]");

What am I doing wrong, and how should this be done?  Also, should I post to 
a different group?

Thanks,
Gil Grodsky
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hello,

Wednesday, June 15, 2005, 2:33:48 PM, you wrote:

ncn> I want to write a trace procedure and call it with variable
ncn> names, and I am having trouble with the syntax. My goal is to
ncn> have a procedure that will echo lines such as:

ncn> Trace: $myvar="the contents of $myvar

ncn> My attempt that didn't work is to write a function:

ncn> function my_trace($m){
ncn>    echo ("\n<br>TRACE: $m = ");
ncn>    eval("\$t=\"$m\";");
ncn>    echo($t."<br>\n");
ncn>  }

Here's one way:

function my_trace ($varname, $varvalue)
{
         $varvalue = print_r($varvalue, true);
         echo "TRACE: $varname = \"$varvalue\"<br />";
}

my_trace("\$my_var", $my_var);

Another might be to look at the var_dump and var_export functions.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

--- End Message ---
--- Begin Message ---
http://weather.noaa.gov/pub/data/observations/metar/stations/SABE.TXT

Here you get the METAR report in plaintext format......now is your work to 
decode it.....HAVE FUN !!

I already made something to read thouse text files.......If you want I can 
share it.

cheers!
pancarne.

On 6/15/05, Clive Zagno <[EMAIL PROTECTED]> wrote:
> 
> Hi Murray
> 
> Ive managed to get the local weather in cape town or for any airport
> that has a ITIA code.
> 
> the webservice is provide by:
> http://www.capescience.com/webservices/globalweather/index.shtml
> 
> you will need to get nusoap from sourceforge to make use of the 
> webservice.
> 
> regards
> 
> clive
> 
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
On Wed, June 15, 2005 9:04 am, James said:
> $host = "10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb";
> $username = "SYSDBA";
> $password = "masterkey";
> $dbh = ibase_pconnect ($host, $username, $password);
> $stmt = "SELECT * FROM EVENTTYP";
> $sth = ibase_query ($dbh, $stmt);
>
> Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to
> complete network request to host "10.1.4.58". Failed to locate host
> machine. Undefined service gds_db/tcp. in
> d:\htdocs\Website\PHP\dtest.php on line 17

I don't know diddly-squat about this Firebird ibase stuff, but this sounds
to me like a network error message that your PHP machine can't get to the
Firebird machine.

Start at the lowest level.

Can you "ping 10.1.4.58" from your PHP box?  It might be
configured/firewalled to not let you do "ping" so it's not REQUIRED that
ping work for your PHP script to work, but it's at least a start.

> Warning: ibase_query() [function.ibase-query]: invalid database
> handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on
> line 20

Ignore this for now -- It's a direct result of the first error.

> I was able to use isql to remotely connect using the parameters above.

Wow.  Okay, that's way better than my ping test above...

Still, double check that this still works, just to be SURE.

> What am I not doing on the PHP end to get this to work?

PHP runs as the user defined by "User" directive in httpd.conf

Odds are really good your isql remote test was run by you logged in as,
errr, whatever Windows logs you in as, or whatever you log in as, if
you're on a Windows box that has logins, or... Well, anyway, it almost for
sure is not the same "User" as you have set in httpd.conf

In the ideal world, you'd know how to log into your Windows box as the PHP
User -- If you *DO* log in to your Windows box, then do this.

If not, JUST FOR TESTING, you could change the User setting in httpd.conf
to be, like, "Administrator" or whatever the Windoze root user is called
this week.

Restart Apache, and test.

If that works, you have narrowed it down to a permissions problem.  God
only knows how you fix that under Windows, but it's the most likely source
of your problem.

The thing you *DO* *NOT* want to do, no matter what, is leave Apache
running as Administrator!  Change it back immediately after your test.

If you have to choose between running PHP as Admin, and getting fired
because you can't make this work, start looking for a new job.  It's that
important.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Wed, June 15, 2005 6:39 am, Shane Presley said:
> I have a RedHat system running Apache and PHP Version 4.3.2.  These
> were pre-installed Red Hat packages.  Things worked nicely.

What you are missing is the RPM "apache-devel" or "httpd-devel" or
"somethinghereaboutapache-devel"

The "*-devel" RPMs essentially contain all the source code you WOULD have
if you had compiled from source, so PHP can find it.

If that doesn't work (and I can't guarantee it will) then you may want to
goahead and compile Apache from source, because that's easier than futzing
with the source RPMs to custom configure them, imho.

There also *MIGHT* be a "php-oracle" RPM out there...

It may not be on RedHat's server, and you should definitely do some due
diligence before installing RPMs from randomly-selected (Googled)
web-sites, but it might be easier to stay up-to-date in your current
process than remembering to check PHP versions, downoad, install etc.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
This is Computer Software philosophical musing, not specifically related
to just PHP, but applicable to PHP and, well, all other OpenSource
software...

As I sit here surrounded by machines (physically and virtually) and
realizing that while I've got most of them on "auto-update" as much as I
can, or I've foisted off the updating on somebody else (for $$$) because I
just don't *WANT* to be a SysAdmin...

I'm still left with a lot of hours I'd have to invest to really be as
"current" as I'd like to be.

Let's take RedHat and other OSes, for example, only because I don't want
this to devolve into the "what version of PHP should I use" thread that
would be a hot button here.  [Not that RedHat and or its versions aren't
almost as hot, but...]

I've got RedHat 8, RedHat 9, FC2, and FC3 on different machines here and
at client's sites.

Oh, and Win XP Home, just for fun, for testing stupid IE bugs.

I'd love to just move them all to FC3 (4 now?) but it would really be
painful, and a lot more hours than I have available.

Now, the thing is, it's finally gotten to the point where I'm willing to
let the OS authors/maintainers (RedHat) update my box for me, because,
with the current arms race in viruses and whatnot, that's got to be better
than my inability to stay on top of things, even if occasionally it breaks
something that actually worked before.

My philosophical question is:

Why can't the damn things just have an easy one-click button to go from
major version to major version, or if I'm willing to turn over control of
the OS versioning to RedHat (or whomever) just do it automatically?

Okay, I can accept that for Microsoft and other proprietary software,
that's a non-option, because they WANT to force you to BUY the new
version, though with their new subscription model...  Well, let's not get
into THAT argument either.  Forget the Windows box.

In the past, I've been told that the various pieces of software version
control and tracking means that you need the "clean break" of a major
release to keep sanity in versions.

I think that was true then, but is it really true now?

I mean, with all these fancy RPM/apt-get/cvs/svn thingies floating around,
and all the version control already inherent to those processes, and the
sheer amount of data being tracked by that...

Would it really break the bank to just have the OS go from major release
to major release without my spending days of my time shlepping data around
and dinking around with re-boots and CDRs and hard drives and whatnot?

I know a lot of you guys actually ENJOY that kind of stuff, and playing
with the new distro is your idea of a Good Time.

But is that what Joe Sixpack and Betsy Buick really want?

Are we really presenting the average user with the BEST software when they
can only use it a year or two before they have to spend a day fraught with
stress and wondering if their hardware and data will survive, just so they
can be something like remotely "current"?

How does that bode for our long-term prospects in today's arms race with
viruses and trojans and other Bad Guys?

We *KNOW* too many average users simply aren't going to upgrade, because
of that pain.

We *KNOW* that telling them they need to be current doesn't cut it.

Hell, even *WE* can't stay current on every box.  I know I'm not alone here.

Why don't we actually solve this one, for those who are willing to let the
OS upgrade itself, with the technological "leap" of just keeping it
CURRENT even if it's from 4.4.13 to 5.0?

Am I just being crotchety here, or what? :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Try

extension_dir = "./extensions"

Nadim Attari
Alienworkers.com

> Okay I at loss.  I have tried but i can seem to get the
> php_gd2.dll to work properly.  Any help this is what i have
> done so far.
>
> I have in my php.ini file,
>
> ; Directory in which the loadable extensions (modules)
> reside.
> extension_dir = "C:\PHP\extensions"
>
> I have also uncommented the
>
> extension = php_gd2.dll
>
> I have in the c:\php\extension folder the php_gd2.dll
>
> I have restarted IIS but still nothing
>
> I am using Window XP $ 2000 with IIS 5.0 but still nothing
>
> Please help
> Disieyi

--- End Message ---
--- Begin Message ---
http://www.php-help.net/sources-php/image.upload.function.353.html

Regards,
Nadim Attari
Alienworkers.com


> Hi, After a disastrous first attempt (which uploaded images but only by
> chance) it was suggested I rework the entire thing. This one seems to
> check the file against getimagesize and if that doesn't prove false,
> check the type and make the extension then rename the file. But the
> moving part is not working, and it does not kick back any error, it just
> fails.
>
> Can anyone tell me what I am doing wrong, and also if this is sufficient
> to a) upload images safely and b) protect against tampering?
>
> Thanks in advance,
> JJ
>
>
> <?php
>
> error_reporting(E_ALL);
>
>        $uploaddir = "images/jpg/test/";
>
> //      print_r($_FILES);
>
>        $local_file = $_FILES['userfile']['tmp_name'];
>
> if (sizeof($local_file))
>    {
>
> //try to get image size; this returns false if this is not an actual
> image file.
>        $image_test = getimagesize($local_file);
>
> if ($image_test !== false) {
>    $mime_type = $_FILES['userfile']['type'];
>    switch($mime_type) {
>        case "image/jpeg":
>    $pext = 'jpg';
>    break;
>        case "image/tiff":
>    $pext = 'tif';
>    break;
>        default:
>    echo "The file you are trying to upload is an image, but it is not
> a tif or jpeg and therefore unacceptable.";
>    }
> } else {
>     echo "The file you are trying to upload is not a valid image file";
> }
>
>   $main_image = md5(date("l-F-j-Y i:s")).'.'.$pext;
>
>
>    move_uploaded_file($main_image,$uploaddir);
>
>    }
>
>    ?>
>
>    <form enctype="multipart/form-data" action="<?php echo
> $_SERVER['PHP_SELF']; ?>" method="POST">
>      <input type="hidden" name="MAX_FILE_SIZE" value="300000" />
>      <!-- Name of input element determines name in $_FILES array -->
>      Cartoon: <input name="userfile" type="file" />
>      <input type="submit" value="Upload File" />
> </form>

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: M Saleh EG [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 04, 2005 2:57 PM
> To: Rory Browne
> Cc: [EMAIL PROTECTED]; php-general@lists.php.net
> Subject: Re: [PHP] htmlArea - a 'client editor'
> 
> www.FCKEditor.net <http://www.FCKEditor.net>
> FCKEditor is the best i've ever seen.
> Check it out.

Yeah, looks cool, but I´m having a *lot* of trouble getting the listing of 
current images and upload functionality to work. How and where do You set this 
up? The documentation is very simple and yet confusing.

The filemanager image browser shows that I´m looking in "/", can´t seem to find 
a setting for this anywhere

The upload doesn´t return an error, the JS "upload in progress" just hangs...

/Kim

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Kim Madsen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 16, 2005 9:14 AM
> To: php-general@lists.php.net
> Subject: RE: [PHP] htmlArea - a 'client editor'


> Yeah, looks cool, but I´m having a *lot* of trouble getting the listing of
> current images and upload functionality to work. How and where do You set
> this up? The documentation is very simple and yet confusing.

I should have mentioned that I´ve looked at the config file in  
/FCKeditor/editor/filemanager/browser/default/connectors/php/config.php :-)
 
/Kim

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: xfedex [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 04, 2005 4:57 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] autocomplete a field
> 
> Hi,
> 
> Anyone know if theres a way to disable this feature for user using old
> browsers or not suporting JS/XML?

It seems there was no replies to this post?

Try autocomplete=off in the input tag:

<input type="text" name="whatever" autocomplete="off">

/Kim

--- End Message ---
--- Begin Message ---
Hi there!

I have a script that runs about 10 minutes... Localy on my computer (Windows XP 2.6Ghz, Apache) the computer hangs a little now and then when the script is running. Is there any good way of releasing more memory while the script is running? The script could take 20 minutes, it's not a big matter how long the script takes. (As long as the server can do other things at the same time)

(In production environment, the php-script is on Apache and Linux (if it matters))

Best regards
Gustav Wiberg
@varupiraten.se

Here is my script:
<?php
//This script was updated 2005-06-16
//by Gustav Wiberg / [EMAIL PROTECTED]
//Please visit www.varupiraten.se
//
require("phpfunctions/dbsafety.php");

//Parameters that sets the rules for importing
//
static $fileName = "import/GNTprisfil.txt";
static $logFileName = "logfiles/gnt.txt";
static $limitSteps = 25;
static $saldoColumn = 6;
static $artNrColumn = 2;
static $priceColumn = 5;
static $row = 1;
static $updateActions = 0;
static $deleteActions = 0;
static $checkLev = "gn-";

//Function for creating a logfile
//and writing to screen
//
function writeNow($str, $logFileName) {

//Create a handle for writing (appending)
//
$logHandle = fopen($logFileName,"a");

 fwrite($logHandle, "$str\r\n");
 echo $str . "<br>";

//Close file for writing to logfile
//
fclose($logHandle);

}
//Set limitstart for first time
//
if (!isset($limitStart)) {$limitStart = 0;}

if (isset($_REQUEST["updateActions"])) {$updateActions = $_REQUEST["updateActions"];} if (isset($_REQUEST["deleteActions"])) {$deleteActions = $_REQUEST["deleteActions"];}
if (isset($_REQUEST["startTime"])) {$startTime = $_REQUEST["startTime"];}

if ($_REQUEST["limitstart"]) {
 $limitStart = $_REQUEST["limitstart"];
}


require ("phpfunctions/opendb.php");


$sql = "SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'";
   $querys = mysql_query($sql);

   //Count products in db
   //
   if ($limitStart == 0) {

     $dbArray = mysql_fetch_array($querys);
     $nrOfProducts = $dbArray["cn"];
     echo "Antal produkter: $nrOfProducts";

   //Create logfile or delete all content from current logfile
   //
   $logHandle = fopen($logFileName,"wb");
   fclose($logHandle);


     //Get starttime of script
     //
     $startTime = time();
   }

   else {

     $nrOfProducts = $_REQUEST["nrofproducts"];

  }

  if ($limitStart > $nrOfProducts) {
    $nrSeconds = time() - $startTime;
    $nrMinutes = $nrSeconds / 60;
    ?>
<b>Klar</b> med uppdatering av saldo och ev. borttagningar för <b>GNT</b>.<br><br> <b>Tid för uppdatering:</b> <?php echo $nrSeconds;?> sekunder eller <?php echo $nrMinutes;?> minuter<br><br>
    <b>Antal uppdateringar:</b> <?php echo $updateActions;?><br>
<b>Antal produkter som ej visas efter uppdatering: </b> <?php echo $deleteActions;?><br> <a href="captech_checksaldo_step2.php?deleteActions=0&updateActions=0">Kolla captech produkter</a>
    <?php
    exit;
  }

   //Check if the filename exists first!
   //If not, then exit script

   if (!file_exists($fileName)) {

       echo "Filen $fileName finns inte!<br>Avslutar scriptet nu!";
       exit;

   }




   //Go through database with products from GNT
   //
$sql = "SELECT tbvara.IDVara, tbvara.Saldo, tbvara.startPris, tbvara.Varunamn, tbvara.synligVara, tbvara.lastPris, tbunderkategori.marginalProcent, tbunderkategori.Underkategori FROM tbvara"; $sql .= " LEFT JOIN tbunderkategorivara ON (tbvara.IDVara = tbunderkategorivara.ForIDVara)"; $sql .= " LEFT JOIN tbunderkategori ON (tbunderkategori.IDUnderKategori = tbunderkategorivara.ForIDUnderKategori)"; $sql .= " WHERE Varunamn LIKE '$checkLev%' AND tbunderkategori.marginalProcent>-1 AND tbunderkategori.Underkategori<>'Ej tilldelade' ORDER BY IDVara LIMIT $limitStart,$limitSteps";
   //echo $sql;
   //exit;
   $querys = mysql_query($sql);

   while ($toarray = mysql_fetch_array($querys)) {

       //Get current row from db
       //
       $idproduct = $toarray["IDVara"];
       $dbSaldo = $toarray["Saldo"];
       $dbArtNr = $toarray["Varunamn"];
       $dbPris = $toarray["startPris"];
       $dbSynligVara = $toarray["synligVara"];
       $dbLastPris = $toarray["lastPris"];
       $dbMarginalProcent = $toarray["marginalProcent"];
       $dbUnderKategori = $toarray["Underkategori"];

       //Taken from table tbunderkategori
       //
       $marginalProcent = intval($dbMarginalProcent);

//Delete $checkLev from string $dbArtNr for the sake of comparing
           //(take away the three first characters)
           //
           $dbArtNr = substr($dbArtNr, 3);


           //Go through whole textfile and compare with current row in db
           //
           $handle = fopen($fileName, "r");



           $foundProduct= false;
           ob_start();

           while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {

              $textSaldo = $data[$saldoColumn];
              $textArtNr = $data[$artNrColumn];
              $textPris = $data[$priceColumn];


//Default marginal is 15 when marginal isn't set for undercategory
               //
               if (intval($marginalProcent) == 0) {

                 $marginalProcent = 15;

               }

//echo "Marginal för underkategori $dbUnderKategori är $marginalProcent%<br>";

               //Set price based on price from textfile + marginal set
               //for undercategory
               //
$newPrice = $textPris + (($textPris * ($marginalProcent/100)));
               $newPrice = round($newPrice,0);


              if (isset($textArtNr) AND isset($textSaldo) AND $row>1) {


//If there is an occurence of article-nr for product in textfile
                   //that matches the one in current row in database...
                   //
                   if ($textArtNr == $dbArtNr) {

                     $foundProduct= true;

//If saldo for product isn't the same for product in textfile, //OR price for product isn't' the same for product in textfile
                       //THEN do something...
                       //
if (strtolower($textSaldo) != strtolower($dbSaldo) OR strtolower($newPrice) != strtolower($dbPris) OR $dbSynligVara == 'N') {


                           $sql2 = "UPDATE tbvara";
                           $sql2 .= " SET Saldo=" . safeQuote($textSaldo);

                           //Update price only if newPrice is over zero
//newPrice IS zero when marginalProcent is set to zero based on marginalProcent
                           //from tbunderkategori
//Price from vendor must also be higher than zero //If price is locked (lastPris), then don't update specific price
                           //
                           if ($dbLastPris == 'N') {

if (intval($newPrice) > 0 AND intval($textPris) > 0) {

$sql2 .= ", startPris=" . safeQuote($newPrice);

                               }

                           }

                           $sql2 .= ", synligVara=" . safeQuote('Y');
$sql2 .= " WHERE IDVara=" . safeQuote($idproduct) . " LIMIT 1";
                           $querys2 = mysql_query($sql2);
                           $writeTo = "Produkt: $dbArtNr";
                           writeNow($writeTo, $logFileName);

$writeTo = "marginalpåslag i %: $marginalProcent (Underkategori: $dbUnderKategori)";
                           writeNow($writeTo, $logFileName);

                           if ($dbSaldo != $textSaldo) {
$writeTo = "Föregående saldo: $dbSaldo har ändrats till: $textSaldo";
                               writeNow($writeTo, $logFileName);
                           }

                           if ($dbPris != $newPrice) {
$writeTo = "Föregående pris = $dbPris har ändrats till: $newPrice";
                               writeNow($writeTo, $logFileName);
                           }

                           $writeTo = "Ändring fungerade bra:";
                           writeNow($writeTo, $logFileName);

                           $wrongSQL = mysql_error();

                           //No errors when sql query was executed
                           //
                           if (strlen($wrongSQL)==0) {
                               $updateActions++;
                               $writeTo = "Ja";
                               writeNow($writeTo, $logFileName);

                           }
                           else {
                             //Error when sql-query was executed
                             //
                               $writeTo = "Nej - fel $wrongSQL";
                               writeNow($writeTo, $logFileName);
                           }

$writeTo = "-------------------------------------------------";
                           writeNow($writeTo, $logFileName);



                       }
                       //echo "<b>YES</b>! $sql2";

                     }

               }


           $row++;

         }
         //End of textfile
       ob_flush();


         fclose($handle);

         if ($foundProduct == false AND $dbSynligVara == 'Y') {

$sql2 = "UPDATE tbvara SET synligVara=" . safeQuote('N') . " WHERE IDVara=" . safeQuote($idproduct) . " LIMIT 1";
           //echo $sql2;
           $querys2 = mysql_query($sql2);
           $deleteActions++;

         }


       }
       //END Go through database with products from GNT






mysql_close();
//Increase limitstart to begin after current limitSteps
//
$limitStart = $limitStart + $limitSteps + 1;


?>
<script language="Javascript">
window.location = 'gnt_checksaldo_step2.php?limitstart=<?php echo $limitStart;?>&nrofproducts=<?php echo $nrOfProducts;?>&deleteActions=<?php echo $deleteActions;?>&updateActions=<?php echo $updateActions;?>&startTime=<?php echo $startTime;?>'; </script>
--- End Message ---

Reply via email to