|
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 8 Nov 2005 23:27:41 -0000 Issue 3783
php-general-digest-help
lists.php.net
Date: Tue Nov 08 2005 - 17:27:41 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 8 Nov 2005 23:27:41 -0000 Issue 3783
Topics (messages 225271 through 225332):
Command line vs Cron
225271 by: Dan Seibert
225272 by: Richard Heyes
225277 by: Dan Seibert
225278 by: Richard Heyes
php5 / php4 - MySQL/SQLite
225273 by: Danny
225274 by: Jochem Maas
225279 by: Robbert van Andel
225326 by: Petr Smith
Re: Security Issues - Where to look?
225275 by: Paul Waring
225290 by: Gustavo Narea
225299 by: Chris Shiflett
225300 by: bruce
225305 by: Gustavo Narea
225309 by: Gustavo Narea
225310 by: Chris Shiflett
225324 by: Richard Lynch
225325 by: Richard Lynch
225327 by: Richard Lynch
Re: phpmyadmin problems with quoting exported text
225276 by: David Robley
Re: is there a number translation function?
225280 by: Danny
Query regarding total count of pages in a site....
225281 by: Suresh Pandian
225282 by: Suresh Pandian
225289 by: Richard Davey
225322 by: Richard Lynch
Fixing ID's in mySQL Table
225283 by: Rahul S. Johari
225284 by: Gustav Wiberg
225285 by: Miles Thompson
225286 by: Rahul S. Johari
225287 by: Larry E. Ullman
225288 by: Gustav Wiberg
225293 by: Georgi Ivanov
225294 by: Rahul S. Johari
225319 by: Richard Lynch
mail return-path problem
225291 by: Eric Butera
225292 by: Richard Heyes
225317 by: Richard Lynch
Determining Built Configuration
225295 by: trlists.clayst.com
225296 by: Minuk Choi
225297 by: trlists.clayst.com
225316 by: Richard Lynch
Re: PHP 4.4.1 on Apache 2.0.x issue
225298 by: Geert Booster
Use of auto_prepend_file inside an Apache directory container
225301 by: Dan Trainor
225303 by: Dan Trainor
225304 by: Jasper Bryant-Greene
225306 by: Dan Trainor
225307 by: Jasper Bryant-Greene
225308 by: Dan Trainor
225311 by: Curt Zirzow
225314 by: Dan Trainor
225318 by: Curt Zirzow
225320 by: Dan Trainor
PEAR on PHP 5+?
225302 by: Minuk Choi
A question...
225312 by: Tony Di Croce
225313 by: Chris Shiflett
225315 by: Richard Lynch
Attachments and SendMail()
225321 by: Todd Cary
225323 by: Todd Cary
225328 by: Richard Lynch
Re: FileExists?
225329 by: Richard Lynch
Re: Using the echo tag...
225330 by: Richard Lynch
Re: Creating PDF from a Image
225331 by: Richard Lynch
225332 by: Richard Lynch
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:
I have a script that connects to a sybase server. It works fine if I
launch it from a shell script however, if I try to launch the same
script through a cron, I get the message "PHP Fatal Error: call to
undefined function sybase_connect..."
Why can I not connect to sybase through a cron but I can through shell?
attached mail follows:
Dan Seibert wrote:
> I have a script that connects to a sybase server. It works fine if I
> launch it from a shell script however, if I try to launch the same
> script through a cron, I get the message "PHP Fatal Error: call to
> undefined function sybase_connect..."
>
> Why can I not connect to sybase through a cron but I can through shell?
You may have two instances of the php cli/cgi binary, compiled
differently. Try using `locate` or `find` on the cmd line to find them.
--
Richard Heyes
attached mail follows:
Richard Heyes wrote:
> Dan Seibert wrote:
>> I have a script that connects to a sybase server. It works fine if I
>> launch it from a shell script however, if I try to launch the same
>> script through a cron, I get the message "PHP Fatal Error: call to
>> undefined function sybase_connect..."
>>
>> Why can I not connect to sybase through a cron but I can through shell?
>
> You may have two instances of the php cli/cgi binary, compiled
> differently. Try using `locate` or `find` on the cmd line to find them.
>
Good call on that... I do have 2 php's compiled. Now, how do I tell the
cron to look at the other PHP to run that job?
attached mail follows:
Dan Seibert wrote:
> Richard Heyes wrote:
>
>> Dan Seibert wrote:
>>
>>> I have a script that connects to a sybase server. It works fine if I
>>> launch it from a shell script however, if I try to launch the same
>>> script through a cron, I get the message "PHP Fatal Error: call to
>>> undefined function sybase_connect..."
>>>
>>> Why can I not connect to sybase through a cron but I can through shell?
>>
>>
>> You may have two instances of the php cli/cgi binary, compiled
>> differently. Try using `locate` or `find` on the cmd line to find them.
>>
> Good call on that... I do have 2 php's compiled. Now, how do I tell the
> cron to look at the other PHP to run that job?
>
Supply the full path to the correct binary, be it in your scripts' hash
bang (ie. the top line: #!/usr/local/bin/php) or in your crontab,
(eg. 0 0 * * * /usr/local/bin/php foo.php)
--
Richard Heyes
http://www.phpguru.org
attached mail follows:
Hi,
Let me open a discussion about php5 / php4
Why upgrade? It worth? Benefits? Code programming changes?
Is there and end-of-life for php4, in the near/medium future?
What about MySQL and SQLite. What is the future of both? I would like to
open a discussion about the future of both related to php no matter the
version of it...
Let´s start
--
dpc
attached mail follows:
Danny wrote:
> Hi,
> Let me open a discussion about php5 / php4
> Why upgrade? It worth? Benefits? Code programming changes?
> Is there and end-of-life for php4, in the near/medium future?
> What about MySQL and SQLite. What is the future of both? I would like to
> open a discussion about the future of both related to php no matter the
> version of it...
> Let´s start
not that this horse hasn't been flogged to death, whats your own opinion?
...when even Richard Lynch is begrudgingly starting to use foreach() it might be
time to move on and upgrade ;-)
> --
> dpc
>
attached mail follows:
I recently upgraded to PHP5 and had no issues with code incompatibilities.
I believe we ran PHP 4.10 (I don't remember the exact version). Honestly, I
haven't seen that many benefits but I don't write that many scripts that use
advanced OOP methodology.
-----Original Message-----
From: Danny [mailto:metalito
gmail.com]
Sent: Tuesday, November 08, 2005 3:53 AM
To: php-general
lists.php.net
Subject: [PHP] php5 / php4 - MySQL/SQLite
Hi,
Let me open a discussion about php5 / php4
Why upgrade? It worth? Benefits? Code programming changes?
Is there and end-of-life for php4, in the near/medium future?
What about MySQL and SQLite. What is the future of both? I would like to
open a discussion about the future of both related to php no matter the
version of it...
Let´s start
--
dpc
attached mail follows:
Danny wrote:
> Hi,
> Let me open a discussion about php5 / php4
> Why upgrade? It worth? Benefits? Code programming changes?
> Is there and end-of-life for php4, in the near/medium future?
> What about MySQL and SQLite. What is the future of both? I would like to
> open a discussion about the future of both related to php no matter the
> version of it...
> Let´s start
> --
> dpc
>
Why don't you use Windows 3.1? It's mostly good idea to install new
version of software when it's available. Bug fixes, improvements, new
ideas. It's the same with PHP. Why to annoy with php4 if there's new,
stable, working, better php5 (php5.1!)? I would use PHP5 just for
"file_put_contents" function :). There is no reason to stay with PHP4 so
why to talk about it? Yes, we can discuss if it's worth to move to java
or .net or ruby or python, it could be interesting discussion, but I
think it's waste of time to discuss php4/5 differences.
Similar problem is with your second question. What can I say about
future of MySQL and SQLite related to php? Both could be used with php
and you should select which one to use according to your needs. There
are other databases too...
Again - I don't know what are you expecting from these two questions.
They cannot be discussed at all.
Petr
attached mail follows:
On Mon, Nov 07, 2005 at 01:50:59PM -0800, Richard wrote:
> I've heard that php is not particularly secure, making it problematic if you
> intend to create a web site with commerce, etc. Is there a particular news
> group that addresses security issues? I'm looking for some guidlines on
> ensuring that my site is secure from malicious hackers.
Other people have already addressed issues about writing secure code,
but if you're concerned about PHP itself being inherently insecure you
could always take a look at Hardened-PHP:
http://www.hardened-php.net/
I haven't used it myself, so can't vouch for how secure it actually is.
Obviously any system is only going to be as strong as its weakest link,
so if you have users with guessable passwords then you'd want to address
that before worrying about whether PHP is secure or not (and of all the
vulnerabilities that I've seen exploited on servers, the two major
problems are insecure scripts - such as phpBB - not being kept up to
date, and users choosing poor passwords or giving out their login
details to other people).
Paul
--
Rogue Tory
http://www.roguetory.org.uk
attached mail follows:
*Distrust everything coming from your users,
even their user agents*
*If you make your scripts taking this into account,
they'll be pretty secure*
Actually, I believe that the one thing you can trust in, is their IP
addresses. Isn't it?
By the way, I liked the link that Pablo suggested:
http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
Cheers.
Richard wrote:
> I've heard that php is not particularly secure, making it problematic if you
> intend to create a web site with commerce, etc. Is there a particular news
> group that addresses security issues? I'm looking for some guidlines on
> ensuring that my site is secure from malicious hackers.
>
> Thanks,
> Richard
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
attached mail follows:
Gustavo Narea wrote:
> By the way, I liked the link that Pablo suggested:
> http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
Be careful. There is a lot of misinformation out there regarding PHP
security, and this article is a good example.
Here's something that caught my eye:
"The second solution is to only store their username and password in a
cookie, and with every call to the script, validate the username and
password and verify if the user is an administrator."
If the problem is how to expose a user's sensitive data as much as
possible, then this is a solution. However, I doubt that's the intent.
This is such a common mistake that it is something I specifically search
for when auditing a PHP application, as I mention in this talk:
http://brainbulb.com/talks/php-security-audit-howto.pdf
The PHP Security Consortium is trying to resolve this problem of
misinformation in a positive way (we don't want to disparage people's
hard work and spread bad vibes). We've created a library of links to
approved resources that we've read through to make sure the advice given
is sound. You can find this library here:
http://phpsec.org/library/
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
if you really want to get into a conversation about security... it might be
time to try to figure out how to create a security app/process which could
be used to validate that an app is secure. the process could be a function
of an automated app that looks/inspects code, as well as a manual process
that inspects different portions of the app's logic/structure.
there are a number of commercial code analyzers, although i don't know of
any off the top of my head for php/web source based apps...
might be time to seriously look at creating such an app/service.. there
would probably be funding for this kind of app...
ps.. this kind of app would not be trivial to create!!!
-bruce
-----Original Message-----
From: Chris Shiflett [mailto:shiflett
php.net]
Sent: Tuesday, November 08, 2005 12:08 PM
To: Gustavo Narea
Cc: php-general
lists.php.net
Subject: Re: [PHP] Re: Security Issues - Where to look?
Gustavo Narea wrote:
> By the way, I liked the link that Pablo suggested:
> http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
Be careful. There is a lot of misinformation out there regarding PHP
security, and this article is a good example.
Here's something that caught my eye:
"The second solution is to only store their username and password in a
cookie, and with every call to the script, validate the username and
password and verify if the user is an administrator."
If the problem is how to expose a user's sensitive data as much as
possible, then this is a solution. However, I doubt that's the intent.
This is such a common mistake that it is something I specifically search
for when auditing a PHP application, as I mention in this talk:
http://brainbulb.com/talks/php-security-audit-howto.pdf
The PHP Security Consortium is trying to resolve this problem of
misinformation in a positive way (we don't want to disparage people's
hard work and spread bad vibes). We've created a library of links to
approved resources that we've read through to make sure the advice given
is sound. You can find this library here:
http://phpsec.org/library/
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello, Chris.
I will take into account what you said.
It is right what you mentioned regarding that example. We have to take
into account that cookies can be stolen.
Thanks for the URLs, I will visit them.
Cheers.
Chris Shiflett wrote:
> Gustavo Narea wrote:
>
>> By the way, I liked the link that Pablo suggested:
>> http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
>
>
> Be careful. There is a lot of misinformation out there regarding PHP
> security, and this article is a good example.
>
> Here's something that caught my eye:
>
> "The second solution is to only store their username and password in a
> cookie, and with every call to the script, validate the username and
> password and verify if the user is an administrator."
>
> If the problem is how to expose a user's sensitive data as much as
> possible, then this is a solution. However, I doubt that's the intent.
> This is such a common mistake that it is something I specifically search
> for when auditing a PHP application, as I mention in this talk:
>
> http://brainbulb.com/talks/php-security-audit-howto.pdf
>
> The PHP Security Consortium is trying to resolve this problem of
> misinformation in a positive way (we don't want to disparage people's
> hard work and spread bad vibes). We've created a library of links to
> approved resources that we've read through to make sure the advice given
> is sound. You can find this library here:
>
> http://phpsec.org/library/
>
> Hope that helps.
>
> Chris
>
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
attached mail follows:
Hello.
I found a document titled "A Guide to Building Secure Web Applications"
<http://www.cgisecurity.com/owasp/html/index.html> while I was reading
one of the documents you suggested us, and I would like to know what do
you think about it?
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
attached mail follows:
Gustavo Narea wrote:
> I found a document titled "A Guide to Building Secure Web Applications"
> <http://www.cgisecurity.com/owasp/html/index.html> while I was reading
> one of the documents you suggested us, and I would like to know what do
> you think about it?
The OWASP Guide is good, but that site has an old version. You can check
OWASP for the latest:
http://www.owasp.org/documentation/guide/guide_downloads.html
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
On Mon, November 7, 2005 3:50 pm, Richard wrote:
> I've heard that php is not particularly secure, making it problematic
> if you
> intend to create a web site with commerce, etc. Is there a particular
> news
> group that addresses security issues? I'm looking for some guidlines
> on
> ensuring that my site is secure from malicious hackers.
I've heard that New York is an unsafe city, making it problematic if
you intend to open a business there with cash registers, etc.
http://phpsec.org/
should probably be in your bookmarks...
Or not, because you should memorize it. Not the URL. The whole site.
:-)
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Tue, November 8, 2005 9:43 am, Gustavo Narea wrote:
> *Distrust everything coming from your users,
> even their user agents*
>
> *If you make your scripts taking this into account,
> they'll be pretty secure*
>
>
> Actually, I believe that the one thing you can trust in, is their IP
> addresses. Isn't it?
No!
IP is useless for identification or authentication of the general
web-surfer:
Users behind firwalls will all appear to be from one (1) IP
AOL users change IPs faster than drummers change underwear
But even in the more restricted case of an IP you "know" will never
change (e.g.: intranet application), that IP can be spoofed, by a
knowlegable person.
And/or traffic to/from that IP can be targetted and examined.
The user's IP address is a useless bit of fluff you should ignore at
all times if you REALLY care about security.
This is not to say it's not TOTALLY useless...
You might, for example, allow developers from 192.168.*.* to surf to
your http://php.net/phpinfo page on a development box. After all, if
somebody has already broken through enough walls to surf to it, and
mask their IP as 192.168.*.*, you probably already have MUCH bigger
problems than them seeing phpinfo() output...
It would be BETTER to require a password of some kind, but it's not
totally wack to just use $_SERVER['REMOTE_ADDR'] for this.
You can use IP for statistical analysis of visits/visitors and be
reasonably certain that MOST of the IP addresses are "accurate" and
"semi-static" for a crude visitor/traffic monitoring, but knowing that
a certain percentage of error is inherent to that data -- more like an
opinion poll than anything.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Tue, November 8, 2005 2:55 pm, Gustavo Narea wrote:
> I found a document titled "A Guide to Building Secure Web
> Applications"
> <http://www.cgisecurity.com/owasp/html/index.html> while I was reading
> one of the documents you suggested us, and I would like to know what
> do
> you think about it?
Seems like a winner to me.
It's a bit back-dated in some regards, in terms of "hot" technologies,
but the content is fundamentally sound, in general, and it has aged
well.
There's a lot of reading in there, and I was only able to spend an
hour on it, skimming all the pages, and clicking on a few links.
If it were updated, it would be VERY good.
Just my non-expert opinion.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Chris W wrote:
> I just tried to use the output of the export function on phpmyadmin and
> got a million errors. After looking at the file I found that certain
> columns that are strings were not quoted at all. I can't find any
> reason why some are and some are not quoted. Anyone have any idea why
> this is happening?
>
Been there, done that, upgraded the PMA :-)
Cheers
--
David Robley
I lost a button hole today.
attached mail follows:
http://www.phpguru.org/TextualNumberExample.php?number=3450
Regards.
Salu2
On 10/29/05, Linda H <l199
bellsouth.net> wrote:
>
> Hi,
>
> Does anyone know of a function for translating a decimal number into an
> English number. In other words, if you pass it 1 it will return 'one', if
> you pass it 127 it will return 'one hundred twenty seven', and etc.
>
> Thanks,
> Linda
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
dpc
attached mail follows:
Hello,
I need to find the number of webpages in a site..
is there any inbuilt variables to find it.........
Reply , if u have any valuable suggessions..........
thanks.....
Suresh.P
---------------------------------
Enjoy this Diwali with Y! India Click here
attached mail follows:
Hello,
I need to find the number of webpages in a site..
is there any inbuilt variables in php to find it.........
Reply , if u have any valuable suggessions..........
thanks.....
Suresh.P
---------------------------------
Enjoy this Diwali with Y! India Click here
attached mail follows:
Hi Suresh,
Tuesday, November 8, 2005, 1:28:47 PM, you wrote:
> I need to find the number of webpages in a site.. is there any
> inbuilt variables in php to find it.........
I need to find the number of socks in my washing basket. Does PHP have
an inbuilt function to do it?
No, of course it doesn't. Just because PHP can be used to script apps
for web sites, it doesn't mean it has any actual concept of what a web
page is, any more than it knows what a sock is.
This is something you'll have to code yourself. Or use a CMS style
system that offers the functionality built in.
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
attached mail follows:
On Tue, November 8, 2005 7:28 am, Suresh Pandian wrote:
> I need to find the number of webpages in a site..
> is there any inbuilt variables in php to find it.........
> Reply , if u have any valuable suggessions..........
> thanks.....
In your own site?
Or in somebody else's?
And what counts as a "page"?
If you want to count the number of FILES within a certain directory,
you could either use http://php.net/opendir and loop through
http://php.net/readdir with a $counter variable.
If you want to count all the URLs you can find on somebody else's
site, you'd have to use some kind of "spider" or "web walker" shell
framework and count the number of things you can download. You could
"roll your own" but you risk screwing up big-time and slamming their
server with 1,000,000 hits in 1 second and making them really mad at
you...
And, finally, do you really want to count every "page"?
Consider this two "pages" from one of my sites:
http://uncommonground.com/artist_profile/Ellen+Rosner
http://uncommonground.com/artist_profile/artist_id/5
One is easier for humans to remember, one is easier for me to set upf
or the search engines to find, but they're not really "different"
pages, are they?
For that matter, it's just a template with database-driven content.
So you could count it as 2000+ pages, or you could count it as 1 page.
I can't argue against either one of those accountings, but which one
are you going after? Cuz 2000 and 1 are not the same number, in most
countries...
You're really going to have to clarify what you want and why to act in
a reasonable manner.
One thing you may want to look at for ideas in this area are the
various web statistic packages you can install such as Webalizer (and
a few thousand similar packages). Examining how they do what they do
may help you understand your problem better. Or you may find that
they count the pages people are visiting, which is more interesting
that how many pages there are...
If a tree falls in the forest...
If a page lives on the 'net, but nobody visits it, is it really there?
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Ave,
Is there a way to fix ID sequence in a MySQL table using PHP?
Basically I have some tables with a lot of records, 1000 to 5000. IDı is
the Primary Key column in these tables, and at the time the code was
originally written, there werenıt much verification of data being input
going on. Thus a lot of junk records were being let in, which had to be
deleted at some point or another. Now the ID sequence is all screwed up.
Itıs not in sequence anymore.
Is there a way to fix this?
Thanks,
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
----- Original Message -----
From: "Rahul S. Johari" <rjohari
nycap.rr.com>
To: "PHP" <php-general
lists.php.net>
Sent: Tuesday, November 08, 2005 2:37 PM
Subject: [PHP] Fixing ID's in mySQL Table
Ave,
Is there a way to fix ID sequence in a MySQL table using PHP?
Basically I have some tables with a lot of records, 1000 to 5000. OIDı is
the Primary Key column in these tables, and at the time the code was
originally written, there werenıt much verification of data being input
going on. Thus a lot of junk records were being let in, which had to be
deleted at some point or another. Now the ID sequence is all screwed up.
Itıs not in sequence anymore.
Is there a way to fix this?
Thanks,
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
Hi there!
Do you want an orderby-statement to be done on ID-field? Is that what you
mean?
I would go to phpmyadmin and fix that in the database-structure. (or some
kind of database-utility)
/G
http://www.varupiraten.se/
attached mail follows:
At 09:37 AM 11/8/2005, Rahul S. Johari wrote:
>Ave,
>
>Is there a way to fix ID sequence in a MySQL table using PHP?
>Basically I have some tables with a lot of records, 1000 to 5000. IDı is
>the Primary Key column in these tables, and at the time the code was
>originally written, there werenıt much verification of data being input
>going on. Thus a lot of junk records were being let in, which had to be
>deleted at some point or another. Now the ID sequence is all screwed up.
>Itıs not in sequence anymore.
>
>Is there a way to fix this?
>
>Thanks,
>
>Rahul S. Johari
Rahul,
What is OEID, the field name?
If it's a numeric key, auto-generated by MySQL, it behaves in two ways,
depending on the table-type.
If the table is MyISAM, the keys remain unique, and do not repeat.
If a record with the key value of 5 is deleted, that number is not re-used.
This is very important if the primary key field is used as a foreign key
(reference) in another table.
For other table types, that number would be re-used, even if the
five thousandth record was being added. And the value is useless as a
foreign key in another table, unless you have programmed cascading deletes.
(Not natively supported in MySQL.)
(Just double-check the MySQL docs on this - I'm 90% certain I'm
right.)
So what does "screwed up" mean? Why is sequence important? All a primary
key does is UNIQUELY IDENTIFY a record. That's all it should do.
Given that, sequence is utterly irrelevant and does not matter.
Once the table is cleaned up you can export it and re-import it and have
MySQL generate new primary key values. But do not, do not, do not rely on
them for sequence or meaning, they are simply lables. Gaps really do not
matter.
If you want to maintain your own ID's, better to maintain a table and
procedure to generate keys. Whenever a key value is needed it is grabbed
from that table, a new key is calculated using whatever algorithm you want,
and it is stored in the key_table. Ideally, before getting the key value
from that table, a lock on the record is checked for, when it is obtained
the value is retrieved, new value calculated and stored, and the lock
released.
HTH - Miles Thompson
attached mail follows:
Ave,
This is what I need to do.
Let's say, my ID's in a table look like this:
1
7
9
11
12
19
26
27
29
30
I need to alter the table so that the ID's are in a sequence like this:
1
2
3
4
5
6
7
8
9
10
It's easy to manually do this if you have a table with 10 records, but you
can't do it manually in a table with 5000 records.
I know that I can DELETE the ID Column and recreate it and that will Fix
this problem, but doing that over and over with all the tables isn't what
I'm really looking for. I just feel there should be a way in PHP to execute
a logical query to do this. If not of course I can do the delete/recreate
using phpmyadmin, but I just want to see if there's a php script way to do
it.
Thanks.
On 11/8/05 9:22 AM, "Gustav Wiberg" <gustav
varupiraten.se> wrote:
> Hi there!
>
> Do you want an orderby-statement to be done on ID-field? Is that what you
> mean?
> I would go to phpmyadmin and fix that in the database-structure. (or some
> kind of database-utility)
>
> /G
> http://www.varupiraten.se/
> ----- Original Message -----
> From: "Rahul S. Johari" <rjohari
nycap.rr.com>
> To: "PHP" <php-general
lists.php.net>
> Sent: Tuesday, November 08, 2005 2:37 PM
> Subject: [PHP] Fixing ID's in mySQL Table
>
>
>
> Ave,
>
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a lot of records, 1000 to 5000. OIDı is
> the Primary Key column in these tables, and at the time the code was
> originally written, there werenıt much verification of data being input
> going on. Thus a lot of junk records were being let in, which had to be
> deleted at some point or another. Now the ID sequence is all screwed up.
> Itıs not in sequence anymore.
>
> Is there a way to fix this?
>
> Thanks,
>
> Rahul S. Johari
> Coordinator, Internet & Administration
> Informed Marketing Services Inc.
> 251 River Street
> Troy, NY 12180
>
> Tel: (518) 266-0909 x154
> Fax: (518) 266-0909
>
>
> Email: rahul
informed-sources.com
> http://www.informed-sources.com
attached mail follows:
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a lot of records, 1000 to 5000.
> ID is
> the Primary Key column in these tables, and at the time the code was
> originally written, there werent much verification of data being
> input
> going on. Thus a lot of junk records were being let in, which had
> to be
> deleted at some point or another. Now the ID sequence is all
> screwed up.
> Its not in sequence anymore.
You may not like this answer but you shouldn't "fix" this. Primary
keys, by definition, should never change. Their purpose is to
uniquely refer to a record. If you change the primary key of a
record, then you've undermined this purpose.
If you have "holes" in your sequencing, this isn't a problem either,
as how the records are stored in the database is completely
meaningless. If you need the records to be listed in some sort of
order, you should add another column or table that manages that. But
leave the primary key alone.
Hope that helps,
Larry
attached mail follows:
----- Original Message -----
From: "Larry E. Ullman" <LarryUllman
DMCInsights.Com>
To: "Rahul S.Johari" <rjohari
nycap.rr.com>
Cc: "PHP" <php-general
lists.php.net>
Sent: Tuesday, November 08, 2005 3:38 PM
Subject: Re: [PHP] Fixing ID's in mySQL Table
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a lot of records, 1000 to 5000. ID
> is
> the Primary Key column in these tables, and at the time the code was
> originally written, there werent much verification of data being input
> going on. Thus a lot of junk records were being let in, which had to be
> deleted at some point or another. Now the ID sequence is all screwed up.
> Its not in sequence anymore.
You may not like this answer but you shouldn't "fix" this. Primary
keys, by definition, should never change. Their purpose is to
uniquely refer to a record. If you change the primary key of a
record, then you've undermined this purpose.
If you have "holes" in your sequencing, this isn't a problem either,
as how the records are stored in the database is completely
meaningless. If you need the records to be listed in some sort of
order, you should add another column or table that manages that. But
leave the primary key alone.
Hope that helps,
Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi
I totally agree with you Larry. Couldn't have said it better myself! :-)
/G
http://www.varupiraten.se/
attached mail follows:
You van do this :
1.Create new table with exactly the same structure as orig table.
2.Create little php script which does this :
select * from origTBL
while($line=mysql_fecth_array($res)){
insert into newtbl values(............)
}
In the new tbl yuo will have the records ordered.
Than just rename the tables.
On Tuesday 08 November 2005 16:28, Rahul S. Johari wrote:
> Ave,
>
> This is what I need to do.
> Let's say, my ID's in a table look like this:
>
> 1
> 7
> 9
> 11
> 12
> 19
> 26
> 27
> 29
> 30
>
> I need to alter the table so that the ID's are in a sequence like this:
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
>
> It's easy to manually do this if you have a table with 10 records, but you
> can't do it manually in a table with 5000 records.
>
> I know that I can DELETE the ID Column and recreate it and that will Fix
> this problem, but doing that over and over with all the tables isn't what
> I'm really looking for. I just feel there should be a way in PHP to execute
> a logical query to do this. If not of course I can do the delete/recreate
> using phpmyadmin, but I just want to see if there's a php script way to do
> it.
>
> Thanks.
>
> On 11/8/05 9:22 AM, "Gustav Wiberg" <gustav
varupiraten.se> wrote:
> > Hi there!
> >
> > Do you want an orderby-statement to be done on ID-field? Is that what you
> > mean?
> > I would go to phpmyadmin and fix that in the database-structure. (or some
> > kind of database-utility)
> >
> > /G
> > http://www.varupiraten.se/
> >
> >
> >
> > ----- Original Message -----
> > From: "Rahul S. Johari" <rjohari
nycap.rr.com>
> > To: "PHP" <php-general
lists.php.net>
> > Sent: Tuesday, November 08, 2005 2:37 PM
> > Subject: [PHP] Fixing ID's in mySQL Table
> >
> >
> >
> > Ave,
> >
> > Is there a way to fix ID sequence in a MySQL table using PHP?
> > Basically I have some tables with a lot of records, 1000 to 5000. OIDı
> > is the Primary Key column in these tables, and at the time the code was
> > originally written, there werenıt much verification of data being input
> > going on. Thus a lot of junk records were being let in, which had to be
> > deleted at some point or another. Now the ID sequence is all screwed up.
> > Itıs not in sequence anymore.
> >
> > Is there a way to fix this?
> >
> > Thanks,
> >
> > Rahul S. Johari
> > Coordinator, Internet & Administration
> > Informed Marketing Services Inc.
> > 251 River Street
> > Troy, NY 12180
> >
> > Tel: (518) 266-0909 x154
> > Fax: (518) 266-0909
> >
> >
> > Email: rahul
informed-sources.com
> > http://www.informed-sources.com
attached mail follows:
Thanks!
On 11/8/05 11:49 AM, "Georgi Ivanov" <joro
abacustrade.com> wrote:
> You van do this :
> 1.Create new table with exactly the same structure as orig table.
> 2.Create little php script which does this :
> select * from origTBL
> while($line=mysql_fecth_array($res)){
> insert into newtbl values(............)
> }
>
> In the new tbl yuo will have the records ordered.
> Than just rename the tables.
>
> On Tuesday 08 November 2005 16:28, Rahul S. Johari wrote:
>> Ave,
>>
>> This is what I need to do.
>> Let's say, my ID's in a table look like this:
>>
>> 1
>> 7
>> 9
>> 11
>> 12
>> 19
>> 26
>> 27
>> 29
>> 30
>>
>> I need to alter the table so that the ID's are in a sequence like this:
>>
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>> 10
>>
>> It's easy to manually do this if you have a table with 10 records, but you
>> can't do it manually in a table with 5000 records.
>>
>> I know that I can DELETE the ID Column and recreate it and that will Fix
>> this problem, but doing that over and over with all the tables isn't what
>> I'm really looking for. I just feel there should be a way in PHP to execute
>> a logical query to do this. If not of course I can do the delete/recreate
>> using phpmyadmin, but I just want to see if there's a php script way to do
>> it.
>>
>> Thanks.
>>
>> On 11/8/05 9:22 AM, "Gustav Wiberg" <gustav
varupiraten.se> wrote:
>>> Hi there!
>>>
>>> Do you want an orderby-statement to be done on ID-field? Is that what you
>>> mean?
>>> I would go to phpmyadmin and fix that in the database-structure. (or some
>>> kind of database-utility)
>>>
>>> /G
>>> http://www.varupiraten.se/
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Rahul S. Johari" <rjohari
nycap.rr.com>
>>> To: "PHP" <php-general
lists.php.net>
>>> Sent: Tuesday, November 08, 2005 2:37 PM
>>> Subject: [PHP] Fixing ID's in mySQL Table
>>>
>>>
>>>
>>> Ave,
>>>
>>> Is there a way to fix ID sequence in a MySQL table using PHP?
>>> Basically I have some tables with a lot of records, 1000 to 5000. OIDı
>>> is the Primary Key column in these tables, and at the time the code was
>>> originally written, there werenıt much verification of data being input
>>> going on. Thus a lot of junk records were being let in, which had to be
>>> deleted at some point or another. Now the ID sequence is all screwed up.
>>> Itıs not in sequence anymore.
>>>
>>> Is there a way to fix this?
>>>
>>> Thanks,
>>>
>>> Rahul S. Johari
>>> Coordinator, Internet & Administration
>>> Informed Marketing Services Inc.
>>> 251 River Street
>>> Troy, NY 12180
>>>
>>> Tel: (518) 266-0909 x154
>>> Fax: (518) 266-0909
>>>
>>>
>>> Email: rahul
informed-sources.com
>>> http://www.informed-sources.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
On Tue, November 8, 2005 7:37 am, Rahul S. Johari wrote:
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a lot of records, 1000 to 5000.
> IDı is
> the Primary Key column in these tables, and at the time the code was
> originally written, there werenıt much verification of data being
> input
> going on. Thus a lot of junk records were being let in, which had to
> be
> deleted at some point or another. Now the ID sequence is all screwed
> up.
> Itıs not in sequence anymore.
>
> Is there a way to fix this?
Don't.
Your IDs should not have to be in sequence, nor consecutive, nor even
in order.
If any portion of you application relies on the IDs being any
particular values, your application is broken in the first place.
You've got 2 BILLION available ID numbers. (4 billion if it's unsigned).
The fact that MySQL uses consecutive integers should be considered
more of a fluke of nature than a fact of life.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
I was just curious if there was a way to set the return path of an email
dynamically. I've looked around and all I could find was a Zend tutorial
running sendmail from the command line, which I don't want to do. :)
I tried setting "Return-Path:" in the mail() headers, but that didn't seem
to make a difference. If anybody knows anything about this and could point
me in the right direction, I'd appreciate it.
Thanks!
attached mail follows:
Eric Butera wrote:
> I was just curious if there was a way to set the return path of an email
> dynamically. I've looked around and all I could find was a Zend tutorial
> running sendmail from the command line, which I don't want to do. :)
>
> I tried setting "Return-Path:" in the mail() headers, but that didn't seem
> to make a difference. If anybody knows anything about this and could point
> me in the right direction, I'd appreciate it.
>
> Thanks!
>
Use the fifth argument to the mail() function and the -f option for
sendmail:
mail('...', '...', '...', null, '-freturn
example.com')
--
Richard Heyes
http://www.phpguru.org
attached mail follows:
On Tue, November 8, 2005 9:47 am, Eric Butera wrote:
> I was just curious if there was a way to set the return path of an
> email
> dynamically. I've looked around and all I could find was a Zend
> tutorial
> running sendmail from the command line, which I don't want to do. :)
>
> I tried setting "Return-Path:" in the mail() headers, but that didn't
> seem
> to make a difference. If anybody knows anything about this and could
> point
> me in the right direction, I'd appreciate it.
Works for me...
$from = 'digital.tarsier
gmail.com';
$headers = "From: $from\r\n";
$headers .= "Reply-to: $from\r\n";
$headers .= "Return-Path: $from\r\n";
mail($from, 'Test', "This is a test.\r\n", $headers);
Note however, that your configuration of sendmail (or whatever is in
php.ini) could probably be configured to not accept a Return-Path
header...
CAN you run sendmail from the command line, as the PHP User, and get
Return-Path: to work?
If not, then PHP can't do it either.
That may have been the whole purpose of the tutorial...
Or, perhaps, the point was that for a static Return-Path: you could
set it in php.ini just as you would from the command line.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
I need to rebuild PHP on a Linux box (RHEL). It has been built there
before but I cannot locate the proper command line for configure --
config.status is no longer accurate as configure was run with no
arguments. Is the old configure command line saved in a log somewhere?
If not is there a simple way to sort out the options that were used to
build the current version?
This is PHP 4.3.4 running as part of an Apache 1.3.x static build and
also a CLI version.
Thanks,
--
Tom
attached mail follows:
can you get the output from phpinfo()?
That is, create a file, phpinfo.php with the following
<?PHP
echo phpinfo();
?>
and then put that in your htdocs/html directory so you can browse it
with your internet browser... there should be a configure block on that
page with all the options listed
-Minuk
trlists
clayst.com wrote:
>I need to rebuild PHP on a Linux box (RHEL). It has been built there
>before but I cannot locate the proper command line for configure --
>config.status is no longer accurate as configure was run with no
>arguments. Is the old configure command line saved in a log somewhere?
>If not is there a simple way to sort out the options that were used to
>build the current version?
>
>This is PHP 4.3.4 running as part of an Apache 1.3.x static build and
>also a CLI version.
>
>Thanks,
>
>--
>Tom
>
>
>
attached mail follows:
On 8 Nov 2005 Minuk Choi wrote:
> can you get the output from phpinfo()?
Thanks. I've used phpinfo() many times but never looked at that bit of
the output. It's exactly what I needed.
--
Tom
attached mail follows:
On Tue, November 8, 2005 11:36 am, trlists
clayst.com wrote:
> I need to rebuild PHP on a Linux box (RHEL). It has been built there
> before but I cannot locate the proper command line for configure --
> config.status is no longer accurate as configure was run with no
> arguments. Is the old configure command line saved in a log
> somewhere?
> If not is there a simple way to sort out the options that were used to
> build the current version?
http://php.net/phpinfo
You should run it from the browser, and from the CLI separately, as
they could be different builds.
There is also config.nice if it was installed from source.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On 2005-11-05, Max Belushkin <m.belushkin
fz-juelich.de> wrote:
> How can this be happening? I do not know, but since a downgrade to 4.4.0
> fixed it all back proper, I am seriously beginning to suspect a problem or
> undocumented (widely documented, at least) change in PHP 4.4.1 on FreeBSD
> ports.
I've seen this problem on a FreeBSD 5.3 machine with Apache2 and PHP 4.4.1_1.
The problem looks to be a problem with mod_rewrite and PHP,
because the different scripts (MovebleType, Gallery2, Dokuwiki)
are rewriting and getting the same errors.
Maybe the following [1] thread on the FreeBSD ports lists does help you.
I (and the other sysops/users of this machine) are waiting for a patch
for this problem
(By PHP developers or maybe the FreeBSD porters, it could be a FreeBSD issue) because we
don't want to go back to 4.4.0 when it's not needed (critically fixes in 4.4.1..)
You're not the only one :-)
[1] http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027038.html
Yours sincerely,
Geert Booster
--
Geert Booster
geert
webboost.nl
attached mail follows:
Good afternoon, all -
I've had problems with auto_prepend_file off and on for as long as I can
remember. It's hit or miss, and browsing the archives, it looks like
I'm not alone. I've even written to the list on several occasions
looking for a solution, to no avail.
I think that auto_{prepend,append}_file are incredibly useful functions,
but they're crap if they don't work.
Here's the basic setup. From within Apache's config file, here's my
whole VirtualHost container:
<VirtualHost 192.168.1.51>
DocumentRoot /var/www/virtual
ServerName 192.168.1.51
ErrorLog logs/192.168.1.51-error_log
CustomLog logs/192.168.1.51-access_log combined
#begin dan's protected
directory stuff
<Directory /demo/protected>
php_value auto_prepend_file /absolute/path/to/file.php
</Directory>
</VirtualHost>
So, as you can see, nothing completely out of the 'norm. The examples
given in the manual are not all that clear, so by using absolute path
names, I'm just guessing. I have used relative paths as well - same thing.
The auto_prepend_file directive set from within php.ini, is commented
out, as to not overwrite my specification. I've tried leaving that
directive blank, and setting it to something completely different. Same
results.
If you guys wouldn't mind taking a few more minutes to mow over all of
this, I would *greatly* appreciate it.
Thanks
-dant
attached mail follows:
Dan Trainor wrote:
> Good afternoon, all -
>
> I've had problems with auto_prepend_file off and on for as long as I can
> remember. It's hit or miss, and browsing the archives, it looks like
> I'm not alone. I've even written to the list on several occasions
> looking for a solution, to no avail.
>
> I think that auto_{prepend,append}_file are incredibly useful functions,
> but they're crap if they don't work.
>
> Here's the basic setup. From within Apache's config file, here's my
> whole VirtualHost container:
>
> <VirtualHost 192.168.1.51>
> DocumentRoot /var/www/virtual
> ServerName 192.168.1.51
> ErrorLog logs/192.168.1.51-error_log
> CustomLog logs/192.168.1.51-access_log combined
>
>
> #begin dan's protected
> directory stuff
> <Directory /demo/protected>
> php_value auto_prepend_file /absolute/path/to/file.php
> </Directory>
>
>
>
>
>
>
>
>
> </VirtualHost>
>
>
> So, as you can see, nothing completely out of the 'norm. The examples
> given in the manual are not all that clear, so by using absolute path
> names, I'm just guessing. I have used relative paths as well - same thing.
>
> The auto_prepend_file directive set from within php.ini, is commented
> out, as to not overwrite my specification. I've tried leaving that
> directive blank, and setting it to something completely different. Same
> results.
>
> If you guys wouldn't mind taking a few more minutes to mow over all of
> this, I would *greatly* appreciate it.
>
> Thanks
> -dant
>
Wow, that example came out really badly. Let's try again:
<VirtualHost 192.168.1.51>
DocumentRoot /var/www/virtual
ServerName 192.168.1.51
ErrorLog logs/192.168.1.51-error_log
CustomLog logs/192.168.1.51-access_log combined
# begin dan's protected directory stuff
<Directory /demo/protected>
php_value auto_prepend_file /absolute/path/to/file.php
</Directory>
</VirtualHost>
Thanks
-dant
attached mail follows:
On Tue, 2005-11-08 at 13:36 -0700, Dan Trainor wrote:
[snip]
> > So, as you can see, nothing completely out of the 'norm. The examples
> > given in the manual are not all that clear, so by using absolute path
> > names, I'm just guessing. I have used relative paths as well - same thing.
> >
> > The auto_prepend_file directive set from within php.ini, is commented
> > out, as to not overwrite my specification. I've tried leaving that
> > directive blank, and setting it to something completely different. Same
> > results.
> >
> > If you guys wouldn't mind taking a few more minutes to mow over all of
> > this, I would *greatly* appreciate it.
Would you mind telling us what the problem is? You've said that you are
having problems and that you don't think you're alone, but you haven't
mentioned what the actual problem is.
--
Jasper Bryant-Greene
General Manager
Album Limited
e: jasper
album.co.nz
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand
attached mail follows:
Jasper Bryant-Greene wrote:
> On Tue, 2005-11-08 at 13:36 -0700, Dan Trainor wrote:
> [snip]
>
>>>So, as you can see, nothing completely out of the 'norm. The examples
>>>given in the manual are not all that clear, so by using absolute path
>>>names, I'm just guessing. I have used relative paths as well - same thing.
>>>
>>>The auto_prepend_file directive set from within php.ini, is commented
>>>out, as to not overwrite my specification. I've tried leaving that
>>>directive blank, and setting it to something completely different. Same
>>>results.
>>>
>>>If you guys wouldn't mind taking a few more minutes to mow over all of
>>>this, I would *greatly* appreciate it.
>
>
> Would you mind telling us what the problem is? You've said that you are
> having problems and that you don't think you're alone, but you haven't
> mentioned what the actual problem is.
>
Ah, oops.
Well, the problem is simple; it just doesn't work. No script is
prepended to the page that I access from within /demo/protected. My
prepend script consists of the following line of code:
<? echo "This is prepended.<br /><br />"; ?>
Sorry about that.
Thanks
-dant
attached mail follows:
On Tue, 2005-11-08 at 13:43 -0700, Dan Trainor wrote:
> Well, the problem is simple; it just doesn't work. No script is
> prepended to the page that I access from within /demo/protected. My
> prepend script consists of the following line of code:
>
> <? echo "This is prepended.<br /><br />"; ?>
>
> Sorry about that.
Thanks. Have you tried putting quotes around the auto_prepend_file value
in .htaccess? I'm thinking maybe Apache is messing with the path
somehow. Something like:
php_value auto_prepend_file "/absolute/path/to/file.php"
Oh, and you probably know this, but make sure AllowOverride is set
correctly in your main Apache config file; try setting it to All for
debugging this.
--
Jasper Bryant-Greene
General Manager
Album Limited
e: jasper
album.co.nz
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand
attached mail follows:
Jasper Bryant-Greene wrote:
> On Tue, 2005-11-08 at 13:43 -0700, Dan Trainor wrote:
>
>>Well, the problem is simple; it just doesn't work. No script is
>>prepended to the page that I access from within /demo/protected. My
>>prepend script consists of the following line of code:
>>
>><? echo "This is prepended.<br /><br />"; ?>
>>
>>Sorry about that.
>
>
> Thanks. Have you tried putting quotes around the auto_prepend_file value
> in .htaccess? I'm thinking maybe Apache is messing with the path
> somehow. Something like:
>
> php_value auto_prepend_file "/absolute/path/to/file.php"
>
> Oh, and you probably know this, but make sure AllowOverride is set
> correctly in your main Apache config file; try setting it to All for
> debugging this.
>
Thanks for the help -
I have tried putting quotes around the string, as well, and that yields
the same results. AllowOverride is set to All.
Thanks again
-dant
attached mail follows:
On Tue, Nov 08, 2005 at 01:36:24PM -0700, Dan Trainor wrote:
> Dan Trainor wrote:
> > Good afternoon, all -
> >
> > I've had problems with auto_prepend_file off and on for as long as I can
> > remember. It's hit or miss, and browsing the archives, it looks like
> > I'm not alone. I've even written to the list on several occasions
> > looking for a solution, to no avail.
> >
> > I think that auto_{prepend,append}_file are incredibly useful functions,
> > but they're crap if they don't work.
> ...
>
> <VirtualHost 192.168.1.51>
> DocumentRoot /var/www/virtual
> ...
> # begin dan's protected directory stuff
> <Directory /demo/protected>
> php_value auto_prepend_file /absolute/path/to/file.php
> </Directory>
> </VirtualHost>
I believe you want to use <Location> instead. The Directory path is
never going to be seen since your files are over in /var, and your
prepend is waiting for something in /demo
Curt.
--
attached mail follows:
Curt Zirzow wrote:
> On Tue, Nov 08, 2005 at 01:36:24PM -0700, Dan Trainor wrote:
>
>>Dan Trainor wrote:
>>
>>>Good afternoon, all -
>>>
>>>I've had problems with auto_prepend_file off and on for as long as I can
>>>remember. It's hit or miss, and browsing the archives, it looks like
>>>I'm not alone. I've even written to the list on several occasions
>>>looking for a solution, to no avail.
>>>
>>>I think that auto_{prepend,append}_file are incredibly useful functions,
>>>but they're crap if they don't work.
>>
>>...
>>
>><VirtualHost 192.168.1.51>
>> DocumentRoot /var/www/virtual
>>...
>> # begin dan's protected directory stuff
>> <Directory /demo/protected>
>> php_value auto_prepend_file /absolute/path/to/file.php
>> </Directory>
>></VirtualHost>
>
>
> I believe you want to use <Location> instead. The Directory path is
> never going to be seen since your files are over in /var, and your
> prepend is waiting for something in /demo
>
> Curt.
Hello, Curt -
So a Directory container's specification is never relative to the
DocumentRoot? It's my understanding that it is.
Thanks
-dant
attached mail follows:
On Tue, Nov 08, 2005 at 02:25:03PM -0700, Dan Trainor wrote:
> Curt Zirzow wrote:
> > On Tue, Nov 08, 2005 at 01:36:24PM -0700, Dan Trainor wrote:
> >>...
> >>
> >><VirtualHost 192.168.1.51>
> >> DocumentRoot /var/www/virtual
> >>...
> >> # begin dan's protected directory stuff
> >> <Directory /demo/protected>
> >> php_value auto_prepend_file /absolute/path/to/file.php
> >> </Directory>
> >></VirtualHost>
> >
> >
> > I believe you want to use <Location> instead. The Directory path is
> > never going to be seen since your files are over in /var, and your
> > prepend is waiting for something in /demo
> ...
>
> So a Directory container's specification is never relative to the
> DocumentRoot? It's my understanding that it is.
Well, perhaps not never:
<Directory demo/protected>
might work, but it is rather less implicit on where this directory
is being considered from.
Curt.
--
attached mail follows:
Dan Trainor wrote:
> Curt Zirzow wrote:
>
>>On Tue, Nov 08, 2005 at 01:36:24PM -0700, Dan Trainor wrote:
>>
>>
>>>Dan Trainor wrote:
>>>
>>>
>>>>Good afternoon, all -
>>>>
>>>>I've had problems with auto_prepend_file off and on for as long as I can
>>>>remember. It's hit or miss, and browsing the archives, it looks like
>>>>I'm not alone. I've even written to the list on several occasions
>>>>looking for a solution, to no avail.
>>>>
>>>>I think that auto_{prepend,append}_file are incredibly useful functions,
>>>>but they're crap if they don't work.
>>>
>>>...
>>>
>>><VirtualHost 192.168.1.51>
>>> DocumentRoot /var/www/virtual
>>>...
>>> # begin dan's protected directory stuff
>>> <Directory /demo/protected>
>>> php_value auto_prepend_file /absolute/path/to/file.php
>>> </Directory>
>>></VirtualHost>
>>
>>
>>I believe you want to use <Location> instead. The Directory path is
>>never going to be seen since your files are over in /var, and your
>>prepend is waiting for something in /demo
>>
>>Curt.
>
>
> Hello, Curt -
>
> So a Directory container's specification is never relative to the
> DocumentRoot? It's my understanding that it is.
>
> Thanks
> -dant
>
...however, I did heed your advice, and it seemed to work well. Now I'm
a but confused, unfortunately; why would this not work in a Directory
container? I thought that I had used this method in the past, with
great success.
Thanks
-dant
attached mail follows:
I can't seem to get pear to work correctly.
if I type
[/]# pear install DB
I get the usage printed out back(no error message, no action)
and if I go to the PHP-5.0.4/lib/php directory, I get
[PHP-5.0.4/lib/php]# pear install DB
<br />
<b>Fatal error</b>: Call to undefined function: getoptions() in
<b>/usr/bin/pear</b> on line<b>34</b><br />
I tried with PHP-5.0.3 and PHP-5.0.2 with the same result. With some
google-assisted digging, I found that PEAR/Command.php doesn't have a
getOptions function defined... but instead of me trying to overwrite a
file or two, I'd like to ask this question
Is PEAR broken with PHP5?
I mean, I tried re-installing it... (only PHP-5.0.2 - PHP-5.0.4) and
pear or pearcmd.php doesn't work. It worked fine for PHP 4, so I'm a
little surprised. Any insight?
Minuk
attached mail follows:
Are variables that are stored in the $_POST[] array ever communicated to the
browser?
Im using PHP sessions, and I store lots of variables in $_POST[]... If I use
$_POST[] to communicate variables from 1 php script to another, is that
insecure?
--
for only the most hard core geekstas...
http://geekstasparadise.blogspot.com
attached mail follows:
Tony Di Croce wrote:
> Are variables that are stored in the $_POST[] array ever communicated
> to the browser?
It's quite the opposite. $_POST is populated with data from the content
of a POST request sent by the browser.
> Im using PHP sessions, and I store lots of variables in $_POST[].
Can you elaborate? Do you mean $_SESSION?
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
On Tue, November 8, 2005 3:10 pm, Tony Di Croce wrote:
> Are variables that are stored in the $_POST[] array ever communicated
> to the
> browser?
>
> Im using PHP sessions, and I store lots of variables in $_POST[]... If
> I use
> $_POST[] to communicate variables from 1 php script to another, is
> that
> insecure?
http://php.net/phpinfo
will dump $_POST (and everything else) to the browser.
And you could, at some point in debugging, use var_dump($_POST).
But in the normal course of events, the data in $_POST isn't sent
"back" to the browser by PHP under the hood.
That said: You should not be cramming things into $_POST.
$_POST is what comes *FROM* the browser.
Treat it as "read only" unless you want to make yourself miserable
down the road some day.
What are you putting into $_POST and why?
And how does that communicate from one script to another???
Are you cramming things into $_POST and then passing them on through
cURL or something???
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
I have had to move an application for a client from a dedicated server
to a shared server. On the dedicated server, the path to the
attachements was an absolute address of
"/home/sites/home/web/php/images/raceschd.pdf";
and all worked fine when I gave that as the location of the attachement:
if ($Attachment) {
$mail->AddAttachment($Attachment);
}
Now I am not sure where/how to specify the location of the attachment.
If anyone has experience with a shared server, I would appreciate any help.
The URL to the site is
http://64.202.163.82/s/f/y/sfycadmin/html/
And with FTP that is the base or root. I have tried putting the file in
that directory, but SendMail() does not appear to connect to it.
Todd
attached mail follows:
I figured it out! The base location for SendMail is the php directory.
Now that I think about it, that makes sense.
Todd
Todd Cary wrote:
> I have had to move an application for a client from a dedicated server
> to a shared server. On the dedicated server, the path to the
> attachements was an absolute address of
>
> "/home/sites/home/web/php/images/raceschd.pdf";
>
> and all worked fine when I gave that as the location of the attachement:
>
> if ($Attachment) {
> $mail->AddAttachment($Attachment);
> }
>
> Now I am not sure where/how to specify the location of the attachment.
> If anyone has experience with a shared server, I would appreciate any help.
>
> The URL to the site is
>
> http://64.202.163.82/s/f/y/sfycadmin/html/
>
> And with FTP that is the base or root. I have tried putting the file in
> that directory, but SendMail() does not appear to connect to it.
>
> Todd
attached mail follows:
On Tue, November 8, 2005 4:00 pm, Todd Cary wrote:
> I figured it out! The base location for SendMail is the php
> directory.
> Now that I think about it, that makes sense.
Personally, I would recommend finding out what the absolute path is
anyway.
You'll need it sooner or later.
Unfortunately, on SOME webhosts, this is well-nigh impossible.
They've got some funky-[bleep] system going on that alters "/" for
your PHP scripts, but only in some of the functions...
I assume that's what "chroot" means...
Anyway, it's a real PITA.
Using http://php.net/phpinfo and intentionally creating an error in a
PHP script (so PHP tells you what file you are in) will generally lead
you to the Truth.
Note to hosts:
If you're going to do that to the customer, you'd damn well better do
it right and make it consistent, and you'd better provide them with
the correct full path to their home directory.
Otherwise, you'll have angry frustrated clients/developers, and people
doing really stupid things like putting non-public resources in their
web-tree just so they can FIND the damn thing themselves.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, November 7, 2005 1:45 pm, Gustav Wiberg wrote:
> File_exists doesn't seem to work with URLs that point to another
> domain.
> What to use?
>
> $x = fopen(http://www.stammis.com/getstart.php);
There are no quotes on that URL... I'd be surprised if this doesn't
error out, but maybe you just need E_ALL to see the E_NOTICE you've
been ignoring.
At any rate, you need quotes, whether you realize it or not.
> if file_exists($x) ....
$x, at this point, is either FALSE because fopen() failed, or an open
file handle.
file_exists() expects the path to a file name (a string).
Perhaps you meant:
file_exists("http://www.example.com");
http://php.net/file_exists specifically links to the kinds of
stream-wrappers that are and aren't supported. Did you read that?
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, November 7, 2005 11:31 am, Paul Williams wrote:
> I'm relatively new at coding PHP but I was hoping someone can help me
> with
> this.
>
>
>
> I'm trying to write the following code into my program but each time
> it
> runs, I get an error message. Can anyone help?
>
>
>
> print <<<< EOF
You've got one too many <'s in there...
print <<<EOF
> <!-INSERT HTML HEADER HERE -->
>
> $_SERVER['PHP_SELF']
>
>
>
> EOF;
This MUST be in the far left column to work reliably, with no
preceding spaces or tabs.
Can't tell for sure from email if you did that.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, November 7, 2005 2:06 am, Manoj Kr. Sheoran wrote:
> Hi All,
> To create fdf with text info is very simple but I am wondering how to
> convert a PNG image into pdf file?
As I recall...
You don't.
You convert it to JPEG and pull that in.
Actually, libPDF may support PNG now, and maybe even GIF.
But back in the day, GIF was definitely "out".
I had a ton of thumbnails that had to JPEG to get converted for this
very reason.
http://php.net/pdf
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, November 7, 2005 9:20 am, Manoj Kr. Sheoran wrote:
> PNG doen't support CMYK color scheme that's why I want to convert it
> in JPG
> first and then I want to create pdf file from that PJG file. I created
> pdf
> file from PJG using fpdf but no idea that how to I convert PNG to jpg
> file
> (not using any third part tool only uing php).
http://php.net/gd
This will let you imagecreatefromgif() and then imagejpeg()
Though, technically, it is using a 3rd party tool (GD) and not "just"
PHP.
Of course, that could be said of about 99% of what's in what you
probably think of as "just" PHP...
--
Like Music?
http://l-i-e.com/artists.htm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]