|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 14 Mar 2005 22:27:09 -0000 Issue 3338
php-general-digest-help
lists.php.net
Date: Mon Mar 14 2005 - 16:27:09 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 14 Mar 2005 22:27:09 -0000 Issue 3338
Topics (messages 210650 through 210706):
Re: PHP causes Apache segmentation fault?
210650 by: Burhan Khalid
210651 by: John Swartzentruber
210672 by: Richard Lynch
210677 by: John Swartzentruber
210679 by: Richard Lynch
newbie:changing variable to type resource
210652 by: Saswat Praharaj
210671 by: Richard Lynch
password Boxes
210653 by: Ross Hulford
210655 by: trlists.clayst.com
210658 by: Dotan Cohen
210662 by: Jochem Maas
210663 by: trlists.clayst.com
210670 by: Richard Lynch
210697 by: Dotan Cohen
210699 by: Jochem Maas
Re: PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled
210654 by: Evert | Rooftop Solutions
Classes code completion and Zend Studio
210656 by: Zareef Ahmed
210669 by: Richard Lynch
210680 by: Zareef Ahmed
210681 by: Zareef Ahmed
210682 by: Jamie Alessio
REMOTE_ADDR
210657 by: Niels Riis Kristensen
210668 by: Richard Lynch
210676 by: Rasmus Lerdorf
Re: Eliminating CLI overhead
210659 by: Jason Barnett
210674 by: Richard Lynch
Re: inserting arabic into mysql
210660 by: Jason Barnett
210664 by: Christophe Chisogne
Re: eregi expression for checking a domain
210661 by: Jason Barnett
Re: PHP5 & JBOSS
210665 by: Jason Barnett
Migration from php4 to php 5 open_basedir directive.
210666 by: Craig Lewis
210696 by: Jochem Maas
Re: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled
210667 by: Edin Kadribasic
210684 by: Greg Beaver
210685 by: Greg Beaver
Re: Mailing List
210673 by: Richard Lynch
Re: incrementing a number from a text file
210675 by: Richard Lynch
Referencing different static members in
210678 by: André Pletschette
multidimensional array sort
210683 by: Ashley M. Kirchner
210686 by: Leif Gregory
Re: PHP causes Apache segmentation fault? [SOLVED]
210687 by: John Swartzentruber
file/array manipulation
210688 by: Mignon Hunter
210689 by: Mignon Hunter
Class/object storing itself in a database
210690 by: Chris Boget
210691 by: Robby Russell
Re: HELP TO GET OUT OF PHP MAILING LIST
210692 by: Brian Dunning
Re: php 4 & php 5
210693 by: mbneto
210701 by: Richard Lynch
210703 by: Jason Barnett
Directory and file permissions on a virtual host
210694 by: Al
210700 by: Richard Lynch
Re: bulk emailer
210695 by: Redmond Militante
210698 by: Redmond Militante
210704 by: Manuel Lemos
210706 by: Pedro Luis Cruz Riguetti
can't pull products from DB with REGEXP?
210702 by: afan.afan.net
long mysql_connect times
210705 by: Dan Tappin
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
John Swartzentruber wrote:
> On 3/13/2005 3:55 PM John Swartzentruber wrote:
>
>> On 3/11/2005 11:57 AM John Swartzentruber wrote:
>>
>>>>> I am running Fedora core3 with Apache 2.0.52 (from default RPMs),
>>>>> MySQL 4.1.10 (from RPMs from MySQL site), and PHP 5.0.3 built from
>>>>> source.
>>>>>
>>>>> I'm going through the PHP manual and trying some of the mysqli
>>>>> examples. The last one I tried didn't work. The problem appears to
>>>>> be this line:
>>>>>
>>>>> $row = $result->fetch_array(MYSQLI_ASSOC);
>>>>>
>>>>> Using MYSQLI_BOTH also fails, and MYSQLI_NUM works.
>>>>>
>>>>> This is what is in my httpd error log:
>>>>>
>>>>> [Thu Mar 10 17:07:06 2005] [notice] child pid 29903 exit signal
>>>>> Segmentation fault (11)
>>
>>
>>
>> I've reported this as a PHP bug and then continued to do some more
>> research. What I'm finding is very odd.
>>
>> When I run this script under apache, it appears that there is a clash
>> between the structures used in a MySQL library and what is in the
>> mysql.h header file. When I do a phpinfo(), it says that my mysqli
>> client API version is "3.23.58". That seems wrong. I have MySQL
>> 4.1.10a installed. This version difference *could* explain the
>> difference, but I have no idea why it would be using the old version.
>> The libmysql libraries and programs are all dated March 9, 2005 or
>> later. The --with-mysqli configure parameter points to a mysql_config
>> program with that date. Why would it think it was using an older API?
>>
>> Another very weird thing is that when I run the script directly from
>> the command line, the structure looks good and has all of the correct
>> (i.e., expected) values. What is different about running PHP from the
>> command line and from Apache that would cause it to use different
>> MySQL structures?
>
>
> Sorry to reply to myself, but here's the succinct question:
>
> When I run phpinfo(), it says my mysqli API client version is 3.23.58.
> When I run "php -i" from the command line it says it is 4.1.10a. The
> latter is correct. What would cause the discrepancy? The server has been
> stopped and started many times, and PHP rebuilt a few times, so it isn't
> a browser buffer issue.
For the love of all that is holy, please don't send repeat messages to
the list!!
Are you sure you built both the client and the server module versions?
It seems only your cli build is using the new API.
attached mail follows:
On 3/14/2005 6:03 AM Burhan Khalid wrote:
> John Swartzentruber wrote:
>
>> When I run phpinfo(), it says my mysqli API client version is 3.23.58.
>> When I run "php -i" from the command line it says it is 4.1.10a. The
>> latter is correct. What would cause the discrepancy? The server has
>> been stopped and started many times, and PHP rebuilt a few times, so
>> it isn't a browser buffer issue.
>
>
> For the love of all that is holy, please don't send repeat messages to
> the list!!
I didn't. I have no idea why that came through twice. Believe me, it
annoyed me more than it annoyed you. Or are you saying I should not have
replied to myself to provide the additional information? When I
discovered that, it seemed significant in terms of tracking down the
problem, so I didn't see any reason to wait to provide it. I've been
trying to track down these problems off and on for a couple months and
I'm growing impatient (not with you or other people trying to help me,
just in general).
> Are you sure you built both the client and the server module versions?
> It seems only your cli build is using the new API.
Built both client and server module versions of what? I installed MySQL
from RPMs, and installed all of the available packages (client, server,
devel, libraries, bench). PHP, I built using a slightly modified version
of the options that were in the version 4 RPM. My settings are available
at http://john.swartzentruber.us/test.php. I'm currently running
5.04-dev because I ran the most recent stable CVS version before
reporting the bug.
attached mail follows:
> When I run phpinfo(), it says my mysqli API client version is 3.23.58.
> When I run "php -i" from the command line it says it is 4.1.10a. The
> latter is correct. What would cause the discrepancy? The server has been
> stopped and started many times, and PHP rebuilt a few times, so it isn't
> a browser buffer issue.
Well, you've identified your problem.
Your RPMs are all screwed up (no surprise there) and the PHP_MySQL Module
is on version 3.23.58 but you are actually running MySQL 4.1.10a
Most likely, you didn't UNINSTALL the previous version of MySQL before you
installed PHP at some point.
You'll have to either switch to building from source, so you actually know
what's going on, or un-install everything (PHP, MySQL, etc) and then
re-install and hope the RPM maintainers have things right.
attached mail follows:
On 3/14/2005 12:22 PM Richard Lynch wrote:
>>When I run phpinfo(), it says my mysqli API client version is 3.23.58.
>>When I run "php -i" from the command line it says it is 4.1.10a. The
>>latter is correct. What would cause the discrepancy? The server has been
>>stopped and started many times, and PHP rebuilt a few times, so it isn't
>>a browser buffer issue.
>
>
> Well, you've identified your problem.
>
> Your RPMs are all screwed up (no surprise there) and the PHP_MySQL Module
> is on version 3.23.58 but you are actually running MySQL 4.1.10a
Where does the PHP_MySQL Module come from? Is that part of PHP or MySQL?
I would think that it is from PHP and would be built when I build PHP. I
have --with-mysqli pointing to a version of mysql_config that has the
correct version.
> Most likely, you didn't UNINSTALL the previous version of MySQL before you
> installed PHP at some point.
I uninstalled all of the MySQL RPMs except for the shared libraries,
which I upgraded. The problem with uninstalling that one is that there
is a dependency in dovecot and I don't want to uninstall my mail system.
> You'll have to either switch to building from source, so you actually know
> what's going on, or un-install everything (PHP, MySQL, etc) and then
> re-install and hope the RPM maintainers have things right.
PHP I'm already building from Source. Uninstalling all of MySQL doesn't
seem to be an option because of that dovecot dependency.
What I'd really like to know (among so many other things) is how
configure is determining which MySQL it should use. Also knowing the
difference between PHP via a browser (via apache) and PHP on the command
line would give me some clues. I don't understand why the client API
version for mysqli is different according to how PHP is accessed.
attached mail follows:
> PHP I'm already building from Source. Uninstalling all of MySQL doesn't
> seem to be an option because of that dovecot dependency.
>
> What I'd really like to know (among so many other things) is how
> configure is determining which MySQL it should use. Also knowing the
> difference between PHP via a browser (via apache) and PHP on the command
> line would give me some clues. I don't understand why the client API
> version for mysqli is different according to how PHP is accessed.
Suppose, just for the sake of argument, that your Apache had
mod_auth_mysql compiled into it.
Also suppose, for the sake of argument, that it was on version MySQL 3
when you did that.
When you try to compile PHP, it *CANNOT* use MySQL 4 in the PHP Module, or
Apache's mod_auth_mysql would get all fargled up.
The CLI version, however, does not have that constraint.
*MAYBE* configure is smart enough to figure this kind of stuff out, and
that's why you got what you got.
More likely, you've still got MySQL 3 installed somewhere on your system.
If you're not willing to un-install that, and configure isn't finding the
version you want to use, then start reading/hacking the Makefiles that
configure builds.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Hi All,
I am new to PHP, stuck with a problem and need your help.
I would like to change a variable to type resource.
I searched in php.net and in google but did not find anything helpful.
Now , why I would like to do that...
I am writing a socket application which will accept connection from
browser,receive data and write the data sent by browser into another
open socket.Receive data from the open socket and write it back to the
browser.
When there are more than one client(browser) connecting to my program
,I am saving the connection information (socket ID)for browser
connections in a plain text file.
I intend to retrive the socket ID information and do a
socket_write(..) with socket ID as the first parameter, but I am
getting an error that I cant convert any type to a resource type. Is
there any workaround ??
Is it going to help me if I use session information ?
I am not using apache.
I may be wrongly designing the program.
Would appreciate all your suggestion and help.
Thanks,
-Saswat
attached mail follows:
> I am new to PHP, stuck with a problem and need your help.
>
> I would like to change a variable to type resource.
> I searched in php.net and in google but did not find anything helpful.
>
> Now , why I would like to do that...
>
> I am writing a socket application which will accept connection from
> browser,receive data and write the data sent by browser into another
> open socket.Receive data from the open socket and write it back to the
> browser.
>
> When there are more than one client(browser) connecting to my program
> ,I am saving the connection information (socket ID)for browser
> connections in a plain text file.
>
> I intend to retrive the socket ID information and do a
> socket_write(..) with socket ID as the first parameter, but I am
> getting an error that I cant convert any type to a resource type. Is
> there any workaround ??
>
> Is it going to help me if I use session information ?
>
> I am not using apache.
>
> I may be wrongly designing the program.
The design just maybe might be fine in theory, but in practice...
A socket connection can't be shared across PHP instances, I don't think.
Certainly not by writing the resource into a text file.
You *MIGHT* be able to write the resource into shared memory
http://php.net/shmop but I doubt that will work at all, and even if it
does, having two programs reading/writing the same socket resource at one
time sounds like a recipie for disaster.
Why do you want to share this socket across two PHP programs?
What exactly are you doing?
I suspect that the design is not right, even in theory, but can't be sure.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Does anyone know how to change the style of password boxes so when the
characters are entered an asterisk appears rather that a smal circle?
Or is this just determed by the OS and uncangable with CSS or Javascript of
PHP?
R.
attached mail follows:
On 14 Mar 2005 Ross Hulford wrote:
> Does anyone know how to change the style of password boxes so when
> the characters are entered an asterisk appears rather that a smal
> circle?
It is determined by the browser and OS. I presume you are talking
about Windows XP, which is where I see that behavior. You might try
use a CSS entry or "style=" to change the font for the input box to
Courier and see if it behaves differently.
--
Tom
attached mail follows:
On Mon, 14 Mar 2005 08:37:04 -0500, trlists
clayst.com
<trlists
clayst.com> wrote:
> On 14 Mar 2005 Ross Hulford wrote:
>
> > Does anyone know how to change the style of password boxes so when
> > the characters are entered an asterisk appears rather that a smal
> > circle?
>
> It is determined by the browser and OS. I presume you are talking
> about Windows XP, which is where I see that behavior. You might try
> use a CSS entry or "style=" to change the font for the input box to
> Courier and see if it behaves differently.
>
> --
> Tom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
change
<input type='text' name='name'/>
To:
<input type='password' name='name'>
This is an HTML related question, not php (or even javascript). Next
time try google.
Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com
attached mail follows:
Dotan Cohen wrote:
> On Mon, 14 Mar 2005 08:37:04 -0500, trlists
clayst.com
> <trlists
clayst.com> wrote:
>
>>On 14 Mar 2005 Ross Hulford wrote:
>>
>>
>>>Does anyone know how to change the style of password boxes so when
>>>the characters are entered an asterisk appears rather that a smal
>>>circle?
>>
>>It is determined by the browser and OS. I presume you are talking
>>about Windows XP, which is where I see that behavior. You might try
>>use a CSS entry or "style=" to change the font for the input box to
>>Courier and see if it behaves differently.
>>
>>--
>>Tom
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> change
> <input type='text' name='name'/>
>
> To:
> <input type='password' name='name'>
>
> This is an HTML related question, not php (or even javascript). Next
> time try google.
yeah ... but next time read the question before you answer ;-)
the guy was wondering how to change which character was used as
the mask in password fields - normally its an asterisk, if
you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
it shows a small (filled) circle instead... earth-shattering.
:-)
>
> Dotan Cohen
> http://English-Lyrics.com
> http://Song-Lyriks.com
>
attached mail follows:
On 14 Mar 2005 Dotan Cohen wrote:
> change
> <input type='text' name='name'/>
>
> To:
> <input type='password' name='name'>
This does not address the question. The OP saw small dots in the
password display, he wanted asterisks. That is not because he was
using type='text' but because he was already using type='password' and
the browser had a particular way of displaying characters in such
fields, which he wanted to change.
> This is an HTML related question, not php (or even javascript). Next
> time try google.
Really it is a browser implementation question, not even HTML. But in
any case, I am not the person who asked the question. You may want to
direct your advice to them.
People get confused all the time about what is happening on the server
side and what is on the client side. This poster asked specifically
whether the issue could be addressed in PHP or was (in his terms) an
"OS issue". I don't think knowing the answer to that question is a
prerequisite for posting here.
--
Tom
attached mail follows:
> Does anyone know how to change the style of password boxes so when the
> characters are entered an asterisk appears rather that a smal circle?
>
> Or is this just determed by the OS and uncangable with CSS or Javascript
> of
> PHP?
They are certainly NOT changeable with PHP.
I doubt that JavaScript holds the answer either.
You might, however, find an HTML ATTRIBUTE supported by some browsers that
allows you to change the character used. I doubt it, but it's possible.
If it is possible, presumably CSS allows you to change the attribute as
well, though you never know for sure with CSS...
For sure, whatever you do find, it ain't something that's standard across
all browsers. But you may only care about the one browser that uses the
small circles anyway.
Why in the world do you WANT to change it? [puzzled]
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, 14 Mar 2005 16:25:32 +0100, Jochem Maas <jochem
iamjochem.com> wrote:
>
> yeah ... but next time read the question before you answer ;-)
> the guy was wondering how to change which character was used as
> the mask in password fields - normally its an asterisk, if
> you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
> it shows a small (filled) circle instead... earth-shattering.
>
> :-)
>
I stand corrected! As a Fedora user, I have never seen those circles,
so I did fully understand the question. And, being OT, maybe a
personal email to the OP would have been better, but for the archives
I opted to answer on-list.
Would I be cynical if I suggested a different solution to the problem?
http://www.mozilla.org/products/firefox/
Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com
attached mail follows:
Dotan Cohen wrote:
> On Mon, 14 Mar 2005 16:25:32 +0100, Jochem Maas <jochem
iamjochem.com> wrote:
>
>>yeah ... but next time read the question before you answer ;-)
>>the guy was wondering how to change which character was used as
>>the mask in password fields - normally its an asterisk, if
>>you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
>>it shows a small (filled) circle instead... earth-shattering.
>>
>>:-)
>>
>
>
> I stand corrected! As a Fedora user, I have never seen those circles,
> so I did fully understand the question. And, being OT, maybe a
> personal email to the OP would have been better, but for the archives
> I opted to answer on-list.
cool.
>
> Would I be cynical if I suggested a different solution to the problem?
> http://www.mozilla.org/products/firefox/
that's anything but cynical :-)
besides if you are developing web stuff you probably should be
running a number of diff. browsers regulary?
>
>
> Dotan Cohen
> http://English-Lyrics.com
> http://Song-Lyriks.com
>
attached mail follows:
Zeev Suraski wrote:
> Everyone,
>
> We've rolled initial release candidates for PHP 5.0.4 and 4.3.11. As
> usual, these 3rd digit releases include a variety of bug fixes and
> minor updates.
>
> PHP 5.0.4RC1 source:
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.bz2
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.gz
>
> PHP 4.3.11RC1 source:
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.bz2
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.gz
>
> Windows binaries will be posted and announced soon.
>
> Changes in PHP 5.0.4RC1:
> http://cvs.php.net/co.php/php-src/NEWS?r=1.1760.2.286
> Changes in PHP 4.3.11RC1:
> http://cvs.php.net/co.php/php-src/NEWS?r=1.1247.2.854
>
> Any help in testing these release candidates would be appreciated!
>
> Zeev
>
Is there a roadmap available for PHP? I have to wait for the final
release to put it live, And I've been waiting for .11 for a while. It
would be nice if there's a way to check when the next version is
expected to be released.
Thanx for your great work,
Evert
attached mail follows:
Hi All,
I have a function to load the classes and return the object.
function LoadClass($ClassName)
{
require_once("Class.$ClassName.inc");
return new $ClassName();
}
Its working fine.
But Zend Studio's Code completion is not working for this type of
object, Any hints?
Zareef Ahmed
attached mail follows:
> Hi All,
>
> I have a function to load the classes and return the object.
>
> function LoadClass($ClassName)
> {
> require_once("Class.$ClassName.inc");
> return new $ClassName();
> }
>
> Its working fine.
>
> But Zend Studio's Code completion is not working for this type of
> object, Any hints?
You could file a bug report with Zend for starters.
In the meantime, you could *maybe* set things up so that in your
development environment, you load all the classes with a static
"require_once" and then the class definitions will be there.
<?php
if ($DEVELOPMENT_SERVER){
require_once "Class.foo.inc";
require_once "Class.bar.inc";
}
?>
It will slow things down a bit, loading classes you don't need, but
hopefully Zend Studio will pick up on all the classes that way.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, 14 Mar 2005 09:03:00 -0800 (PST), Richard Lynch <ceo
l-i-e.com> wrote:
>
> > Hi All,
> >
> > I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> >
> > Its working fine.
> >
> > But Zend Studio's Code completion is not working for this type of
> > object, Any hints?
>
> You could file a bug report with Zend for starters.
>
> In the meantime, you could *maybe* set things up so that in your
> development environment, you load all the classes with a static
> "require_once" and then the class definitions will be there.
>
> <?php
> if ($DEVELOPMENT_SERVER){
> require_once "Class.foo.inc";
> require_once "Class.bar.inc";
> }
> ?>
>
> It will slow things down a bit, loading classes you don't need, but
> hopefully Zend Studio will pick up on all the classes that way.
Yes Zend Studio works fine in this way. Actually function was created
to load only needed classes at run time a PHP4 version of PHP5's
__autoload function.
zareef ahmed
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net
attached mail follows:
On Mon, 14 Mar 2005 10:28:06 -0800, Jamie Alessio
<Jamie.Alessio
ucop.edu> wrote:
> > I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> >
> > Its working fine.
> >
> > But Zend Studio's Code completion is not working for this type of
> > object, Any hints?
> >
> Zareef,
> In Zend Studio 4.0 (not sure about earlier versions) you can use a
> "class type hint" to let the editor know what type of object you are
> working with. This is especially useful when you are using factory
> methods to create objects (as I often do with PEAR DataObjects) or have
> a setup similar to the above. The documentation for this in the studio
> distribution appears to be broken because it says something like "See
> below for example" but there is actually no example (I filed a bug with
> Zend about this). Butm, if you dig through he "Quick Tips" you can find
> the example which is where I first came across it.
>
> Here's how I use it for DataObjects:
> --------------
> $user_obj =& DB_DataObject::factory('User');
> /*
var $user_obj DataObjects_User */
> $user_obj->youShouldHaveCodeCompletionNowForThisObject();
> --------------
>
> In your example it would be something like:
> --------------
> $user_obj = LoadClass('user');
> /*
var $user_obj user */
> $user_obj->youShouldHaveCodeCompletionNowForThisObject();
> --------------
Yes Jamie It works.
Thanks a lot
zareef ahmed
>
> You'll need to make sure that Zend Studio knows to look through the file
> that contains the class that you are dynamically loading. I think you
> can do this if your code is withint a "project" and you specify it with
> "Add to Project".
>
> - Jamie
>
>
--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net
attached mail follows:
> I have a function to load the classes and return the object.
>
> function LoadClass($ClassName)
> {
> require_once("Class.$ClassName.inc");
> return new $ClassName();
> }
>
> Its working fine.
>
> But Zend Studio's Code completion is not working for this type of
> object, Any hints?
>
Zareef,
In Zend Studio 4.0 (not sure about earlier versions) you can use a
"class type hint" to let the editor know what type of object you are
working with. This is especially useful when you are using factory
methods to create objects (as I often do with PEAR DataObjects) or have
a setup similar to the above. The documentation for this in the studio
distribution appears to be broken because it says something like "See
below for example" but there is actually no example (I filed a bug with
Zend about this). Butm, if you dig through he "Quick Tips" you can find
the example which is where I first came across it.
Here's how I use it for DataObjects:
--------------
$user_obj =& DB_DataObject::factory('User');
/*
var $user_obj DataObjects_User */
$user_obj->youShouldHaveCodeCompletionNowForThisObject();
--------------
In your example it would be something like:
--------------
$user_obj = LoadClass('user');
/*
var $user_obj user */
$user_obj->youShouldHaveCodeCompletionNowForThisObject();
--------------
You'll need to make sure that Zend Studio knows to look through the file
that contains the class that you are dynamically loading. I think you
can do this if your code is withint a "project" and you specify it with
"Add to Project".
- Jamie
attached mail follows:
Hi
As a relative newbie I have a problem:
I am running PHP 5 on a Apache platform (Mac) and I have just noticed
that the log I keep of ip's entering my site, is showing the internal
server ip instead of the external visitor ip.
I am using getenv("REMOTE_ADDR") and is has been working before.
Can anyone help?
Med venlig hilsen
Niels Riis Kristensen
---------------------
NRK Gruppen
- Elektronisk nodeengravering
- Webhotel
- Webdesign
- Udøvende musik
---
Send penge sikkert over Internettet!
Klik her: https://www.paypal.com/refer/pal=EAJLSE5TQELFC
attached mail follows:
> I am running PHP 5 on a Apache platform (Mac) and I have just noticed
> that the log I keep of ip's entering my site, is showing the internal
> server ip instead of the external visitor ip.
>
> I am using getenv("REMOTE_ADDR") and is has been working before.
Try $_SERVER['REMOTE_ADDR'] instead of getenv()
Not sure it will be different, but it's what I use...
It's possible your httpd.conf User is [re-]setting the environment
variable REMOTE_ADDR -- which may or may not be how Apache transmits that
to PHP -- I dunno, really.
If that doesn't help, perhaps <?php phpinfo(); ?> will help you sort out
what's what.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Richard Lynch wrote:
>>I am running PHP 5 on a Apache platform (Mac) and I have just noticed
>>that the log I keep of ip's entering my site, is showing the internal
>>server ip instead of the external visitor ip.
>>
>>I am using getenv("REMOTE_ADDR") and is has been working before.
>
>
> Try $_SERVER['REMOTE_ADDR'] instead of getenv()
getenv() is actually the more portable way to do this since there is no
guarantee that $_SERVER is enabled.
> Not sure it will be different, but it's what I use...
It won't be. getenv() first checks the server environment and if it
doesn't find the value there it checks the underlying real environment.
If getenv() doesn't find it, $_SERVER definitely won't either. This is
a var set by the web server, so if it is missing, look at the web server
for the problem.
-Rasmus
attached mail follows:
Skippy wrote:
> I intend to run a lot of PHP scripts, all the time, on a Linux machine.
> The scripts were designed for CLI environment, since they will handle
> the entire management of the machine, being started by init and then
> effectively and completely taking over.
>
> I'm wondering whether starting up the PHP interpreter for every script
> hurts performance, if there's anything I can do about it, and if possible,
> would the potential gain be noticeable? We're talking a machine in the
> range of 1 GHz CPU speed, with IDE disk drives. I've already considered
> all kinds of Linux-specific "tricks", I'm interested in the pure PHP
> aspect of the issue.
>
If you want to reduce startup overhead then you could just run PHP as a
shared Apache module. You will save the time required for the MINIT
hooks... not sure how much time you'll end up saving, but you should
notice the difference. This would be especially true if you have a lot
of extensions compiled into PHP.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
> I intend to run a lot of PHP scripts, all the time, on a Linux machine.
> The scripts were designed for CLI environment, since they will handle
> the entire management of the machine, being started by init and then
> effectively and completely taking over.
>
> I'm wondering whether starting up the PHP interpreter for every script
> hurts performance, if there's anything I can do about it, and if possible,
> would the potential gain be noticeable? We're talking a machine in the
> range of 1 GHz CPU speed, with IDE disk drives. I've already considered
> all kinds of Linux-specific "tricks", I'm interested in the pure PHP
> aspect of the issue.
You'll want to build your PHP binary lean and mean, of course, including
only the Modules you *need* for those scripts to run.
If there is some HUGE module that you need only rarely, and only for one
script, you could even compile two binaries, and only use the fat one when
you need it.
I suspect, though, that the OS will cache all of PHP binary for the most
part, and you're needlessly worrying, instead of testing/benchmarking.
Try it and see.
If all that doesn't work...
I suppose you could create a PHP script with an endless loop in it,
reading from some socket or STDIN, and which does an http://php.net/eval
on the data given to it... I really doubt that this is a Good Idea, much
less that you need it in the first place. Could be fun to try it, though.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
P80 wrote:
> I have a text area form and when I insert it into mysql I get letters like
> this:
> Ù"يبتنÙ"منبيتÙ" نيبÙ"
> بÙÅ
> Ù"بجي...
> instead of arabic letters. anything I know do to get it right?
>
> thanx in advance
You're definitely better off asking this question on a MySQL list... or
possibly even the php-db list. My uneducated guess is that you're
trying to store data in MySQL in an unsupported encoding format. I am
not sure how to fix that problem though, just throwing out an answer
since no else has responded to this thread yet.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Jason Barnett a écrit :
> trying to store data in MySQL in an unsupported encoding format.
MySQL only supports the UTF-8 encoding (of Unicode) since MySQL 4.1 IIRC
Ch.
attached mail follows:
Ross Hulford wrote:
> Does anyone know a working eregi expression for determining a domain is
> valid? don't need the http:// just looking for www.thedomain.com
>
> cheers,
>
>
> R.
parse_url()
http://php.net/manual/en/function.parse-url.php
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
David Joffrin wrote:
> Hi,
>
> I searched on the net, found a lot of articles about it... followed all
> the various one by one, tried a lot, but I am getting the famous error:
> java.lang.UnsatisfiedLinkError: no php5servlet.dll in java.library.path.
>
...
>
> I modified my application to display the java.librara.path which lists
> (of course) c:/windows/system32 path.
>
> However, I am having the message just listed above.
>
> Any clue?
I've never used JBOSS... but it's possible that php5servlet.dll is
linking to *another* php library which is not located in your path.
Check to see if there are any extensions which are supposed to be loaded
and if those libraries are available.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Hello,
I have just attempted to migrate for the first time from php4 to php5.
The problem i am having is some sort of change in how the open_basedir
directive works in php 5. I don't see much discussion about this, so I
must be doing something stupid, otherwise, I would think there would be
a lot of people bumping into this.
On both servers I have safe mode on and open_basedir directive set for
the virtual host in apache. The offending php code from the top level
file calls another php file with require_once ('path/file.php') and then
file.php in turn calls another php file require_once ('path/file2'). Its
this second require_once that causes the fatal error, in otherwords, I
can call the first file with require_once, and put just about any sort
of reasonable php code in this file, and it works, i.e. its included in
the origional file. When the called file, calls another file, in php 5,
I get an error,
==========================================
Warning: main() [function.main]: open_basedir restriction in effect.
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3
Warning: main(config/_config.inc.php) [function.main]: failed to open
stream: Operation not permitted in
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3
Fatal error: main() [function.require]: Failed opening required
'config/_config.inc.php'
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3
============================================
The code and paths are unchanged, works on php4, not on php5, apache
version unchanged. (1.3.x). I have tried various php.ini files, of
course turning open_basedir off will make the error go away. The file
being called is clearly within the scope of the open_basedir
restriction, and thus it works just fine in php4.
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the
correct path to the file, I guess because it doesn't find the file in
the . (dot) part of the include path, then it blows up when it tries to
find the file in (what is basically) /usr/local/lib/php.
This kind of sounds like a TRANSPATH related problem, and its certainly
a path problem (where is dot), but as I read the docs, TRANSPATH is
something that changed for apache 2.
Any advice would be appreciated.
CL
attached mail follows:
Craig Lewis wrote:
> Hello,
>
> I have just attempted to migrate for the first time from php4 to php5.
> The problem i am having is some sort of change in how the open_basedir
> directive works in php 5. I don't see much discussion about this, so I
> must be doing something stupid, otherwise, I would think there would be
> a lot of people bumping into this.
>
> On both servers I have safe mode on and open_basedir directive set for
> the virtual host in apache. The offending php code from the top level
> file calls another php file with require_once ('path/file.php') and then
> file.php in turn calls another php file require_once ('path/file2'). Its
> this second require_once that causes the fatal error, in otherwords, I
> can call the first file with require_once, and put just about any sort
> of reasonable php code in this file, and it works, i.e. its included in
> the origional file. When the called file, calls another file, in php 5,
> I get an error,
>
> ==========================================
> Warning: main() [function.main]: open_basedir restriction in effect.
> File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is
> not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in
> /www/htdocs/midwifefinder.com/site/includes/app.php on line 3
the way I read it your config only allows you to open files inside of:
/www/htdocs/midwifefinder.com/site
looks to me like php5 is doing what its supposed to, maybe php4
was actually broken which allowed the require to work when it
wasn't supposed to.
why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 'allowed path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php
^--- ?
>
> Warning: main(config/_config.inc.php) [function.main]: failed to open
> stream: Operation not permitted in
> /www/htdocs/midwifefinder.com/site/includes/app.php on line 3
>
> Fatal error: main() [function.require]: Failed opening required
> 'config/_config.inc.php'
> (include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in
> /www/htdocs/midwifefinder.com/site/includes/app.php on line 3
> ============================================
>
> The code and paths are unchanged, works on php4, not on php5, apache
> version unchanged. (1.3.x). I have tried various php.ini files, of
> course turning open_basedir off will make the error go away. The file
> being called is clearly within the scope of the open_basedir
> restriction, and thus it works just fine in php4.
>
> /usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the
> correct path to the file, I guess because it doesn't find the file in
> the . (dot) part of the include path, then it blows up when it tries to
> find the file in (what is basically) /usr/local/lib/php.
>
> This kind of sounds like a TRANSPATH related problem, and its certainly
> a path problem (where is dot), but as I read the docs, TRANSPATH is
> something that changed for apache 2.
>
> Any advice would be appreciated.
>
> CL
>
attached mail follows:
Windows binaries are now available at:
PHP 5.0.4RC1
http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip
PHP 4.3.11RC1
http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip
Additional downloads for PHP 5.0.4RC1:
http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip
Edin
----- Original Message -----
From: "Zeev Suraski" <zeev
zend.com>
To: <php-general
lists.php.net>; <internals
lists.php.net>
Sent: Monday, March 14, 2005 11:13 AM
Subject: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled
> Everyone,
>
> We've rolled initial release candidates for PHP 5.0.4 and 4.3.11. As
usual,
> these 3rd digit releases include a variety of bug fixes and minor updates.
>
> PHP 5.0.4RC1 source:
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.bz2
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.gz
>
> PHP 4.3.11RC1 source:
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.bz2
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.gz
>
> Windows binaries will be posted and announced soon.
>
> Changes in PHP 5.0.4RC1:
http://cvs.php.net/co.php/php-src/NEWS?r=1.1760.2.286
> Changes in PHP 4.3.11RC1:
http://cvs.php.net/co.php/php-src/NEWS?r=1.1247.2.854
>
> Any help in testing these release candidates would be appreciated!
>
> Zeev
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
Edin Kadribasic wrote:
> Windows binaries are now available at:
>
> PHP 5.0.4RC1
> http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip
>
> PHP 4.3.11RC1
> http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip
>
> Additional downloads for PHP 5.0.4RC1:
> http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
> http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip
The PEAR bundles are ridiculously out of date for both PHP 5.0.4 and
4.3.11, where is the windows build pulling these versions from?
Greg
attached mail follows:
Edin Kadribasic wrote:
> Windows binaries are now available at:
>
> PHP 5.0.4RC1
> http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip
>
> PHP 4.3.11RC1
> http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip
>
> Additional downloads for PHP 5.0.4RC1:
> http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
> http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip
The PEAR bundles are ridiculously out of date for both PHP 5.0.4 and
4.3.11, where is the windows build pulling these versions from?
Greg
attached mail follows:
> A form with a rich text box and a submit button.
I've got not idea what a rich text box is, so you're on your own for that
part.
> Then someone suggested urlencode however that encoded the entire message,
> so
> they got Click%20the%20link%20below..
You want to use urlencode, but *only* on the filename part.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
>> Select blablabla FROM t1,t2,t3
>> WHERE customers LIKE '%$s%'
>> OR name LIKE '%$s%'
>> OR domain LIKE '%$s%'
>> OR email LIKE '%$s%'
>> OR log LIKE '%$s%'
>> AND t1.id = t2.t1_id
>> AND t1.id = t3.t1_id
>>
>> Horror!
>>
>
> Perhaps I'm missing something, but what's wrong with that query? It
> looks like a pretty normal search query to me. If you need to search
> through a bunch of records for various text fragments, and you're not
> certain which field they're in, why *wouldn't* you use a query like
> this?
Been there. Done that.
Because of operator precedence, this turns into:
customers like '%$s%' or name like '%$s%' or domain like '%$s%' or email
like '%$s%' or (log like '%$s%' and t1.id = t2.t1_id and t1.id = t3.t1_id)
So you basically end up with the cartesian product of three tables for
most of the tests, and the foreign keys only kick in for the log test.
Assuming the three tables have reasonable amounts of data in them, you
then are checking count(t1) * count(t2) * count(t3) tuples with LIKE on
text fields.
This should quickly bring the database server to its knees. :-)
I'd be surprised if this kind of thing survived even the worst QA -- You'd
have to have hefty db server, and very small tables and VERY BAD QA to not
notice something was wrong.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Hi,
In the static function "toHtml_table_heading" I want to use a static
array $fields, which is defined differently in each implementation.
My first trial was to use self::$fields[] to access this array, but
this only sees the member of DBTable, not the inherited from DBTable.
My second trial was to pass the classnmae thru $classname and to access
the correct $fields with $classname::$fields, but that doesn't seem to work.
abstract class DBTable {
static protected $fields = array();
static function toHtml_table_heading($classname) {
$fields = $classname::$fields; // <== syntax error, unexpected
T_PAAMAYIM_NEKUDOTAYIM
//...
}
//...
}
class DBImplementation extends DBTable {
public function intializeClass() {
self::$fields[] = new Object(1);
self::$fields[] = new Object(2);
}
function __construct() {
intializeClass()
}
}
attached mail follows:
I have a multidimensional array that's built as follows (it's pretty
much a directory tree):
Array (
[Dir1] => Array (
[User1] => Array (
[0] => File1
[1] => File2
)
[User2] => Array {
[0] => File1
[1] => File2
[2] => File3
}
)
[Dir2] => Array (
[User1] => Array (
[0] => File1
[1] => File2
[2] => File3
[3] => File4
)
[User2] => Array {
[0] => File1
}
)
)
I need to do a sort on the whole thing in such a way that:
a) all the Dir#'s are in ascending order, and
b) all the User#'s are in ascending order with each Dir#, and
b) all the File#'s are also in ascending order within each User#
I don't suppose there's an easy way to do this, other than doing it
in several steps, is there? Is there even a way to JUST sort the Dir#'s
(and the rest gets done at a later stage in the script)?
-- A
attached mail follows:
Hello Ashley,
Monday, March 14, 2005, 12:12:19 PM, you wrote:
A> I need to do a sort on the whole thing in such a way that:
A> a) all the Dir#'s are in ascending order, and
A> b) all the User#'s are in ascending order with each Dir#, and
A> b) all the File#'s are also in ascending order within each User#
http://us3.php.net/manual/en/function.array-multisort.php
It's funny, I was in the exact same boat this morning with regards to
generating a sign-in sheet for a class where I had pulled out all the
students into a multi-dimensional array and needing to sort them by
last name ascending. I was just about to delve into array-multisort
when it dawned on me that this would be the perfect opportunity for a
table join. So, I learned how to do a MySQL join (my first) a few
hours ago. It works great! Much less headache too.
$sqlRegisteredStudents="SELECT s.id, s.firstName, s.lastName, s.phone, s.email, s.divisionOrFacility, s.supervisorName " .
"FROM " . $tbl_registrations . " r JOIN " . $tbl_students . " s " .
"ON r.studentId = s.id " .
"WHERE courseId='" . $_POST['courseID'] . "' " .
"ORDER BY s.lastName ASC";
--
Leif (TB lists moderator and fellow end user).
Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
attached mail follows:
On 3/14/2005 1:26 PM Richard Lynch wrote:
>>PHP I'm already building from Source. Uninstalling all of MySQL doesn't
>>seem to be an option because of that dovecot dependency.
>>
>>What I'd really like to know (among so many other things) is how
>>configure is determining which MySQL it should use. Also knowing the
>>difference between PHP via a browser (via apache) and PHP on the command
>>line would give me some clues. I don't understand why the client API
>>version for mysqli is different according to how PHP is accessed.
>
>
> Suppose, just for the sake of argument, that your Apache had
> mod_auth_mysql compiled into it.
>
> Also suppose, for the sake of argument, that it was on version MySQL 3
> when you did that.
>
> When you try to compile PHP, it *CANNOT* use MySQL 4 in the PHP Module, or
> Apache's mod_auth_mysql would get all fargled up.
>
> The CLI version, however, does not have that constraint.
>
> *MAYBE* configure is smart enough to figure this kind of stuff out, and
> that's why you got what you got.
>
> More likely, you've still got MySQL 3 installed somewhere on your system.
>
> If you're not willing to un-install that, and configure isn't finding the
> version you want to use, then start reading/hacking the Makefiles that
> configure builds.
A-ha! Thank you! This is the kind of information I was looking for. I
looked into mod_auth_mysql. It isn't compiled in, but it appears that it
specifically wants to use libmysqlclient.so.10. That's the old version.
I'm not (to the best of my knowledge) using mod_auth_mysql, so I removed
the line that loaded it. After restarting Apache, the client api version
jumped up to 4.1.10a, where it belongs. If I do want to use
mod_auth_mysql, it looks simple enough to download the latest version
and build it from source.
Thank you again for your help.
attached mail follows:
Hello
I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line,
but I need to write where column A is missing
ColumnA ColumnB
R ABC company
ABC company
ABC company
ABC company
O XYZ company
XYZ company
XYZ company
XYZ company
What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA
while ColumnB equals $var (ABC company then XYZ company), so that I end up with:
ColumnA ColumnB
R ABC company
R ABC company
R ABC company
R ABC company
O XYZ company
O XYZ company
O XYZ company
O XYZ company
Is this possible. What I've got so far to print out the file:
$lines = file('test2.csv');
// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . $line . "<br />\n";
}
Thanks in advance
attached mail follows:
Hello
I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line,
but I need to write where column A is missing
ColumnA ColumnB
R ABC company
ABC company
ABC company
ABC company
O XYZ company
XYZ company
XYZ company
XYZ company
What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA
while ColumnB equals $var (ABC company, XYZ company), so that I end up with:
ColumnA ColumnB
R ABC company
R ABC company
R ABC company
R ABC company
O XYZ company
O XYZ company
O XYZ company
O XYZ company
Is this possible. What I've got so far to print out the file:
$lines = file('test2.csv');
// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . $line . "<br />\n";
}
Thanks in advance
attached mail follows:
I have the following Class:
class MyClass {
function store_myself() {
$query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
$result = mssql_query( $query );
}
}
which works. Kind of. What I expected was a serialized copy of the
object to be stored in the column myfield. However, what I am actually
seeing is simply the word 'Object'.
How can I get it so that the serialize copy is stored so that I can retrieve
that copy later and use it as a PHP object?
thnx,
Chris
attached mail follows:
On Mon, 2005-03-14 at 14:07 -0600, Chris Boget wrote:
> I have the following Class:
>
> class MyClass {
> function store_myself() {
> $query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
> $result = mssql_query( $query );
> }
> }
>
> which works. Kind of. What I expected was a serialized copy of the
> object to be stored in the column myfield. However, what I am actually
> seeing is simply the word 'Object'.
>
> How can I get it so that the serialize copy is stored so that I can retrieve
> that copy later and use it as a PHP object?
>
> thnx,
> Chris
>
Try serializing it first.
What happens when you run:
echo $this;
..your query is going to save the same thing.
try serialize($this) instead.
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby
planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP, Ruby, and PostgreSQL Development
* http://www.robbyonrails.com/
****************************************/
attached mail follows:
> I did not subscribe to it in the first place
There goes that nefarious PHP-General again, randomly subscribing
unsuspecting innocents as part of its evil master plan....
attached mail follows:
Hi Hans,
What I am trying to avoid is having 2 copies of the same program installed...
- mb
On Sun, 13 Mar 2005 22:06:15 -0500, Hans Zaunere <lists
zaunere.com> wrote:
>
> > Any tips regarding the configuration of php and/or apache ?
>
> Per option 1 below, they were saying two installs of Apache or one install of Apache directed to use different httpd.conf files, then to use different ports for each instance. The same thing can be accomplished using two IP addresses if available, instead of two different points.
>
> ---
> Hans Zaunere
> President, Founder
>
> New York PHP
> http://www.nyphp.org
>
> AMP Technology
attached mail follows:
> What I am trying to avoid is having 2 copies of the same program
> installed...
Well, if you're gonna have PHP 4 and PHP 5, you're gonna have to have two
copies of PHP...
You could run both under Apache 1.x, but running PHP 5 with Apache 1.x
means you aren't going to be taking advantage of any of the cool features
of 2.x anyway, so why do that?
Running 4 with Apache 2.x, same thing: PHP 4 doesn't leverage anything
cool from Apache 2.x, so you might as well take the safe road with Apache
1.x
For more accurate statements of the above, see:
http://us3.php.net/manual/en/faq.migration5.php
http://us3.php.net/manual/en/migration5.php
So, ideally, you'd be running:
PHP 4 + Apache 1.x
PHP 5 + Apache 2.x
if you want to try out new things in leading edge versions.
But let's assume you just want to test your PHP4 scripts in PHP5, which
would make sense.
You're only going to install Apache 1.x ONCE, but you're going to HAVE to
run 2 pools of httpd running to have PHP4 and PHP5 Modules installed,
probably.
Actually, I guess you could run PHP5 as a CGI, knowing that that will
automatically break a *few* things (HTTP Authentication, for example) but
test *most* of your scripts that way.
Compile PHP 5 as CGI, and use something like:
AddType application/x-httpd-php5 .php5
Then, in an .htaccess file where you have your PHP5 scripts you are
migrating, you could use:
<Files *.php>
ForceType application/x-httpd-php5
</Files>
This would not be suitable for a heavy load production server, and you're
GOING to have some issues to track down where it's just CGI messing things
up, not PHP5, really, but it's do-able.
Maybe if you told us WHY you need 4 & 5 we'd have better answers for ya.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Richard Lynch wrote:
...
[good stuff]
...
>
> Maybe if you told us WHY you need 4 & 5 we'd have better answers for ya.
>
Agreed! Tell us what you specifically need and we can provide better
answers. If you're wanting to test PHP5 with your current scripts then
it would make sense to do exactly what Richard said. Or if you really
need to run it as an Apache module I suppose you could run it on a dev
server, but you would still want Apache to be the exact same version as
what you have on your stable / production box.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Would some please provide me some simple rules for dealing with php scripts to
fopen(), copy() and move_uploaded_file().
Environment is Linux, Apache on a virtual host
I've spent a lot of time goggling, etc. and can find lot's of explanations for
owner, group and world. They sound great; but don't work for me.
This stuff worked on our previous host, it simply assigned "customer" to everything
Here is my directory structure and permissions:
/foo [user accessed php scripts] permissions= 755
/foo/data [simple text files] permissions = 777
files in /data permissions= 644
Have tried lots of other dir and file permissions
owerships are our site handle.
All I want to do is have the user http upload a file
and use move_uploaded_file() to put it in my /foo/data
Then later, a script fopen()s the file to read an append data to it.
Just prior to appending to the file, I use copy() and rename it to anyname.bak
I've fooled around around with shell access and chown and chmod to make things
work; but, I can't believe this is necessary.
Of course, once the script can't access the file, it can't change the
permissions or ownership
Help.
attached mail follows:
> Would some please provide me some simple rules for dealing with php
> scripts to
> fopen(), copy() and move_uploaded_file().
>
> Environment is Linux, Apache on a virtual host
>
> I've spent a lot of time goggling, etc. and can find lot's of explanations
> for
> owner, group and world. They sound great; but don't work for me.
>
> This stuff worked on our previous host, it simply assigned "customer" to
> everything
Your current host has given you TWO different usernames, sort of.
One is the one you use to login to the shell. This is probably something
like 'al' or 'ridersite' or some variant on your name/site.
The other is the one running Apache/PHP. This is probably 'nobody' or
'apache' or 'www' or something like that.
If you want PHP from the web to be able to do something to a file, you
need to make that file owned by the Apache user.
> Here is my directory structure and permissions:
>
> /foo [user accessed php scripts] permissions= 755
> /foo/data [simple text files] permissions = 777
> files in /data permissions= 644
>
> Have tried lots of other dir and file permissions
>
> owerships are our site handle.
Here's what you do to get a whole directory OWNED by the PHP user:
Step 1: TEMPORARILY make a directory world-writable with "chmod 777 xxx"
Step 2: Write a PHP script to create a directory (http://php.net/mkdir)
*inside* that directory: <?php mkdir("/path/to/xxx/php_owned");?>
Step 3: Change xxx back to sensible permissions: "chmod 755 xxx"
Ideally, you would make this directory owned by PHP *not* in your web
tree, but in some other directory.
You would then write PHP scripts to provide access to that directory.
Those scripts would then contain code to make *SURE* the content you were
sending out "looked right"
The reason for this is that the php_owned directory can be altered by
*ANYBODY* who can write a PHP script on your server.
So if you have some cross-checks in your scripts before you serve up the
content, you can "catch" that kind of thing.
You can cross-reference the files in that directory with records in a
database of what you expect to be there.
You can make sure that images "look" like image files with
http://php.net/imagegetsize
In your case, you could store the last known size of the file in your
database, and check that right before you append to make sure somebody
else hasn't snuck some data in there.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
can anyone recommend a good mailing list software that may be adapted for these purposes?
[Fri, Mar 11, 2005 at 02:34:01PM -0800]
This one time, at band camp, Richard Lynch said:
>
> A better answer, all around, might be to use a mailing list software
> package for sending bulk email -- They've been fine-tuned to be really
> good at it.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
--
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
3:00PM up 12 days, 3:57, 3 users, load averages: 0.00, 0.00, 0.00
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (FreeBSD)
iD8DBQFCNf2Z7g+NJl/fSB0RAo2KAJ91ZnsQ+wRoMCrT0sOzHSn7k+hOHACgwOs4
+t2Ll/G8AGip1+vzV8nGjG4=
=wRpS
-----END PGP SIGNATURE-----
attached mail follows:
hi
[Sat, Mar 12, 2005 at 08:42:15PM -0300]
This one time, at band camp, Manuel Lemos said:
> Hello,
>
>
> For starters, just stay away from SMTP based solutions if you can. It
> works but it takes much longer to queue messages that some alternatives
> because you need to deal with TCP overhead, which is silly when your MTA
> is in the same machine.
>
> The best alternative is to inject the messages in the local mailer queue
> and tell it to no start delivering the messages immediately.
>
> If you can use sendmail (or exim ) there are some switches for the
> sendmail command for that purpose. Using qmail or postfix does not
> require any switches.
>
i have sendmail on this system.
anyone have links on how to inject messages into the local mailer queue?
> In any case, you may want to try this MIME message composing and sending
> class. It provides several means to optimize bulk deliveries,
> personalized or not. You can pick a sub-class to optimize deliveries for
> the MTA that you use. There are sub-classes for mail, sendmail (or exim
> or postfix), qmail, SMTP or Windows pickup folder are supported.
>
> Regardless of which you use, always call SetBulkMail() function before
> start looping deliveries to your users.
>
> If you are not personalizing message, you can tell the class to cache
> message bodies between deliveries to avoid message regeneration overhead.
>
> If you want to personalize messages, you can even use Smarty as template
> engine to speedup personalized message generation.
>
> There are several examples to demonstrate this:
>
> http://www.phpclasses.org/mimemessage
>
>
>
> --
>
> 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
--
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
3:00PM up 12 days, 3:57, 3 users, load averages: 0.00, 0.00, 0.00
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (FreeBSD)
iD8DBQFCNf7Y7g+NJl/fSB0RAmm5AJoDEwJ3YN79deRqCMyTUxZPyM8y0wCdEF4f
xm+BlhORlq+GW+YyLOe334U=
=2fZI
-----END PGP SIGNATURE-----
attached mail follows:
Hello,
on 03/14/2005 06:15 PM Redmond Militante said the following:
>>For starters, just stay away from SMTP based solutions if you can. It
>>works but it takes much longer to queue messages that some alternatives
>>because you need to deal with TCP overhead, which is silly when your MTA
>>is in the same machine.
>>
>>The best alternative is to inject the messages in the local mailer queue
>>and tell it to no start delivering the messages immediately.
>>
>>If you can use sendmail (or exim ) there are some switches for the
>>sendmail command for that purpose. Using qmail or postfix does not
>>require any switches.
>>
>
> i have sendmail on this system.
> anyone have links on how to inject messages into the local mailer queue?
Usually you can tell the sendmail program to just queue the messages
instead of deliverying them immediately using the delivery mode switch
od . If you want to see how that is done, take a look at the
sendmail_message_class of this package:
http://www.phpclasses.org/mimemessage
--
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
attached mail follows:
quitenme de la lista porfavor quiero salir de aqui
--
---------------------------------------------------------------
Banco de Crédito BCP - Dedicados a hacerte la Banca más simple.
Visita nuestra Banca por Internet http://www.viabcp.com
---------------------------------------------------------------
attached mail follows:
I have table with products. In column categories are listed numbers of
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the
moment)
Now, I have to list all products that belongs to category with cat.
number, e.g. 11.
If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3 & 5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^".$cat_num."|,
".$cat_num.")'
it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. But
if I select for cat. num. 2 it will list all products from categories 2
and everything between 20 and 29. 32 or 62 will not be listed.
Confusing, ha?
Thanks for any help!
-afan
attached mail follows:
I have a PHP5.x site under development with MySQL 4.1.x. I had the
site running fine and there were no speed issues at all. Everything is
on the same system (a dual G5 Xserve).
Today however the PHP pages with MySQL calls started to take forever to
load. Static html and php files still loaded instantly.
I tracked the issue down to mysql_connect. Initial calls to this
function are taking 5 to 10 seconds each. Subsequent calls missing a
mysql_close call do not have the latency issue. Normally I try have
each call to mysql_connect followed by a mysql_close to keep my mysql
tales in order.
I have tried:
- loading the pages remotely and locally (both slow)
- checked the Apache / MySQL logs
- manually ran the mysql queries to check for slow queries (all 0.0x
seconds duration)
- restarted apache / mysql
My next step is a hard restart (off hours later tonight) but until then
I was wondering if anyone has any ideas? I am stumped.
Thanks,
Dan T
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]