php-general Digest 17 Apr 2007 18:10:27 -0000 Issue 4740
Topics (messages 253096 through 253115):
Re: Problems when trying to use ibm_db2 extension
253096 by: Leo Jokinen
253097 by: Leo Jokinen
Re: [PHP-DB] Re: Problems when trying to use ibm_db2 extension
253098 by: David Mitchell
echo or print ?
253099 by: Christian Haensel
253100 by: clive
253101 by: heavyccasey.gmail.com
253102 by: Dimiter Ivanov
253103 by: Christian Haensel
Re: isset
253104 by: Tim
253105 by: Stut
253106 by: Robert Cummings
Re: Protecting individual files/dirs from access
253107 by: tedd
Re: WWE in Stamford, CT needs a kick ass PHP Developer!
253108 by: Jochem Maas
253109 by: Tim
redirect with header still not working
253110 by: Ross
253111 by: Dave Goodchild
253112 by: Jim Moseby
253113 by: Dave Goodchild
253114 by: Al
253115 by: Jim Lucas
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 ---
Problem solved:
I restarted my computer and after that apache loaded ibm_db2 extension.
My conclusion:
1. When you add some extensions to php.ini, you need to restart windows
in order to get those extensions available through apache
2. However, those extensions are instantly available if you use php
command line interface
Anyone disagree?
-Leo-
Leo Jokinen wrote:
Hi all,
I've been banging my head into the wall cause I can't get ibm_db2
extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).
(Operating system is winxp pro SP2)
For some reason, this code is working on command line but not when
placed to htdocs folder:
<?php
if(function_exists('db2_connect')) {
echo 'Function db2_connect() exists';
} else {
echo 'Unknown function db2_connect()';
exit;
}
echo "\nTrying to connect DB2 database..\n";
$database = 'services';
$user = 'db2admin';
$password = 'xxx';
$hostname = '127.0.0.1';
$port = 50000;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');
if ($conn) {
echo "OK: Connection established\n";
db2_close($conn);
} else {
echo "ERROR: Connection failed\n";
}
?>
Command line output:
C:\>php c:\db2_test.php
Function db2_connect() exists
Trying to connect DB2 database..
OK: Connection established
Web output:
Unknown function db2_connect()
Some extra output:
Fatal error: Call to undefined function db2_connect() in
F:\www\services.itella.net\app\webroot\index.php on line 57
Also, phpinfo() won't say nothing that module ibm_db2 is in use
More info:
php_ibm_db2.dll file is in folder C:/php-5.2.1/ext
php.ini:
extension_dir = "C:/php-5.2.1/ext"
extension=php_ibm_db2.dll
httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
PHPIniDir "C:/php-5.2.1/"
Can someone point out the right direction for me?
Regards
Leo Jokinen
--- End Message ---
--- Begin Message ---
Problem solved:
I restarted my computer and after that apache loaded ibm_db2 extension.
My conclusion:
1. When you add some extensions to php.ini, you need to restart windows
in order to get those extensions available through apache
2. However, those extensions are instantly available if you use php
command line interface
Anyone disagree?
-Leo-
Leo Jokinen wrote:
Hi all,
I've been banging my head into the wall cause I can't get ibm_db2
extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).
(Operating system is winxp pro SP2)
For some reason, this code is working on command line but not when
placed to htdocs folder:
<?php
if(function_exists('db2_connect')) {
echo 'Function db2_connect() exists';
} else {
echo 'Unknown function db2_connect()';
exit;
}
echo "\nTrying to connect DB2 database..\n";
$database = 'services';
$user = 'db2admin';
$password = 'xxx';
$hostname = '127.0.0.1';
$port = 50000;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');
if ($conn) {
echo "OK: Connection established\n";
db2_close($conn);
} else {
echo "ERROR: Connection failed\n";
}
?>
Command line output:
C:\>php c:\db2_test.php
Function db2_connect() exists
Trying to connect DB2 database..
OK: Connection established
Web output:
Unknown function db2_connect()
Some extra output:
Fatal error: Call to undefined function db2_connect() in
F:\www\services.itella.net\app\webroot\index.php on line 57
Also, phpinfo() won't say nothing that module ibm_db2 is in use
More info:
php_ibm_db2.dll file is in folder C:/php-5.2.1/ext
php.ini:
extension_dir = "C:/php-5.2.1/ext"
extension=php_ibm_db2.dll
httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
PHPIniDir "C:/php-5.2.1/"
Can someone point out the right direction for me?
Regards
Leo Jokinen
--- End Message ---
--- Begin Message ---
I'd say that on Windows, when you, or software you install, modifies the
PATH environment variable, and a service, like apache, relies on a directory
being in the path, you have to restart Windows in order for that service to
"see" the new path.
In other words, services get the new path only after you reboot.
Dave
On 4/16/07, Leo Jokinen <[EMAIL PROTECTED]> wrote:
Problem solved:
I restarted my computer and after that apache loaded ibm_db2 extension.
My conclusion:
1. When you add some extensions to php.ini, you need to restart windows
in order to get those extensions available through apache
2. However, those extensions are instantly available if you use php
command line interface
Anyone disagree?
-Leo-
Leo Jokinen wrote:
> Hi all,
>
> I've been banging my head into the wall cause I can't get ibm_db2
> extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).
> (Operating system is winxp pro SP2)
>
> For some reason, this code is working on command line but not when
> placed to htdocs folder:
>
>> <?php
>> if(function_exists('db2_connect')) {
>> echo 'Function db2_connect() exists';
>> } else {
>> echo 'Unknown function db2_connect()';
>> exit;
>> }
>>
>> echo "\nTrying to connect DB2 database..\n";
>>
>> $database = 'services';
>> $user = 'db2admin';
>> $password = 'xxx';
>> $hostname = '127.0.0.1';
>> $port = 50000;
>> $conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
>>
>>
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
>> $conn = db2_connect($conn_string, '', '');
>>
>> if ($conn) {
>> echo "OK: Connection established\n";
>> db2_close($conn);
>> } else {
>> echo "ERROR: Connection failed\n";
>> }
>> ?>
>
> Command line output:
>> C:\>php c:\db2_test.php
>> Function db2_connect() exists
>> Trying to connect DB2 database..
>> OK: Connection established
>
> Web output:
>> Unknown function db2_connect()
>
> Some extra output:
>> Fatal error: Call to undefined function db2_connect() in
>> F:\www\services.itella.net\app\webroot\index.php on line 57
>
> Also, phpinfo() won't say nothing that module ibm_db2 is in use
>
> More info:
>
> php_ibm_db2.dll file is in folder C:/php-5.2.1/ext
>
> php.ini:
> extension_dir = "C:/php-5.2.1/ext"
> extension=php_ibm_db2.dll
>
> httpd.conf:
> AddType application/x-httpd-php .php
> LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
> PHPIniDir "C:/php-5.2.1/"
>
>
> Can someone point out the right direction for me?
>
> Regards
>
> Leo Jokinen
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Good morning fellow coders
I've been working with PHP for a little over 5 years now, and it even got me
a cute office and a good salary... but even though I can make a living off
of it, I am still wondering about a few little things.
Whenever I see people put their code up for review, I realize they mostly
use print instead of echo, while I am using echo 99% of the time. Actually,
I can't even remember when I last used the regular print.
What do you guys use, and what is the advantage (if ther is any) of print
over echo? And I am not talking about print_r or anything, just the regular
print. :o)
All the best!
Chris
--------------------
Christian Haensel
/voodoo.css
#GeorgeWBush { position:absolute; bottom:-6ft; }
--- End Message ---
--- Begin Message ---
What do you guys use, and what is the advantage (if ther is any) of
print over echo? And I am not talking about print_r or anything, just
the regular print. :o)
print returns a result, echo doesn't. This makes echo slightly faster
than print, but I doubt theres any significant speed improvement using
echo instead of print.
I use echo, but thats just because its a habit.
--
Regards,
Clive.
{No electrons were harmed in the creation, transmission or reading of
this email. However, many were excited and some may well have enjoyed
the experience.}
--- End Message ---
--- Begin Message ---
Me too. I use echo. Print is a function.
There's no significant difference between them. My advice: choose one,
and stick with it.
On 4/16/07, clive <[EMAIL PROTECTED]> wrote:
> What do you guys use, and what is the advantage (if ther is any) of
> print over echo? And I am not talking about print_r or anything, just
> the regular print. :o)
print returns a result, echo doesn't. This makes echo slightly faster
than print, but I doubt theres any significant speed improvement using
echo instead of print.
I use echo, but thats just because its a habit.
--
Regards,
Clive.
{No electrons were harmed in the creation, transmission or reading of
this email. However, many were excited and some may well have enjoyed
the experience.}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 4/17/07, Christian Haensel <[EMAIL PROTECTED]> wrote:
Good morning fellow coders
I've been working with PHP for a little over 5 years now, and it even got me
a cute office and a good salary... but even though I can make a living off
of it, I am still wondering about a few little things.
Whenever I see people put their code up for review, I realize they mostly
use print instead of echo, while I am using echo 99% of the time. Actually,
I can't even remember when I last used the regular print.
What do you guys use, and what is the advantage (if ther is any) of print
over echo? And I am not talking about print_r or anything, just the regular
print. :o)
There is a link in the manual about the difference between those two:
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
--- End Message ---
--- Begin Message ---
Thanks mate, that clarifies that. And now I know why I use echo all the time
*g*
Have a great day,... greetings from sunny germany :o)
Chris
----- Original Message -----
From: "Dimiter Ivanov" <[EMAIL PROTECTED]>
To: "Christian Haensel" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 17, 2007 9:48 AM
Subject: Re: [PHP] echo or print ?
On 4/17/07, Christian Haensel <[EMAIL PROTECTED]> wrote:
Good morning fellow coders
I've been working with PHP for a little over 5 years now, and it even got
me
a cute office and a good salary... but even though I can make a living
off
of it, I am still wondering about a few little things.
Whenever I see people put their code up for review, I realize they mostly
use print instead of echo, while I am using echo 99% of the time.
Actually,
I can't even remember when I last used the regular print.
What do you guys use, and what is the advantage (if ther is any) of print
over echo? And I am not talking about print_r or anything, just the
regular
print. :o)
There is a link in the manual about the difference between those two:
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
--- End Message ---
--- Begin Message ---
<snip>
> > The count is maintained internally as items are
> added/removed, and it
> > is an O(1) operation for PHP to "count" the array, as it
> already knows
> > the answer and just returns it.
</snip>
Hi nothing to do with the actual topic, i am just wondering how you get this
"internals" information you all seem to know so much about, it is very
interesting and i'd like to add it to some of my "late night" reading if
possible :)
Regards,
Tim
--- End Message ---
--- Begin Message ---
Tim wrote:
<snip>
The count is maintained internally as items are
added/removed, and it
is an O(1) operation for PHP to "count" the array, as it
already knows
the answer and just returns it.
</snip>
Hi nothing to do with the actual topic, i am just wondering how you get this
"internals" information you all seem to know so much about, it is very
interesting and i'd like to add it to some of my "late night" reading if
possible :)
Just guessing, but I'd say probably the source code. That's where most
of the internals of PHP are documented. ;)
-Stut
--- End Message ---
--- Begin Message ---
On Tue, 2007-04-17 at 13:14 +0100, Stut wrote:
> Tim wrote:
> > <snip>
> >>> The count is maintained internally as items are
> >> added/removed, and it
> >>> is an O(1) operation for PHP to "count" the array, as it
> >> already knows
> >>> the answer and just returns it.
> > </snip>
> >
> > Hi nothing to do with the actual topic, i am just wondering how you get this
> > "internals" information you all seem to know so much about, it is very
> > interesting and i'd like to add it to some of my "late night" reading if
> > possible :)
>
> Just guessing, but I'd say probably the source code. That's where most
> of the internals of PHP are documented. ;)
Several sources... the C source code as Stut has presumed :) Also from
reading the PHP-DEV list where the source is often discussed.
Additionally, some of it is from my early Computer Science background
where there's a large focus on data structures and algorithms.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
At 6:24 PM -0500 4/16/07, Richard Lynch wrote:
index.php is also accessible, if I can guess the login, which I did on
my first try...
Well, I did provide the log on and password on a subsequent post.
BUT, I didn't try to make it hard to guess, that wasn't the point of
the post. I was trying to see what files were considered "secure" and
what files weren't.
---
I can then visit b.php and auth.php, which do not seem to generate
output.
As you said "PHP code is executed completely out of context, in a manner you
have never ever tested at all...."
So, I try to make my include scripts produce nothing when called
independently. I've seen techniques where a token must be correct
before running, but I just make my includes dependant upon variables
in the calling script.
---
If you put the stuff you want to keep private OUTSIDE the web-tree,
and provide a PHP gate-keeper to get to it, you reduce your risk.
I'm sorry, I should know this, but I don't.
You see, I work totally in hosted environments. They provide me with
several folders from "anon.ftp" to "web_users" (including a "private"
folder).
I start building from inside httpdocs folder where I place an
index.php file and then branch out from there. Now, where is "OUTSIDE
the web-tree"?
It's a lot harder to screw up bad enough to configure Apache to start
serving up files directly from a "private" directory.
I have a "private" directory, but if I place files in it, I can't
read them via php -- I get a:
Warning: fopen(): open_basedir restriction in effect.
I've read how one can turn that off, but I have not been successful
in doing so.
---
PPS Nice photo! :-)
http://sperling.com/a/pw/girl.jpg
Now you got me going, how did you get that? Even my php scripts can't read it.
Or are you putting me on? Send me a copy of it back-channel. :-)
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
> On Fri, April 13, 2007 8:14 pm, Robert Cummings wrote:
>>>> peacepipe in one hand, broadsword in the other - lets hack on :-)
>>> ***BIG SMILE***
>> And WHAT are you smiling at??? Staves beat peacepipes and broadswords
>> anyday!
>
> Maybe he's smiling because of what's IN his peacepipe... :-)
>
> That was my assumption when I first read it...
>
> But maybe I've just hung out with too many stoner musicians... :-v
>
... huh?
... what?
... do somebody say something?
;-)
--- End Message ---
--- Begin Message ---
> -----Message d'origine-----
> De : Jochem Maas [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 17 avril 2007 16:19
> À : [EMAIL PROTECTED]
> Cc : Robert Cummings; Tim; 'Jarrel Cobb'; 'tedd';
> [EMAIL PROTECTED]
> Objet : Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
>
> Richard Lynch wrote:
> > On Fri, April 13, 2007 8:14 pm, Robert Cummings wrote:
> >>>> peacepipe in one hand, broadsword in the other - lets hack on :-)
> >>> ***BIG SMILE***
> >> And WHAT are you smiling at??? Staves beat peacepipes and
> broadswords
> >> anyday!
> >
> > Maybe he's smiling because of what's IN his peacepipe... :-)
Does this shock you?
> > That was my assumption when I first read it...
> >
> > But maybe I've just hung out with too many stoner musicians... :-v
> >
Just musicians? ;P
>
>
>
> ... huh?
>
>
> ... what?
>
>
> ... do somebody say something?
>
> ;-)
I didn't think you could fit peacepipe and broadsword in the same
sentence... I geuss so... :P
--- End Message ---
--- Begin Message ---
Right,
Have tried the full url for the header and it still doesn't work. I may have
to resort to...javacript redirects unless someone can suggest a way around
it.
Here is the phpinfo();
http://s202801613.websitehome.co.uk/info.php
Is is 1and1 hosting if anyone had had any experience of them.
thanks,
R.
--- End Message ---
--- Begin Message ---
Can you re-iterate what is happening - I have a site with 1and1 and use
header() with no issues.
--- End Message ---
--- Begin Message ---
>
> Have tried the full url for the header and it still doesn't
> work. I may have
> to resort to...javacript redirects unless someone can suggest
> a way around
> it.
>
> Here is the phpinfo();
>
> http://s202801613.websitehome.co.uk/info.php
>
>
> Is is 1and1 hosting if anyone had had any experience of them.
>
> thanks,
>
>
> R.
I have several sites with 1and1, and I use header() with no problems. The
main issue I have run into with header() is that your script can produce NO
OUTPUT prior to the header() call. Not even a whitespace, else header()
will not work.
JM
--- End Message ---
--- Begin Message ---
That is, unless you use output buffering. It may not be the most elegant
solution (using header() to redirect users increases server calls), but I
built a template-driven php site that calls:
<?php ob_start; ?>
...depending on certain conditions which means I can then use header() even
after I have started output.
--- End Message ---
--- Begin Message ---
Read about output buffering, it's your solution and well worth time learning
about.
Ross wrote:
Right,
Have tried the full url for the header and it still doesn't work. I may have
to resort to...javacript redirects unless someone can suggest a way around
it.
Here is the phpinfo();
http://s202801613.websitehome.co.uk/info.php
Is is 1and1 hosting if anyone had had any experience of them.
thanks,
R.
--- End Message ---
--- Begin Message ---
Ross wrote:
Right,
Have tried the full url for the header and it still doesn't work. I may have
to resort to...javacript redirects unless someone can suggest a way around
it.
Here is the phpinfo();
http://s202801613.websitehome.co.uk/info.php
Is is 1and1 hosting if anyone had had any experience of them.
thanks,
R.
if you look at your error_report setting. is it 2037
somebody correct me if I am wrong, but isn't this setting
I ran this on my older system and found that
(E_ALL & ~E_NOTICE & ~E_WARNING) all together = 2037
so, even though you have display_errors turned on, it isn't going to show them.
you need to set this to just E_ALL
<?php
error_reporting(E_ALL);
...
?>
This should solve your problem
--
Enjoy,
Jim Lucas
Different eyes see different things. Different hearts beat on different strings. But there are times
for you and me when all such things agree.
- Rush
--- End Message ---