php-general Digest 13 Mar 2004 06:24:31 -0000 Issue 2643
Topics (messages 180273 through 180315):
An extension to CREATE zips??
180273 by: Brian J. Celenza
Re: XSS Vulnerabilities and strip_tags
180274 by: Andre Cerqueira
Re: STrange Problem
180275 by: PHP
180276 by: Richard Davey
180277 by: trlists.clayst.com
180278 by: PHP
180279 by: Richard Davey
180280 by: trlists.clayst.com
180281 by: Richard Davey
180282 by: Richard Davey
180284 by: PHP
180285 by: Richard Davey
180286 by: PHP
180287 by: PHP
180288 by: Richard Davey
180289 by: trlists.clayst.com
Re: Get "nice" variables from POST
180283 by: Jaskirat Singh
creating thumbnails
180290 by: Maxi Yedid
180291 by: Jay Blanchard
180292 by: Brad Pauly
Adding php to the "include_path" in the php.ini???
180293 by: Scott Fletcher
180299 by: Jason Wong
Re: Help with arrays
180294 by: Elliot J. Balanza
Character Question
180295 by: David Westbrooks
180296 by: Pablo Gosse
180300 by: Filip de Waard
New Problem with Arrays won't show the first record of a query.
180297 by: Elliot J. Balanza
180304 by: Rasmus Lerdorf
180309 by: trlists.clayst.com
180311 by: Elliot J. Balanza
Servlet/PHP integration
180298 by: dba user
180302 by: Vail, Warren
180303 by: dba user
test
180301 by: JAMES OXFORD
ereg problem
180305 by: Newman Weekly.
180307 by: Newman Weekly.
SESSIONS SESSIONS SESSIONS
180306 by: Alberto García Gómez
180308 by: Jason Davidson
SMTP Authentication
180310 by: Beauford
180312 by: Elliot J. Balanza
180313 by: Manuel Lemos
Apache Config: php_value "auto_prepend_file" & "auto_append_file"
180314 by: Chris Wagner
180315 by: Rasmus Lerdorf
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:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Is there function library capable of creating zip files and adding files to
a zip archive under the windows/apache platform? After some extensive
browsing I can only turn up read-only access functions.
Thank you,
Brian
--- End Message ---
--- Begin Message ---
i didnt know what XSS was, just read it on webopedia.com now, maybe i
got the wrong idea...
strip_tags should prevent a kind of explotation, but maybe its behavior
is not exactly what you want...
see also htmlentities (http://www.php.net/htmlentities)
you need to ask yourself how the environment that you are using will
interpret things
if you are sending "SELECT ... FROM ... WHERE field1='".
$_POST['field1'] ."'", if $_POST['field1'] is:
0' OR field2=0 AND ''='
the resulting string would be:
SELECT ... FROM ... WHERE field1='0' OR field2=0 AND ''=''
and you probably dont want people making queries as they like hehe
dont let ppl upload files and save them as .php or any other extension
that would trigger a special behavior on the server that they shouldnt
be able to
remember you can never trust input data...
[EMAIL PROTECTED] wrote:
Is the general wisdom that using strip_tags on input is sufficient to
protect against XSS vulnerabilities from that input? I have been doing
some reading on it but haven't found anything that suggests a
vulnerability that removing the tags in this way would not cure.
Are there multi-level encodings that can get past strip_tags?
I probably should also be doing a urldecode before strip_tags to get
around any hex encodings, or does strip_tags handle that?
Thanks for any info,
--
Tom
--- End Message ---
--- Begin Message ---
OK, I do get the following error.
1044: Access denied for user: '@localhost' to database 'mydatabase'
Even though I specify the user in mysql_connect, for some reason,
mysql_select_db is trying to user a blank user,
Any Ideas?
>Hi,
>I am using RH9, Mysql 3.23.58, PHP 4.2.2, apache2.0
>
>mysql_select_db("mydatabase",$connect_id)
>
>allways fails.
>
>I can use $connect_id = mysql_connect("localhost","apache"); (YES, I do
have this line before the mysql_select_db);
>just fine.
>I can run querys against the database with no problems, but for some
reason,
>
>mysql_select_db("mydatabase",$connect_id)
>
>will allways return false, and I don't see any errors anywhere in any log.
Why can I not select the database with this, but have no problems using the
database >with every other mysql function?
--- End Message ---
--- Begin Message ---
Hello PHP,
Friday, March 12, 2004, 6:25:09 PM, you wrote:
P> OK, I do get the following error.
P> 1044: Access denied for user: '@localhost' to database 'mydatabase'
P> Even though I specify the user in mysql_connect, for some reason,
P> mysql_select_db is trying to user a blank user,
P> Any Ideas?
You said that you use "apache" as the username for MySQL - is this
something you've configured yourself? If not, it should be "root" and
the password should be blank unless you have also set that? In which
case it's missing from your connect command.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
On 12 Mar 2004 Richard Davey wrote:
> P> 1044: Access denied for user: '@localhost' to database 'mydatabase'
>
> You said that you use "apache" as the username for MySQL - is this
> something you've configured yourself?
It appears he is actually using a blank username as there is noting
before the '@' in the error message.
> If not, it should be "root" and the password should be blank unless
> you have also set that?
Configuring a MySQL database with a blank root password sounds like a
potential security risk to me ... why not just create a MySQL user/PW
for the specific PHP application and connect that way. Then you can
grant that user just the privileges they need to deal with the actions
the web page can take (SELECT, UPDATE, INSERT, and DELETE might be
enough, or even too much).
--
Tom
--- End Message ---
--- Begin Message ---
Yes, I have it configured to run as apache. But, as I mentioned, I have no
problems accessing the database and running querys against it, it is only
the mysql_select_db function that fails.
> Hello PHP,
>
> Friday, March 12, 2004, 6:25:09 PM, you wrote:
>
> P> OK, I do get the following error.
> P> 1044: Access denied for user: '@localhost' to database 'mydatabase'
>
> P> Even though I specify the user in mysql_connect, for some reason,
> P> mysql_select_db is trying to user a blank user,
> P> Any Ideas?
>
> You said that you use "apache" as the username for MySQL - is this
> something you've configured yourself? If not, it should be "root" and
> the password should be blank unless you have also set that? In which
> case it's missing from your connect command.
>
> --
> Best regards,
> Richard Davey
> http://www.phpcommunity.org/wiki/296.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hello trlists,
Friday, March 12, 2004, 6:37:34 PM, you wrote:
tcc> Configuring a MySQL database with a blank root password sounds like a
tcc> potential security risk to me ...
It is, but if he hasn't modified it otherwise, that's what it'll be.
Also for local development purposes, there is no harm in it.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
On 12 Mar 2004 Richard Davey wrote:
> It is, but if he hasn't modified it otherwise, that's what it'll be.
> Also for local development purposes, there is no harm in it.
Agreed, as long as he's not connected so someone can try to connect to
the MySQL port.
--
Tom
--- End Message ---
--- Begin Message ---
Hello trlists,
Friday, March 12, 2004, 6:48:03 PM, you wrote:
tcc> Agreed, as long as he's not connected so someone can try to connect to
tcc> the MySQL port.
If he's connected that long and not running a firewall, he deserves it
;)
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
Hello,
Friday, March 12, 2004, 6:38:37 PM, you wrote:
P> Yes, I have it configured to run as apache. But, as I mentioned, I have no
P> problems accessing the database and running querys against it, it is only
P> the mysql_select_db function that fails.
You mean you have no problems querying the database from within
*MySQL* itself, right? i.e. from the command-line?
As Tom pointed out, your error stated that no username was given.
Have you tried the command using the root MySQL user account? It's
possible the "apache" one hasn't been configured correctly.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
Yes, I have a root password.
No, I do not use root to run the server or connect to the database.
Yes, I do have the user apache in the grant tables for mysql with
permissions for the specific database.
Yes, I can run querys against said database and connect with user apache
with no problems.
Only msyql_select_db will not connect, it claims I am trying to use a blank
user, even though I specifically connect earlier with mysql_connect with the
specific user with no problems..
> Hello trlists,
>
> Friday, March 12, 2004, 6:48:03 PM, you wrote:
>
> tcc> Agreed, as long as he's not connected so someone can try to connect
to
> tcc> the MySQL port.
>
> If he's connected that long and not running a firewall, he deserves it
> ;)
>
> --
> Best regards,
> Richard Davey
> http://www.phpcommunity.org/wiki/296.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hello,
Friday, March 12, 2004, 7:00:38 PM, you wrote:
P> Only msyql_select_db will not connect, it claims I am trying to use a blank
P> user, even though I specifically connect earlier with mysql_connect with the
P> specific user with no problems..
What does this output?
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password")
or die("Could not connect: " . mysql_error());
echo "Connected successfully";
mysql_close($link);
?>
And don't just remove the "user" and "password" parts, fill them in.
If there is no password, put "".
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
It returns:
Connected successfully
Like I said, I have not problems connecting. Only mysql_select_db will not
work.
> Hello,
>
> Friday, March 12, 2004, 7:00:38 PM, you wrote:
>
> P> Only msyql_select_db will not connect, it claims I am trying to use a
blank
> P> user, even though I specifically connect earlier with mysql_connect
with the
> P> specific user with no problems..
>
> What does this output?
>
> <?php
> $link = mysql_connect("localhost", "mysql_user", "mysql_password")
> or die("Could not connect: " . mysql_error());
> echo "Connected successfully";
> mysql_close($link);
> ?>
>
> And don't just remove the "user" and "password" parts, fill them in.
> If there is no password, put "".
>
> --
> Best regards,
> Richard Davey
> http://www.phpcommunity.org/wiki/296.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
It seems the only way I can get mysql_select_db to work is to actually add a
blank user to the msyql.db table with appropiate privileges.
> Yes, I have a root password.
> No, I do not use root to run the server or connect to the database.
> Yes, I do have the user apache in the grant tables for mysql with
> permissions for the specific database.
> Yes, I can run querys against said database and connect with user apache
> with no problems.
>
> Only msyql_select_db will not connect, it claims I am trying to use a
blank
> user, even though I specifically connect earlier with mysql_connect with
the
> specific user with no problems..
>
>
> > Hello trlists,
> >
> > Friday, March 12, 2004, 6:48:03 PM, you wrote:
> >
> > tcc> Agreed, as long as he's not connected so someone can try to connect
> to
> > tcc> the MySQL port.
> >
> > If he's connected that long and not running a firewall, he deserves it
> > ;)
> >
> > --
> > Best regards,
> > Richard Davey
> > http://www.phpcommunity.org/wiki/296.html
> >
> > --
> > 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
>
--- End Message ---
--- Begin Message ---
Hello PHP,
Friday, March 12, 2004, 7:23:47 PM, you wrote:
P> It returns:
P> Connected successfully
P> Like I said, I have not problems connecting. Only mysql_select_db will not
P> work.
Fine, what does this return? With "foo" replaced with your database
name.
<?php
$lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
or die('Not connected : ' . mysql_error());
// make foo the current db
mysql_select_db('foo', $lnk) or die ('Can\'t use foo : ' . mysql_error());
?>
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
Is it possible that either $connect_id is not defined at the point
where you use it in the mysql_select_db call (e.g. it's global, the
call is in a function, and you forgot to use a global declaration),
and/or the previosuly opened connection has been closed?
What do you get if you do a var_dump($connect_id) right before the
mysql_select_db call?
--
Tom
--- End Message ---
--- Begin Message ---
>if (is_array($_POST)) {
> foreach($_POST as $name=>$value) {
> ${$name} = $value;
> }
>}
or use this
if (is_array($_POST))
{
extract($_POST);
}
Jaski
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com
--- End Message ---
--- Begin Message ---
hello
I have a "form" from where you can upload an image.
the script saves the file on the server in a folder.
what I want now is when it saves the file; I also want to save a copy of
that file in another folder with "thumbnail" size. How do I create a copy
with for example 100 x 100 and save that?
thanks
max
--- End Message ---
--- Begin Message ---
[snip]
I have a "form" from where you can upload an image.
the script saves the file on the server in a folder.
what I want now is when it saves the file; I also want to save a copy of
that file in another folder with "thumbnail" size. How do I create a
copy
with for example 100 x 100 and save that?
[/snip]
Start with TFM at http://us2.php.net/image
--- End Message ---
--- Begin Message ---
On Fri, 2004-03-12 at 15:17, Maxi Yedid wrote:
>
[snip]
> what I want now is when it saves the file; I also want to save a copy of
> that file in another folder with "thumbnail" size. How do I create a copy
> with for example 100 x 100 and save that?
If you are using Linux (maybe others too) you might be able to use
'mogrify' which is part of ImageMagick. I think it works very well for
this.
http://www.imagemagick.org/www/mogrify.html
- Brad
--- End Message ---
--- Begin Message ---
Hi!
After doing many testing for hte fsockopen() bugs with PHP developers
which is now fixed. I just happen to noticed that in the middle of those
testing when I do the PHP installation after doing the usual configure and
make. What I noticed is that it asked me to ..
--snip--
You may want to add: /usr/local/bin/php to your php.ini include_path
--snip--
Anyone know what so important about it? Since that PHP is already compiled
with Apache and that PHP work, so what is the purpose of adding the binary
php in /usr/local/bin/php to the php.ini configuration when it come to using
the website??
Thanks,
FletchSOD
--- End Message ---
--- Begin Message ---
On Saturday 13 March 2004 05:35, Scott Fletcher wrote:
> After doing many testing for hte fsockopen() bugs with PHP developers
> which is now fixed. I just happen to noticed that in the middle of those
> testing when I do the PHP installation after doing the usual configure and
> make. What I noticed is that it asked me to ..
>
> --snip--
> You may want to add: /usr/local/bin/php to your php.ini include_path
> --snip--
You mean /usr/local/lib/php ?
> Anyone know what so important about it? Since that PHP is already compiled
> with Apache and that PHP work, so what is the purpose of adding the binary
> php in /usr/local/bin/php to the php.ini configuration when it come to
> using the website??
That's usually where the PEAR stuff are stored.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
And they shall beat their swords into plowshares, for if you hit a man
with a plowshare, he's going to know he's been hit.
*/
--- End Message ---
--- Begin Message ---
Thank you Michael... That did the trick :D
thank you very very much, it took me three days... and now it seems so damn
easy.
vamp
"Michael Nolan" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Elliot J. Balanza wrote:
> > I need to make a query to a MySQL database that only has two fields,
name &
> > value. That I can do.
> >
> > Then I need to store the values i receive in an array in the form of:
> >
> > $variable['name'] = value;
> >
> > But haven't been able to do it neither with a foreach nor with a do
while...
> > Can anyone please assist me?
> >
>
> If you mean how do you store all the returned results in an array of
> name/value pairs, this is how I'd do it:
>
> <?php
>
> while ($result = mysql_fetch_assoc($query)) {
> $variable[$result['name']] = $result['value'];
> }
>
> ?>
>
> Don't know what 'value' represents, but it will give you an array
> something like this:
>
> print_r($variable);
>
> Array
> (
> [michael] => nolan
> [joe] => bloggs
> [john] => smith
> )
>
>
> HTH,
>
> Mike
--- End Message ---
--- Begin Message ---
I have articles held in a MySQL database for a law firm. When I pull the
information from the DB and display it, words like "that's" are shown as
"that\'s". To take care of this problem I have done this: $newsart =
eregi_replace("\\\'","'", $newsart);
Is there a better way to handle this to catch all irregular characters?
Thank you for your help in advance.
-Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.598 / Virus Database: 380 - Release Date: 2/28/2004
--- End Message ---
--- Begin Message ---
David Westbrooks wrote:
> I have articles held in a MySQL database for a law firm. When I pull
> the information from the DB and display it, words like "that's" are
> shown as "that\'s". To take care of this problem I have done this:
> $newsart = eregi_replace("\\\'","'", $newsart);
>
> Is there a better way to handle this to catch all irregular
> characters?
>
> Thank you for your help in advance.
>
> -Dave
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.598 / Virus Database: 380 - Release Date: 2/28/2004
http://www.php.net/stripslashes
--- End Message ---
--- Begin Message ---
On Mar 12, 2004, at 11:24 PM, Pablo Gosse wrote:
David Westbrooks wrote:
I have articles held in a MySQL database for a law firm. When I pull
the information from the DB and display it, words like "that's" are
shown as "that\'s". To take care of this problem I have done this:
$newsart = eregi_replace("\\\'","'", $newsart);
Is there a better way to handle this to catch all irregular
characters?
<snip>
http://www.php.net/stripslashes
stripslashes() is, like Pablo said, the solution to your question. But
you should not ask how to remove the slashes, but why they are there.
You should read the excellent article by Jeffrey Siegel and Michael
Southwell in PHP Magazine 2.04 about 'Storing and displaying data',
which explains some elementary stuff about this issue. I suppose that
'magic_quotes'
(http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc) is
switched on on your database server, which is a bad thing.
Since you are using MySQL you should store your data using
mysql_real_escape_string()
(http://www.php.net/mysql_real_escape_string). This way you won't have
to bother with slashes inside of your data.
I would suggest to study the manual carefully on this issue, since it
relates with security and possible SQL injection (and we don't want
that, do we?).
Regards,
Filip de Waard
--- End Message ---
--- Begin Message ---
Ok thanks to Michael Nolan I was able to do what I needed. The final code is
this:
<snip-snip>
mysql_select_db($database_MBTTIENDA, $MBTTIENDA);
$query_prefs = "SELECT * FROM mtmbt_prefs ORDER BY Pref_name ASC";
$prefs = mysql_query($query_prefs, $MBTTIENDA) or die(mysql_error());
$row_prefs = mysql_fetch_assoc($prefs);
$totalRows_prefs = mysql_num_rows($prefs);
while ($row_prefs = mysql_fetch_assoc($prefs)) {
$MTMBT[$row_prefs['Pref_name']] = $row_prefs['Pref_value'];
}
mysql_free_result($prefs);
<snip-snip>
and it works fine EXCEPT it wont show the first record of the query... any
ideas why?
Vamp
--- End Message ---
--- Begin Message ---
Because you do mysql_fetch_assoc() once before going into your while loop.
Get rid of that first $row_prefs = mysql_fetch_assoc(...) line there and
it will work.
-Rasmus
On Fri, 12 Mar 2004, Elliot J. Balanza wrote:
> Ok thanks to Michael Nolan I was able to do what I needed. The final code is
> this:
>
> <snip-snip>
> mysql_select_db($database_MBTTIENDA, $MBTTIENDA);
> $query_prefs = "SELECT * FROM mtmbt_prefs ORDER BY Pref_name ASC";
> $prefs = mysql_query($query_prefs, $MBTTIENDA) or die(mysql_error());
> $row_prefs = mysql_fetch_assoc($prefs);
> $totalRows_prefs = mysql_num_rows($prefs);
>
> while ($row_prefs = mysql_fetch_assoc($prefs)) {
> $MTMBT[$row_prefs['Pref_name']] = $row_prefs['Pref_value'];
> }
>
> mysql_free_result($prefs);
> <snip-snip>
>
> and it works fine EXCEPT it wont show the first record of the query... any
> ideas why?
>
> Vamp
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
On 12 Mar 2004 Elliot J. Balanza wrote:
> .....
> $row_prefs = mysql_fetch_assoc($prefs);
> .....
> while ($row_prefs = mysql_fetch_assoc($prefs)) {
> .....
> and it works fine EXCEPT it wont show the first record of the query... any
> ideas why?
Yes ... see the two lines quoted above. Each time you call
mysql_fetch_assoc you get another record. The first one loads the
first record, the second loads all the others. Delete the first call
and it should do what you want.
--
Tom
--- End Message ---
--- Begin Message ---
Thanks guys... it works dandy now.
Vamp
<[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> On 12 Mar 2004 Elliot J. Balanza wrote:
>
> > .....
> > $row_prefs = mysql_fetch_assoc($prefs);
> > .....
> > while ($row_prefs = mysql_fetch_assoc($prefs)) {
> > .....
>
> > and it works fine EXCEPT it wont show the first record of the query...
any
> > ideas why?
>
> Yes ... see the two lines quoted above. Each time you call
> mysql_fetch_assoc you get another record. The first one loads the
> first record, the second loads all the others. Delete the first call
> and it should do what you want.
>
> --
> Tom
--- End Message ---
--- Begin Message ---
I am sorry, if this message is a duplicate post. (I unwittingly press some key and the
page got refreshed before completing my post).
I am trying the Servlet/Php integration. I installed php with java support. But, I do
not see "php_java.jar" in any of the directories. I have
"/usr/local/php4/lib/php/phpsrvlt.jar" though. I am wondering why I did not have the
php_java.jar file? How do I verify I got php installed with java support? [I did not
get any error message during make install].
Also, when I tried to acess the test.php, as http://my-server:8080/examples/test.php ,
I get the error "Class not found. net.php.servlet". I copied the "phpsrvlt.jar" under
../server/lib of tomcat. If this is not correct, where would I copy the phpsrvlt.jar?
Also, does the CLASSPATH of the tomcat should have this jar included? Should it have
the LD_CONFIG set in the startup script?
Thanks.
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.
--- End Message ---
--- Begin Message ---
in order to execute code under http://my-server:8080/ doesn't it have to be
a java class?
Since PHP was never written in JAVA, that I know of, I suspect it will never
be a class file, and that may explain why you don't find a "php_java.jar".
What you will find is a php_java.so or php_java.dll (depending on your
platform) that executes under PHP which executes usually on an apache
server, usually as a cgi at port 80 (try
http://my-server:80/examples/test.php).
I may be wrong here, but PHP can invoke Java modules, only if it first
invokes the JRE to execute those modules, conversely a Java module could
invoke PHP modules if it first invokes the PHP runtime environment. Whether
you like it or not, Java and PHP run pretty much as equals, each in their
own environment, and the only way they can co exist is you invoke their
runtime environment first. Java runtime has no ability to run PHP code that
I know of and PHP has no ability to interpret the java byte code without
invoking a JRE to do it. When you read the manuals, the authors usually try
to imply that it is more tightly integrated than it really is, but I think
you will find it is pretty much as I've described here. If others disagree,
you will probably hear about it here as well, stay tuned.
http://www.php.net/manual/en/ref.java.php
Warren Vail
-----Original Message-----
From: dba user [mailto:[EMAIL PROTECTED]
Sent: Friday, March 12, 2004 2:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Servlet/PHP integration
I am sorry, if this message is a duplicate post. (I unwittingly press some
key and the page got refreshed before completing my post).
I am trying the Servlet/Php integration. I installed php with java support.
But, I do not see "php_java.jar" in any of the directories. I have
"/usr/local/php4/lib/php/phpsrvlt.jar" though. I am wondering why I did not
have the php_java.jar file? How do I verify I got php installed with java
support? [I did not get any error message during make install].
Also, when I tried to acess the test.php, as
http://my-server:8080/examples/test.php , I get the error "Class not found.
net.php.servlet". I copied the "phpsrvlt.jar" under ../server/lib of tomcat.
If this is not correct, where would I copy the phpsrvlt.jar? Also, does the
CLASSPATH of the tomcat should have this jar included? Should it have the
LD_CONFIG set in the startup script?
Thanks.
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.
--- End Message ---
--- Begin Message ---
Thanks Vail,
I was following http://us4.php.net/manual/en/ref.java.php#java.servlet and the README
from php install at sapi/servlet/README. I am new to php and servlet. My friend has a
requirement to integrate some php stuff into his existing java. I tried to get it
setup as described in sapi/servlet/README. But, I am not sure whether I can invoke it
directly from tomcat as in my previous example.
As you said, I will stay tuned to the forum.
Regards.
"Vail, Warren" <[EMAIL PROTECTED]> wrote:
in order to execute code under http://my-server:8080/ doesn't it have to be
a java class?
Since PHP was never written in JAVA, that I know of, I suspect it will never
be a class file, and that may explain why you don't find a "php_java.jar".
What you will find is a php_java.so or php_java.dll (depending on your
platform) that executes under PHP which executes usually on an apache
server, usually as a cgi at port 80 (try
http://my-server:80/examples/test.php).
I may be wrong here, but PHP can invoke Java modules, only if it first
invokes the JRE to execute those modules, conversely a Java module could
invoke PHP modules if it first invokes the PHP runtime environment. Whether
you like it or not, Java and PHP run pretty much as equals, each in their
own environment, and the only way they can co exist is you invoke their
runtime environment first. Java runtime has no ability to run PHP code that
I know of and PHP has no ability to interpret the java byte code without
invoking a JRE to do it. When you read the manuals, the authors usually try
to imply that it is more tightly integrated than it really is, but I think
you will find it is pretty much as I've described here. If others disagree,
you will probably hear about it here as well, stay tuned.
http://www.php.net/manual/en/ref.java.php
Warren Vail
-----Original Message-----
From: dba user [mailto:[EMAIL PROTECTED]
Sent: Friday, March 12, 2004 2:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Servlet/PHP integration
I am sorry, if this message is a duplicate post. (I unwittingly press some
key and the page got refreshed before completing my post).
I am trying the Servlet/Php integration. I installed php with java support.
But, I do not see "php_java.jar" in any of the directories. I have
"/usr/local/php4/lib/php/phpsrvlt.jar" though. I am wondering why I did not
have the php_java.jar file? How do I verify I got php installed with java
support? [I did not get any error message during make install].
Also, when I tried to acess the test.php, as
http://my-server:8080/examples/test.php , I get the error "Class not found.
net.php.servlet". I copied the "phpsrvlt.jar" under ../server/lib of tomcat.
If this is not correct, where would I copy the phpsrvlt.jar? Also, does the
CLASSPATH of the tomcat should have this jar included? Should it have the
LD_CONFIG set in the startup script?
Thanks.
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.
--- End Message ---
--- Begin Message ---
test
--- End Message ---
--- Begin Message ---
<?php
$formUserName="foobar";
if (ereg("^[a-bA-B][a-bA-B0-9]{3,11}$",$formUserName)
{
// IS VALID.
$pageUserNameValid="YES";
}
else
{
// NOT VALID
$pageUserNameValid="NO";
}
// PAGE OUT PUT..
echo $pageUserNameValid;
?>
This simple script is ment to check to a user nae field but I have done something
wrong.
$pageUserNameValid This should be yes for foo bar.
// Phil
--- End Message ---
--- Begin Message ---
Don't worry about this I worked out that the example was wrong (o;
----- Original Message -----
From: "Newman Weekly." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 13, 2004 1:59 PM
Subject: [PHP] ereg problem
<?php
$formUserName="foobar";
if (ereg("^[a-bA-B][a-bA-B0-9]{3,11}$",$formUserName)
{
// IS VALID.
$pageUserNameValid="YES";
}
else
{
// NOT VALID
$pageUserNameValid="NO";
}
// PAGE OUT PUT..
echo $pageUserNameValid;
?>
This simple script is ment to check to a user nae field but I have done something
wrong.
$pageUserNameValid This should be yes for foo bar.
// Phil
--- End Message ---
--- Begin Message ---
Friends:
I need a good example to create a session and navigate an entire site with this
sessions. Also I need that sessions handle a three variables.
______________________________
Atte.
Alberto García Gómez
Administrador Nodo Atenas
http://www.mtz.sld.cu/
Tel: 53-45-282212
--- End Message ---
--- Begin Message ---
http://ca.php.net/manual/en/function.session-start.php
=?iso-8859-1?Q?Alberto_Garc=EDa_G=F3mez?= <[EMAIL PROTECTED]>
wrote:
>
> Friends:
>
> I need a good example to create a session and navigate an entire site with this
> sessions. Also I need that sessions handle a three variables.
> ______________________________
> Atte.
> Alberto García Gómez
> Administrador Nodo Atenas
> http://www.mtz.sld.cu/
> Tel: 53-45-282212
>
--- End Message ---
--- Begin Message ---
Hi,
How would I set up PHP to use SMTP authentication when I send an email. For
example, in MS Outlook I have authentication set to use the same settings as
my incoming mail. I have searched around but haven't found anything that
deals with this.
Thanks
--- End Message ---
--- Begin Message ---
The thing is... if you are sending the mail from within your server why do
you need to authentificate you are yourself?
Vamp.
"Beauford" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi,
>
> How would I set up PHP to use SMTP authentication when I send an email.
For
> example, in MS Outlook I have authentication set to use the same settings
as
> my incoming mail. I have searched around but haven't found anything that
> deals with this.
>
> Thanks
--- End Message ---
--- Begin Message ---
Hello,
On 03/13/2004 12:54 AM, Beauford wrote:
How would I set up PHP to use SMTP authentication when I send an email. For
example, in MS Outlook I have authentication set to use the same settings as
my incoming mail. I have searched around but haven't found anything that
deals with this.
The mail function does not support authentication. You may want to try
this class that comes with a wrapper function named smtp_mail(). It
emulates the mail() function but lets you specify the authentication
credentials:
http://www.phpclasses.org/mimemessage
You also need this:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
hi,
i'm running a server with Fedora Core 1. this is using Apache 2.0.48
and PHP 4.3.4.
i have my http server root at /var/www/html/. i have some virtual hosts
setup.
i've just installed phpMyAdmin 2.5.6. my problem lies within the
auto_prepend_file and auto_append_file directives provided by PHP. i
have no default prepended or appended files, but have these directives
set up for each virtual host. so, the section of my httpd.conf file
that takes care of this, looks like so:
<Directory "/var/www/html/virtual_host1">
php_value auto_prepend_file /var/www/html/virtual_host1/header.php
php_value auto_append_file /var/www/html/virtual_host1/footer.php
</Directory>
<Directory "/var/www/html/virtual_host2">
php_value auto_prepend_file /var/www/html/virtual_host2/header.php
php_value auto_append_file /var/www/html/virtual_host2/footer.php
</Directory>
now, i have no header or footer defined for phpMyAdmin, which lies under
/var/www/html/phpMyAdmin/. but what happens, is that the header and
footer from my 1st virtual host are randomly included, making phpMyAdmin
look hideous, and often making it not work because it needs to place
information in the HTML Header. whether or not these files are included
seems to be quite random, tho, as it does not happen all the time. i
could log into phpMyAdmin just fine, browse through a few tables, and
then it will begin including the header and footer. another thing i've
noticed though, is that these files never get included in the Fedora
Core Apache Test Page, which lies under /var/www/html/.
i think this looks like a bug in either PHP or Apache... any ideas?
thanks!
--- End Message ---
--- Begin Message ---
Yeah, probably a config leak in the Apache2 sapi module. There is a
reason we don't suggest using PHP with Apache2 yet. Use Apache1 and I bet
you won't have any problems.
-Rasmus
On Sat, 13 Mar 2004, Chris Wagner wrote:
> hi,
>
> i'm running a server with Fedora Core 1. this is using Apache 2.0.48
> and PHP 4.3.4.
>
> i have my http server root at /var/www/html/. i have some virtual hosts
> setup.
>
> i've just installed phpMyAdmin 2.5.6. my problem lies within the
> auto_prepend_file and auto_append_file directives provided by PHP. i
> have no default prepended or appended files, but have these directives
> set up for each virtual host. so, the section of my httpd.conf file
> that takes care of this, looks like so:
>
> <Directory "/var/www/html/virtual_host1">
> php_value auto_prepend_file /var/www/html/virtual_host1/header.php
> php_value auto_append_file /var/www/html/virtual_host1/footer.php
> </Directory>
>
> <Directory "/var/www/html/virtual_host2">
> php_value auto_prepend_file /var/www/html/virtual_host2/header.php
> php_value auto_append_file /var/www/html/virtual_host2/footer.php
> </Directory>
>
>
> now, i have no header or footer defined for phpMyAdmin, which lies under
> /var/www/html/phpMyAdmin/. but what happens, is that the header and
> footer from my 1st virtual host are randomly included, making phpMyAdmin
> look hideous, and often making it not work because it needs to place
> information in the HTML Header. whether or not these files are included
> seems to be quite random, tho, as it does not happen all the time. i
> could log into phpMyAdmin just fine, browse through a few tables, and
> then it will begin including the header and footer. another thing i've
> noticed though, is that these files never get included in the Fedora
> Core Apache Test Page, which lies under /var/www/html/.
>
> i think this looks like a bug in either PHP or Apache... any ideas?
>
> thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---