[PHP] suEXEC and PHP

2002-11-26 Thread Richard Fox
Hi,

Apache 1.3.24, PHP 4.2.2

I am running a php script which executes something like

system("scp -r -S ssh host1:/home/dir host2:/home");

The scp command executes as the apache user, in my case 'nobody'. This does
not work, as the ssh authentication is not set up for user 'nobody' nor
should it be. Setting a different user, as in "scp -r -S ssh
myuser@host1:/home/dir myuser@host2:/home" deosn't work, ssh still tries to
authenticate 'nobody'.

First I tried running apache as a different user, 'apache', after setting up
the rsa keys etc (ssh stuff) for 'apache'. The authentication then works but
there are issues of the 'apache' user having read/write permissions on the
directories host1:/home/dir and host2:/home. I thought that giving the
'apache' user permission to read/write these directories wasn't a very good
idea.

Now I am trying to use the apache suEXEC feature to do this, so that my php
script can run as a different user (eg. myuser) who has all the right
permissions and ssh configured. However, so far I have been unsccessful and
suspect that suEXEC will not work with PHP. Does anyone out there have
experience with this? Any advice would be appreciated.

tia,

Rich


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] FTP and security

2002-11-26 Thread Richard Fox

My company, as a matter of policy, closes the ftp ports of the servers in the DMZ. 
However, I am not convinced that this is necessary, given the advent of very secure 
ftp servers. I would appreciate any comments on the security of an open ftp port. To 
relate this to php, I am ready to give up trying to make my 

system("scp ..");

code work, because I will have to give the apache user more permissions than I am 
comfortable with. So, I am thinking fo using php's ftp commands instead. I see nowhere 
in the documentation however, if the ftp_connect can be done via the ssh transport 
mechanism. Or, is this unnecessary, and can I use ftp (with plain text user and 
password passed to ftp_login()) on port 21 without worrying about getting hacked? 

muchas gracias

Rich



Re: [PHP] FTP and security

2002-11-26 Thread Richard Fox
> > To relate this to php, I am ready to give up
> > trying to make my
> >
> > system("scp ..");
> >
> > code work, because I will have to give the apache user more permissions
> > than I am comfortable with.
>
> What exactly are the problems you're encountering using scp?
>

I created an apache user, which I called apache, and  made sure this user
could connect to the remote servers and created rsa keys so no passwords
would be necessary (so my system($cmd) call would work). This is what
happens when I run scp:

bash-2.05a$ scp -pvr -S ssh apache@thor:/home/web/testsite/cgi-bin
apache@loki:/home/web/testsite
Executing: ssh -v -x -o'FallBackToRsh no' -o'ClearAllForwardings yes' -n -l
apache thor scp -v -r -p /home/web/testsite/cgi-bin
'apache@loki:/home/web/testsite'
OpenSSH_3.1p1, SSH protocols 1.5/2.0, OpenSSL 0x0090602f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be
trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 48 geteuid 0 anon 1
debug1: Connecting to thor [127.0.0.1] port 22.
debug1: temporarily_use_uid: 48/48 (e=0)
debug1: restore_uid
debug1: temporarily_use_uid: 48/48 (e=0)
debug1: restore_uid
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: identity file /home/apache/.ssh/identity type -1
debug1: identity file /home/apache/.ssh/id_rsa type 1
debug1: identity file /home/apache/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.1p1
debug1: match: OpenSSH_3.1p1 pat OpenSSH*
Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: dh_gen_key: priv key bits set: 135/256
debug1: bits set: 1551/3191
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'thor' is known and matches the RSA host key.
debug1: Found key in /home/apache/.ssh/known_hosts:1
debug1: bits set: 1576/3191
debug1: ssh_rsa_verify: signature correct
debug1: kex_derive_keys
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: waiting for SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: service_accept: ssh-userauth
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: authentications that can continue:
publickey,password,keyboard-interactive
debug1: next auth method to try is publickey
debug1: try privkey: /home/apache/.ssh/identity
debug1: try pubkey: /home/apache/.ssh/id_rsa
debug1: input_userauth_pk_ok: pkalg ssh-rsa blen 149 lastkey 0x8086d50 hint
1
debug1: read PEM private key done: type RSA
debug1: ssh-userauth2 successful: method publickey
debug1: fd 4 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug1: send channel open 0
debug1: Entering interactive session.
debug1: ssh_session2_setup: id 0
debug1: Sending command: scp -v -r -p /home/web/testsite/cgi-bin
apache@loki:/home/web/testsite
debug1: channel request 0: exec
debug1: channel 0: open confirm rwindow 0 rmax 32768
debug1: channel 0: read<=0 rfd 4 len 0
debug1: channel 0: read failed
debug1: channel 0: close_read
debug1: channel 0: input open -> drain
debug1: channel 0: ibuf empty
debug1: channel 0: send eof
debug1: channel 0: input drain -> closed

There is more output, but as you can see the read of the src files failed
and an empty ibuf is sent. This command line call works if I am a normal
user for whom I have set up known_hosts and authorized_keys. But the above
is the result when I run scp as user 'apache'.


> So, I am thinking fo using php's ftp commands
> > instead. I see nowhere in the documentation however, if the ftp_connect
can
> > be done via the ssh transport mechanism. Or, is this unnecessary, and
can I
> > use ftp (with plain text user and password passed to ftp_login()) on
port
> > 21 without worrying about getting hacked?
>
> Well, if you're going to be using ftp-over-ssh, I don't see why you're not
> using scp directly instead.
>

I thought that if I create an ssh tunnel for ftp, I could use the php ftp
functions, they would actually be using ssh transparently.

Rich


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] SELECTing a row by maximum value

2002-12-30 Thread Richard Fox
Hi,

What would be a query to select a single record from a number of records in
a table, depending on which one has the biggest value in an integer field?

e.g something like:

MYTABLE

id   ifield
1100
2200
3150

SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield)

should return id=2, ifield=200

(but this doesn't work, of course)

Many thanks,

Richard



[PHP] Multidimensional arrays

2002-08-19 Thread Richard Fox

Hi,

Given the array $array initialized by:

  $query =  "SELECT id,name FROM MYTABLE";
  $result = mysql_query($query);
  $nrows = mysql_num_rows($result);
  for ($i=0; $i<$nrows; $i++) {
 $arr = mysql_fetch_array($result);
 $array[$i]['id']   = $arr['id'];
 $array[$i]['name'] = $arr['name'];
 }

I know I can have a similar 'for' loop to step through the array, from 0 to 
count($array)
But I would like to do something more elegant, with a foreach loop. But I have been 
unsuccessful as a foreach seems appropriate only with a single dimensional array. Can 
someone suggest a more elegant solution? Thanks, Rich
P.S. yes, I am fairly new to PHP, less than 6 months. Probably my array loading method 
could be improved also!





[PHP] String operation

2002-09-04 Thread Richard Fox

Hi

Given

string1 = /home/web/
string2 = /home/web/www/index.php

How can I elegantly do an exclusive or of string1 with string2, that is, I want to end 
up with 

string3 = www/index.php

Thanks! 



[PHP] Disabling cookies per website

2002-09-23 Thread Richard Fox

Is there a way to disable cookies not for all sites but on a per site basis? If I do 
an ini_set() on session.use_cookies will all sites be afftected or only the site I am 
on?

Thanks,
Rich



[PHP] Explorer-like "drill down" interface

2002-09-25 Thread Richard Fox

I have two questions:

1. I would like to build a php page that contains a Windows explorer-like drill down 
mechanism, where clicking the '+' beside an item will expand the sub-items below 
(which can also have a '+' or '-' on the left) and clicking the '-' will collapse the 
item. Is there any existing code for that or hints how I can do it?

2. I have allowed packets through my firewall destined for port 3306, the mysql 
server. So I can connect to the server from a remote machine. Are there any known 
security vulnerabilities in the mySQL server? 

Many thanks,

Rich




[PHP] Encrypted MySQL passwords

2002-09-26 Thread Richard Fox

Hi,

I am connecting to  a mysql server on a remote machine, and opened up port 3306 for 
this purpose. But, I am concerned about sending a clear text password, via the 
mysql_pconnect() call. My question is, what is the procedure for connecting to a 
remote server with an encrypted password? Or, does mysql_pconnect handle this?

THX
RIch



Re: [PHP] Encrypted MySQL passwords

2002-09-27 Thread Richard Fox


"Rodolfo Gonzalez" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thu, 26 Sep 2002, Brad Bonkoski wrote:
>
> > also might be better then sending it in the clear.
>
> But I guess that the original poster wanted to know how to avoid the clear
> text session originated by the client-server dialog itself, not the
> passwords in a query (its easy to log the sessions using tcpdump, for
> example). BTW (and I have not checked the CVS/TODO, so I ask here), is
> there planned support for SSL & MySQL 4.x.x in PHP?.
>

That's right, I want to avoid the original clear text session from the
start. Thanks for all the info. When I am ready to go online with my app, I
will either recompile my MySQL 3.23.49 to use SSL, or if production MySQL
4.x.x is ready I'll switch to it.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Encrypted MySQL passwords (new info from MysQL list)

2002-09-27 Thread Richard Fox




> Hi Andrew and Richard,
> The password and connection info is scrambled up. You can look,  If
> you want to check it out for your self look in the source code of
> ./mysql-3.23.XX/libmysql  search for the following functions.
> especially in 'mysql_real_connect' function.   It is not the best
> method,  but it is not clear text!
>
> void hash_password(ulong *result, const char *password)
> void make_scrambled_password(char *to,const char *password)
> char *scramble(char *to,const char *message,const char *password,
>my_bool old_ver)
>
> See ya
> Ken




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] use_cookies not working

2002-10-04 Thread Richard Fox

I am using 
   ini_set("session.use_cookies","0");
to disable cookies but I don't see PHPSESSID showing up like I thought it would, so I 
don't think its working. I call it before session_start(). After the ini_set call I do 
   session_log("CSE_Session_Start");
   session_module_name("user");
   session_set_save_handler("sess_open", "sess_close",
   "sess_read", "sess_write", "sess_remove", "sess_gc");
   session_start();

ANy ideas?

Thanks
Rich



[PHP] Server-server file copy question

2002-11-20 Thread Richard Fox
Hi,

I am using PHP 4.4.2.. I need a function to copy a file from one server to
another. The src/dst filenames are relative to the Document Root of the website, but
I can build an absolute path name if necessary. I can't use ftp because the
ftp ports are closed on these servers. I would like to use http or ssh for
the file transfer. The application is that multiple files can be copied from
website to website on our various servers. I have been looking around at
mailing lists, etc but haven't found a function described which does a
non-ftp inter-IP file copy, only client/server file uploads and ftp
functions.

TIA,
Rich





[PHP] Polymorphism question

2002-02-15 Thread Richard Fox



I am new to PHP but 10 years in C++

One of the cool/powerful things you can do in C++ is the following:

class DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws a vanilla dialog box
   };

class DrawStyleDialog : public DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws better dialog
   };

Somewhere in my code I have a function like:

void ShowGUI( DrawPlainDialog& dd ) {
   dd.Draw();
   }

ShowGUI can be called with any object that is derived from DrawPlainDialog,
obviously. Only code that calls ShowGUI must be changed when a new
implementation of DrawPlainDialog is used. This feature of C++ to have a
base class pointer (or reference) be able to access derived class
functionality is not something I've seen in any PHP documentation. Does it
exist, and if not is there a workaround for this highly desirable feature?

TIA

Rich

PS Can anyone point me to the most comprehensive OOP documentation for PHP?

--




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Fw: Polymorphism question

2002-02-15 Thread Richard Fox



I am new to PHP but 10 years in C++

One of the cool/powerful things you can do in C++ is the following:

class DrawDialog {
public:
...
   virtual Draw(); // implementation draws a plain dialog box
   };

class DrawStyleDialog : public DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws better dialog based on some
parameters
   };

Somewhere in my code I have a function like:

void ShowGUI( DrawDialog& dd ) {
   dd.Draw();
   }

ShowGUI can be called with any object that is derived from DrawDialog,
obviously. Only code that calls ShowGUI must be changed when a new
implementation of DrawDialog is used. This feature of C++ to have a base
class pointer (or reference) be able to access derived class functionality
is not something I've seen in any PHP documentation. Does it exist, and if
not is there a workaround for this highly desirable feature?

TIA

Rich

PS Can anyone point me to the most comprehensive OOP documentation for PHP?

--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Polymorphism question

2002-02-15 Thread Richard Fox



I am new to PHP but 10 years in C++

One of the cool/powerful things you can do in C++ is the following:

class DrawDialog {
public:
...
   virtual Draw(); // implementation draws a plain dialog box
   };

class DrawStyleDialog : public DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws better dialog based on some
parameters
   };

Somewhere in my code I have a function like:

void ShowGUI( DrawDialog& dd ) {
   dd.Draw();
   }

ShowGUI can be called with any object that is derived from DrawDialog,
obviously. Only code that calls ShowGUI must be changed when a new
implementation of DrawDialog is used. This feature of C++ to have a base
class pointer (or reference) be able to access derived class functionality
is not something I've seen in any PHP documentation. Does it exist, and if
not is there a workaround for this highly desirable feature?

TIA

Rich

PS Can anyone point me to the most comprehensive OOP documentation for PHP?

--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] OOP: Polymorphism question

2002-02-15 Thread Richard Fox

I am new to PHP but 10 years in C++

One of the cool/powerful things you can do in C++ is the following:

class DrawDialog {
public:
...
   virtual Draw(); // implementation draws a plain dialog box
   };

class DrawStyleDialog : public DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws better dialog based on some parameters
   };

Somewhere in my code I have a function like:

void ShowGUI( DrawDialog& dd ) {
   dd.Draw();
   } 

ShowGUI can be called with any object that is derived from DrawDialog, obviously. Only 
code that calls ShowGUI must be changed when a new implementation of DrawDialog is 
used. This feature of C++ to have a base class pointer (or reference) be able to 
access derived class functionality is not something I've seen in any PHP 
documentation. Does it exist, and if not is there a workaround for this highly 
desirable feature?

TIA

Rich

PS Can anyone point me to the most comprehensive OOP documentation for PHP?



[PHP] Re: Polymorphism in PHP

2002-02-18 Thread Richard Fox

That's right, the difference between C++ "pure virtual" and "virtual" is
that a virtual function has an implementation but pure virtual only defines
an interface.

But can we get back to my original PHP question: Can I do something like the
following in php:

class Base {
   function Foo() { echo "Base"; }
   }

class Derived1 extends Base {
   function Foo() { echo "Derived1"; }
   }

class Derived2 extends Base {
   function Foo() { echo "Derived2"; }
   }

function Example ( $objvar ) {
   $objvar->Foo();
   }

...

$obj1 = new Base();
$obj2 = new Derived1();
$obj3 = new Derived2();
Example($obj1);
Example($obj2);
Example($obj3);

I think what I am asking is, is there any concept of a virtual function in
PHP, with a virtual function table?

Rich


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 17, 2002 5:31 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Polymorphism question


A bit late in replying - but what the hay (or is that "hey"??) oh well...

>From my understanding of virtual functions (and it's been at least 3 to 4
years since I've done C++) is that a "virtual function" has basic
functionality and a "pure virtual function" has no, and can't have, and
code.

Please correct me if I'm wrong

Martin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] GMT Time

2002-04-19 Thread Richard Fox

Ok, I give up.

I want to compare a timestamp(14) field in a MySQL table with the current
time. Currently I use the following pseudo-sql:

select field from table where table.time <  date("YmdHis", time())

only, the table timestamp is GMT time and the time function is returning
local time. How do I convert time() to GMT time?

Thanks!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: How to connect to mysql through JAVA?

2002-04-24 Thread Richard Fox


Sourceforge MySQL JDBC driver
http://mmmysql.sourceforge.net/

maybe this code frag will be helpful...

  String connectionURL = "jdbc:mysql://centauri.sbs:3306/dbname";
  Connection conn = null;
  Statement statement = null;
  ResultSet rset = null;
  try {
 Class.forName("org.gjt.mm.mysql.Driver").newInstance();
 conn = DriverManager.getConnection(connectionURL,"servlet","password");
 statement = conn.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
 rset = statement.executeQuery(
"SELECT * FROM BROWSER WHERE sessionID='"
 + request.getParameter("session_id") +"'");

 .. now use rset
  } // try
  catch( ClassNotFoundException e ) {
 PrintWriter pw = new PrintWriter(out, true);
 pw.println("Couldn't find the mm database driver: "
 + e.getMessage());
 }
  catch( InstantiationException e ) {
 PrintWriter pw = new PrintWriter(out, true);
 pw.println(e.getMessage());
 }
  catch( IllegalAccessException e ) {
 PrintWriter pw = new PrintWriter(out, true);
 pw.println(e.getMessage());
 }
  catch( SQLException e ) {
 PrintWriter pw = new PrintWriter(out, true);
 pw.println("SQL Problem: " + e.getMessage());
 pw.println("SQL State: " + e.getSQLState());
 pw.println("Vendor Error: " + e.getErrorCode());
 }
  finally {
try {
  if ( conn != null )
  conn.close();
  }
catch( SQLException e ) {
  PrintWriter pw = new PrintWriter(out, true);
  pw.println(e.getMessage());
  }
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: How to connect to mysql through JAVA?

2002-04-24 Thread Richard Fox

The last post is using the MySQL JDBC from a Java Server Page in a servlet
environment. I never tried to run this from Java imbedded in a PHP script.
You would have to remove the exception handling, at least.

I dispatch a Java Server Page from my php script (write to a socket), do
some java stuff there involving my MySQL db, and return the output to my php
script (read from socket).

I can send more details on this if you're interested.

Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] yet another session problem

2002-04-24 Thread Richard Fox

I am testing user-handling of sessions (mysql database) and just do not understand 
this behavior. my SESSION table is created as 

CREATE TABLE SESSION (
  id varchar(32) NOT NULL default '',
  time timestamp(14) NOT NULL,
  user_id mediumint(8) NOT NULL default '-1',
  data text NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;

I have a main script index.php3

 set" );
   }


function increment() {
   $_SESSION['']++;
   echo "=".$_SESSION['']."";
   }

function set_() {
   echo "set ";
   $_SESSION[''] = 666;
   }


if (isset($_POST['MYVAR']))
   set_();
else
   increment();

echo "$PHP_SELF increment ";
echo "$PHP_SELF register ";

?>

and sessions.inc:



I can see in the log file that session_write() is executed when I register . But 
there is a problem:

PROBLEM: When I register , there is no call to session_write() in the log file, 
and no data for  gets written to the database. 

Can you duplicate this behavior on your system? Do you have an explanation?

Thanks!

Rich





[PHP] Unexpected OOP behavior

2002-04-25 Thread Richard Fox

I noticed a behavior of my PHP class (4.1.1) which I found very unexpected
and also undocumented. I defined a class constructor, and this constructor
was automatically called *again* on my instantiated object when the script
ended! This runs counter to
1. what one would expect a constructor to do
2. what the PHP docs say, which is that any clean up of a class object
must be handled explicitly

Can anyone verify/explain this behavior?

Thanks

Rich




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] date comparison

2002-04-29 Thread Richard Fox

I have a date string, let's call it 'date a' in the format "2020-10-16"
which I want to compare to the UNIX_TIMESTAMP overflow limit ("2038-01-18").
Obviously I can't convert date 'a' to a timestamp because it may be too
large. How can I make this comparision without converting it to a timestamp?

Thanks,

Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Apache/PHP/Java problem

2002-05-03 Thread Richard Fox

I have Apache 1.3.24, PHP 4.2.0, and Java2SDK installed and working. My
problem is, when I boot up and dispatch my phpTest.php script from my
browser

 ".$formatter->format(new Java('java.util.Date'));

  phpinfo();
 ?>

I get an error message that the java .so is not found. I start apache from
rc.local. If I then run 'apachectl restart' then the script works fine and
the java .so is found. The specific error message is (the java libs are
pointed to from php.ini):

Fatal error: Unable to load Java Library
/usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so, error: libjvm.so: cannot load
shared object file: No such file or directory in
/home/web/staging/rfox/www/phpTest.php3 on line 3

Since rc.local is executed at the end of system init, I can't understand why
php can't find the java .so. As I said, upon Apache restart it works fine.

Any insight would be greatly appreciated.

Rich





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Compilation error

2002-06-02 Thread Richard Fox

Hi,

I am compiling PHP 4.2.0 on a RedHat 7.1 system with mnogosearch 3.2.3. I am
running into a problem that I have not seen on my other RedHat systems with
the same configuration (except Redhat 7.2 instead of 7.1), and that is that
the link does not work because there are some symbols that are multiply
defined. Specifically, ftp_login. The linker tells me that the symbol was
first definied in mnogosearch-3.2.3/src/ftp.c, and also found in
php-4.2.0/ext/ftp/ftp.c (the are other ftp_xx functions multiply defined
also, e.g. ftp_close, ftp_list, same files).

If I remove --ftp_enable from my config then there is no error. I cannot
figure out how to have ftp support in PHP and mnogosearch also! This does
not occur when building PHP on my other RedHat system, where
both --enable-ftp and --with-mnogosearch=/usr/local/mnogosearch are used and
the linker is happy.

Can anyone give some advice? Has anyone encountered the same problem?

Thanks, I'm stuck!

Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP, Java, and Apache

2002-02-26 Thread Richard Fox

I am trying to sort out several technologies and how they fit together. The
basic problem I want to solve is to be able to use BrowserHawk, a JavaBean
by CyScape, from a PHP script. In researching how to do this (and there are
several relevant articles written) I have come across several different
options and do not know how to weigh the pros and cons to come with the
right combination of configurations. I am running Apache Server 1.3.23, PHP
4.1.1, and Java 2 SDK 1.4.0 on a RedHat 7.0 system.

1. There appear to be two choices of configuring Java with PHP: (a) rebuild
PHP with Java support (./configure --with-java ...) and (b) integrate PHP
into a servlet environment.

2. Apparently (see http://www.intechra.net/bh/install.html) in order to
accomplish 1.(a) I must use the dynamic loading method (--with-apxs) to
build PHP, which means I must also rebuild Apache
(./configure --enable-module=so --enable-module=SHARED_CORE)
Question: why? If I am rebulding PHP with Java support then why does Apache
care?

3. What exactly does 1.(b) mean? How does one integrate PHP into a servlet
environment, and how does this affect the Apache configuration? Sure, Apache
will spawn a servlet to execute a php script, and another servlet (a JVM) to
execute the BrowserHawk Java Bean.. but is this better? Is it hard to
configure the system like this?

4. I have also run across an article advocating installing PHP as an Apache
DSO, a dynamically loadable module. wait a second I thought PHP already
was by default a dynamically loadable module to Apache! This is very fuzzy
to me.

Any advice on sorting this out for this web technology newbie would be
appreciated. For example, is there one preferred configuration (dare I say..
a standard?) for getting PHP, Java, and Apache working together?

TIA,

Rich




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and BrowserHawk

2002-02-28 Thread Richard Fox



Hi Richard,

I have finally got Java working with PHP. My Java is JSDK 1.4.0, the latest
release of the SDK from Sun. How do I know it's working? I put

$system = new Java("java.lang.System");

print "Java version=".$system->getProperty("java.version")."
\n";
print "Java vendor=".$system->getProperty("java.vendor")." \n\n";
print "OS=".$system->getProperty("os.name")." ".
  $system->getProperty("os.version")." on ".
  $system->getProperty("os.arch")." \n";

$formatter = new Java("java.text.SimpleDateFormat",",
 dd,  'at' h:mm:ss a ");
print $formatter->format(new Java("java.util.Date"))."\n\n";

into my PHP script and get:

Java version=1.4.0
Java vendor=Sun Microsystems Inc.
OS=Linux 2.4.2-2 on i386
Thursday, February 28, 2002 at 12:44:03 PM GMT-05:00

Nice, huh? Now, next step is to test BrowserHawk. I do not have servlet
support on my Apache webserver, but according to the BrowserHawk README
file, and I quote

BrowserHawk4J can be used anywhere server-side Java(tm) is available,
including servlets, JavaServer Pages, server-side JavaScript, and even
stand-alone Java applications. The only requirement is a Java Virtual
Machine version 1.1.x or higher. Note that to use any of the extended
properties of BrowserHawk4J (as defined below), you must use the BH4J
bean from a servlet or JSP environment.

So, I take this to mean that as long as I do not try to get extended
properties, I should be able to use my current setup to use BrowserHawks
basic capabilities. Fine, for the first step. My php.ini looks like

[Java]
java.class.path =
/usr/local/lib/php/php_java.jar:/usr/local/BrowserHawk/lib/bhawk4j.jar:/usr/
local/BrowserHawk
java.home = /usr/java/j2sdk1.4.0
java.library = libjava.so
java.library.path = /usr/local/lib/php/extensions/no-debug-non-zts-20010901
extension_dir = /usr/local/lib/php/extensions/no-debug-non-zts-20010901
extension = libphp_java.so


and my CLASSPATH and LD_LIBRARY_PATH are

[root@centauri /root]# echo $CLASSPATH
/usr/local/BrowserHawk/lib/bhawk4j.jar:/usr/local/BrowserHawk
[root@centauri /root]# echo $LD_LIBRARY_PATH
/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/server:/
usr/local/lib/php:/usr/local/BrowserHawk/lib


but, when I point my browser to
http://localhost/BrowserHawk/examples/showbrow-ssjs.html I get:

Browser Capabilities Test Page
The following is information on your web browser's capabilities
as detected by BrowserHawk4J using Netscape's Server-Side JavaScript
technology.

User agent: write(request.agent)

if (b == null) { Browser information was null. This should never happen. In
case of error, getBrowserInfo() throws a BrowserHawkException.

}

Has anyone else gotten BrowserHwk running under PHP using Java extension?
Any suggestions would be appreciated. As far as I can tell (as my java is
definitely working!) this should work.


Thanks,
Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP and Java

2002-03-01 Thread Richard Fox

>From my experience getting Java to run w/ PHP and Apache on RedHat 7.0, you
can try setting the LD_LIBRARY_PATH environment variable ( without which my
Java would not run) set to the location of libjava.so, libjvm.so, and
php_java.jar, in my case (without line feeds)

 LD_LIBRARY_PATH="/usr/java/j2sdk1.4.0/jre/lib/i386:
/usr/java/j2sdk1.4.0/jre/lib/i386/server:/usr/local/lib/php"

Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP and Java

2002-03-01 Thread Richard Fox

Minor point, but you do mean LD_LIBRARY_PATH, not LD_LIBRARYPATH right?

Also, set

[Java]
extension = libphp_java.so
extension_dir = (pathname to libphp_java.so)

Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Fox

This is a behavior I have not found documented, in fact the books I have
read indicated that this would not be the case...

given the script (with session.save_handler = files):

";
   }

session_start();
reg();
echo "test=<$test>";

?>

The output is:

in reg(), test=<13>
test=<>

I was quite surprised, but at least now I know why my code isn't working. I
assume that $test is going out of scope after the function reg() exits. BUT,
isn't registering a variable as a session variable supposed to give it
"superglobal" status? I thought so.  Can someone give me the 'official'
explanation of this behavior?

Many thanks,

Richard


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Fox

OK, but then how do you explain:

";
}

global $HTTP_SESSION_VARS;
session_start();
reg();
if (session_is_registered("test")) {
   $tt = $HTTP_SESSION_VARS["test"];
   echo "session variable test=<$tt>";
   }
else
   echo "You really don't know what you're doing, do you?";
?>

This still gives me the output:

in reg(), test=<13>
session variable test=<>


Aaargh!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Fox

Then, when

session_register("");

is called (even on a variable which is going out of scope) what actually
happens? Where is the data actually stored? I know it isn't in the file yet
(I have session.save_handler = files) because nothing is written to the file
until the script exits. So the memory for  should either be in free
store or on the stack. And, the second question: how can this memory, and
the data it contains, be accessed later in the script (after the
session_register) without having to depend on the original variable being
global or not?

Indeed, it appears that unless the registered variable is global,
session_register will not work.  (Reference my test script appended below,
which can be loaded multiple times with no effect) This is undocumented!

Note: I am not complaining about documentation, I am just trying to
understand what exactly is happening when you register a session variable.

Richard

";
   }

session_start();
if (!session_is_registered("test")) reg();
echo "HTTP_SESSION_VARS[test] = <".$HTTP_SESSION_VARS["test"].">";
?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and Java Servlets

2002-03-15 Thread Richard Fox

I have to build a "bridge page" from my PHP script that does the following:

1. Kick off a Java servlet (in my case running on my Tomcat4 plug-in to
Apache)
2. Receive data back from that servlet and continue my PHP script.

Does anyone have hard won advice, tips on great articles, examples, etc?

TIA,

Rich




[PHP] Error compiling PHP with native MySql

2002-03-21 Thread Richard Fox

When I try to configure PHP 4.1.1 I get the following error:

checking whether to include ming support... no
checking for mnoGoSearch support... yes
checking for mnoGoSearch version... 3.1.19
checking for mSQL support... no
checking for Muscat support... no
checking for MySQL support... yes
configure: error: Cannot find header files under /usr/include/mysql

The command line I'm using to configure:

./configure --with-mysql=/usr/include/mysql --with-java=/usr/java/j2sdk1.4.0
 --w
ith-xml --enable-shared-pdflib --enable-track-vars --with-db --with-gdbm --w
ith-
gd --enable-ftp --disable-debug --enable-memory-limit=yes --enable-trans-sid
 --w
ith-apxs=/usr/local/apache/bin/apxs --with-mnogosearch=/usr/local/mnogosearc
h

I am on RedHat 7.1 with the following MySql RPMs installed:

MySQL-devel-3.23.49-1
MySQL-client-3.23.49-1
MySQL-3.23.49-1

To check where the RPM installed the MySQL header files, I looked and found
that they are in /usr/include/mysql

[root@centauri local]# find / -name mysql -print
/home/rfox/download/mnogosearch-3.1.19/create/mysql
/usr/share/mysql
/usr/bin/mysql
/usr/lib/mysql
/usr/include/mysql
/usr/download/php-4.1.1/ext/mysql
/usr/download/php-4.1.1/pear/DB/tests/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/var/lib/mysql-/mysql
/var/lock/subsys/mysql
/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql

So, I do not understand this error at all! Can anyone help?

Thanks
Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php