Domain: php.net
Stories and comments across the archive that link to php.net.
Comments · 1,658
-
PHP 4.3.2 Release SummaryMajor changes, from the release Announcement:
- Fixes several potentially hazardous integer and buffer overflows.
- Fixes for several 64-bit problems.
- New Apache 2.0 SAPI module (sapi/apache2handler, enabled with --with-apxs2).
- New session_regenerate_id() function. (Important feature against malicious session planting).
- Improvements to dba extension.
- Improvements to thttpd SAPI module.
- Dropped support for GDLIB version 1.x.x (php_gd.dll) on Windows.
- An unix man page for CLI version of PHP.
- New "disable_classes" php.ini option to allow administrators to disable certain classes for security reasons.
-
Re:pick your hardawre more carefully
If you absolutely must do something on Windows, use Python, Perl, and/or wxWindows rather than VB.
Uh, don't forget php! /SHAMELESS PLUG -
Re:changes to note
Have they fixed the "arrays don't deep copy" problem yet? Man, that bites.
-
Re:Apache & PHPAlthough PHP is available for many other web servers and is capable running as a standalone scripting engine, the PHP Project under the Apache Software Foundation umbrella (as stated on the front page of php.net). I'm not sure when the change took place though.
So it make some sense putting it under the Apache section, though putting it under the Developers section as well as Apache, and PHP would have been a better choice.
-
Re:Performance
I've seen no particular performance issues running on Red Hat 7.1 and 7.3.
The only negative effect that I've seen has been that it maxes out my DSL's upload and thus SSH connections over the same pipe suffer.
If there is a CPU hit, though, it's probably because BT uses sha1 to validate the file segments. If you are getting 1+ Mb of bidirectional bandwidth (rather than the ~200-300 Kb that I see with ADSL )this might become more of an issue.
-
php.net?I've always admired the design of php.net. Maybe it's because I spend so much time there (the manual) and I've grown used to it, but I find it easy to navigate and read. On top of the straight design stuff, they also have a lot of neat "features" that really add to the site design:
- Smart URLs (http://www.php.net/echo will take you to the "echo" manual page)
- Smart 404s - mistype a URL and it'll essentially perform a search instead and come up with suggestions
- "view source", as in view the PHP source that generated the page, anywhere.
- ACCESSKEYs used liberally in the HTML to ease keyboard navigation
- Intelligent language accomodations - urls all have the language code so it's obvious and simple to switch languages. Plus, you can cookie your preferred language.
There's probably lots of stuff I've forgotten or don't know about, but to me it seems clear that the PHP folks take their website seriously and have spent considerable time improving usability.
A couple of neat links:
-h3
-
php.net?I've always admired the design of php.net. Maybe it's because I spend so much time there (the manual) and I've grown used to it, but I find it easy to navigate and read. On top of the straight design stuff, they also have a lot of neat "features" that really add to the site design:
- Smart URLs (http://www.php.net/echo will take you to the "echo" manual page)
- Smart 404s - mistype a URL and it'll essentially perform a search instead and come up with suggestions
- "view source", as in view the PHP source that generated the page, anywhere.
- ACCESSKEYs used liberally in the HTML to ease keyboard navigation
- Intelligent language accomodations - urls all have the language code so it's obvious and simple to switch languages. Plus, you can cookie your preferred language.
There's probably lots of stuff I've forgotten or don't know about, but to me it seems clear that the PHP folks take their website seriously and have spent considerable time improving usability.
A couple of neat links:
-h3
-
Re:Why PHP?
Bah.
You don't need quotes and brackets if you actually learn PHP's full string handling syntax: http://www.php.net/manual/en/language.types.string .php
Notice that there are actually several methods of variable escaping and quoting available, even complex variable parsing in heredocs format.
-
Re:previous version was good
This goes someway towards dealing with point 2 but I agree that books almost always provide a better all-round experience than google for a new skill.
-
Re:PHP 5?
I don't know if the book does, but you can take a look at this PDF:
http://ny1.php.net/introtophp5.pdf.
It'll give you an idea about some of the things you can expect, like being about to introduce private methods. -
what about PEAR and the PFC?
What will really allow PHP to compete head-on with ASP.NET and SharePoint is PEAR and the PEAR Foundation Classes (PFC). A really good set of classes for web development means low-cost, robust web apps are on the way. You java gurus can eat your hearts out. The reviewer doesn't say if the book covers either of these topics, so hold off on your purchase until this becomes clear.
-
One reason why online docs are better than a bookI own this book, and it's a good one (it has a lot of examples, and the chapter on generating PDFs was interesting, for example). I'd actually recommend O'Reilly's Web Database Applications with PHP & MySQL, however. I think the example code is better, and it went into individual details of MySQL and PHP more. You're exactly right about one thing: once you've used either book for any length of time, they become obsolete. PHP moves pretty fast, and even small revs of MySQL can contain lots of new features. Both the PHP and MySQL web sites are excellent references which a book just cannot compete with, no matter how good it is.
An interesting side note: the MySQL people "stole" (Rasmus Lerdorf's words, not mine) php.net's webmaster. For a long time now, I've gotten very used to typing things like php.net/mysql_pconnect in the location bar of my browser and getting redirected to the right page in the online docs. MySQL's new webmaster brought that feature with him, so you can do things like mysql.com/select and get answers fast. (If you want to do this on your site, it's actually fairly simple. Check out lerdorf.com/tips.pdf. Look midway through for a slide on the $PATH_INFO environment variable.)
The web sites obviate both books for all but beginners, IMO.
-B
-
Re:Why not Online Documentation ?
Ok, then how about downloadable documentation?
-
Re:PHP 5? (ummm)
PHP is *not* ready for "production" the latest stable release is here: http://qa.php.net/ if you are wanting to *look* at the development version then http://snaps.php.net specifically states that they are "DEV" versions, and from personal experience these are unstable and not all functions are fully supported (i.e. try compiling in IMAP support and you will see)
The dev versions should not be use in any sort of production environment until they have been realeased as stable, these change everyday and anything you code with it one day, might be broken tomorrow.
I am speaking from experience here. -
Re:PHP 5? (ummm)
PHP is *not* ready for "production" the latest stable release is here: http://qa.php.net/ if you are wanting to *look* at the development version then http://snaps.php.net specifically states that they are "DEV" versions, and from personal experience these are unstable and not all functions are fully supported (i.e. try compiling in IMAP support and you will see)
The dev versions should not be use in any sort of production environment until they have been realeased as stable, these change everyday and anything you code with it one day, might be broken tomorrow.
I am speaking from experience here. -
php.net
While I haven't read this book or the previous edition. If you are wanting to learn the language and don't want to pay for the book, php.net and phpbuilder.com are two of the best sites available. They post have good references and PHPbuilder has a very useful forum in case you get stuck.
-
Re:PHP is a mess - try out ZOPE
Zope may be good and if you want to use it GREAT.
But you can easily control what sort of errors you see in your php scripts so your message is complete BS.
Try looking for the function error_reporting at php.net if you want to control what sort of errors you see in your scripts. It's always good to turn the error reporting way up while you are testing. -
Re:Actually PHP is a hack of a language
Dude. uksort().
"uksort -- Sort an array by keys using a user-defined comparison function."
array_merge() also exists...
Just keep reading the manual and you'll find what you need. :) -
Re:Actually PHP is a hack of a language
Dude. uksort().
"uksort -- Sort an array by keys using a user-defined comparison function."
array_merge() also exists...
Just keep reading the manual and you'll find what you need. :) -
Microsoft Buys PHP
In a rather sad state of affairs, Microsoft and PHP have jointly announced that PHP will become a core part of the next Windows release. However, MS will take over hosting for PHP, and the license will become "more restrictive."
The cool part about this deal is that it would be extremely easy to write a worm in PHP, if only it had a popular operating system to back it. Now that's become the truth. Thanks to PHP's mail() function, worms and trojans will spread like wildfire as soon as the next Windows ships with PHP. -
Until people start using PHP?
I'd have to say that more than a few people are using PHP. In fact, of the available Apache modules, guess which one is the most popular? (Hint: it's not PyApache or even mod_perl by a long shot)
-
get yer hands out of my server closet
Call me skeptical, but did occur to anyone else that Microsoft picked FreeBSD because
1) they despise the GPL for what it represents and
2) Mono is being developed on Linux?
Don't get me wrong, I run several FreeBSD servers and prefer the ports system over RPM. It just unnerves me when the Microsoft marketing machine starts mucking around on my chosen platform.
As a postscript, you all should be aware that PHP may well become the best platform for deploying .NET. Here's why and here's why this is irrelevant. -
Free Alternatives
Even as a professional web developer I cannot help but feel that books like these are, useful as they may be, totally redundant and devourers of perfectly good shelf space. The intricacies of setting up, maintaining, and administering a Linux webserver are numerous enough to warrant their own book and I suspect that one would be better suited buying a text on that particular topic and sticking to online resources for the others.
The Internet is teeming with websites full of introductory material such as this. I'm almost positive that to establish a respected computing site you are required to have an Apache and/or mod_perl tutorial; these are so unnervingly common that one would think the entire world is stuck in a cycle of endlessly installing Apache. It's a great credit to the creators that it is so easy to install and administrate that the entire process of setting up a production-ready server can be covered in a few poorly-written online tutorials. Why buy a book if your needs can be satisfied by a quick Google search?
I'll admit that the subjects of Apache and Linux administration may be too complex without a handy book, but PHP and perl? PHP's online manual is absolutely superb. No matter the size of the project or its complexity, if I have a question it will most assuredly be answered by a quick rifle through the documentation. And perl? PerlMonks is all you need. The monastery blows my mind.
I'll be the first to recommend books on operating system design, theory, and microprocessor internals, and in fact my shelves are lined with them. It is, however, the unfortunate truth that introductory material is everywhere on the Internet but getting any deeper will require a speciality textbook; that is, of course, and not very ironically, unless you're a web developer. For the shallow depths that this book plumbs, I'd recommend saving the money for a guide to webserver administration and taking a visit to http://www.php.net and http://www.perlmonks.org. -
Re:Now extend your example....
PHP supports variable-length argument lists as well - perhaps not as effortlessly as Perl, but it's there if you need it. I've never needed it.
-
Re:This book misses the mark
For PHP public www information is better that 99% of the books out there, and in the case of this book... 100%
This book isn't oriented to you. You obviously have some PHP programming experience.
Pretend I'm new to PHP programming, and am looking looking for a good PHP book.
You say "This book sucks, go visit these URLs", but those pages are horrible.
Gee, I know that the first PEAR Meeting is in Amsterdam on May 9th at 17:30, but what the heck is PEAR. How is it related to PHP? Why should I care? I can't find a description anywhere, and the "What is PEAR" link is broken. Ack, is this a good example of good PHP development?
The phpclasses.org may be a good repository for PHP classes, but again, those are of little use to a PHP beginner.
Sure, maybe PHP for beginner books should focus more on OOP, maybe it's better then PHP structured.
But most people that I know consider OOP on PHP to be a joke and point me in the direction of something like Java or C# to learn OOP. -
Templating
Try XSLT.
It's powerful, has it's own php extension (instead of php classes like smarty and patTemplate -- although, come to think of it, the extension is just a Sablotron API so meh), and it's a W3C standard. On the downside, you need to configure your environment, which can be a problem depending on your hosting solution. You'll also have to learn XSL and work with XML but the semantic web is the future so get used to it.
-
Even better
I find this manual and this one more valuable than any book. And it's free too.
-
Best PHP templates? Smarty!
Does anyone here use Smarty? We love it, and have found it to be a wonderful template engine.
It has a great user manual, but I would welcome a good PHP book that deals with Smarty templates.
smarty.php.net -
Re:Sounds good...
perhaps it's the sucky perl-like syntax
Perl-like? It's C-like, if anything, which makes it easy for someone who has experience in C or Java to pick up.
or rather, I should say the plethora of built-in functions
What's wrong with lots of built-in functions?
so many PHP purists these days insist that you can't use PHP for templating any more (thus running contrary to the original purpose of the language) and that you have to print all your html with print statments inside a single tag.
I've never come across a competent PHP developer who has said that. Hell, the official PHP site has Smarty, a template engine.
Come on... there are some valid gripes about PHP, no need to go make up some. -
This book misses the markOne reason why PHP gets such a bad undeserved rap, is because much of the PHP code that's written out there today is a nightmare.
You have uncommented code with embedded HTML that is database specific. Don't get me wrong... if you have a small project that works with a quick hack, then that's ok.
With any modern PHP project, what's wrong with using templates, PEAR, and object oriented programming? Most PHP books out there tend to spin the mantra of PHP and MySQL or Postgresql without taking the time to show how to use PHP in a modern context where it deserves to be. Thus much PHP programming gets scoffed at because it tends to be unmaintainable.
I'm sorry, but at this point I'm unable to recommend almost any of the PHP books out there. They mostly encourange terrible PHP system development practices -- embedded HTML, database specific coding, non OOP development.
There are a few sites that are showing the light. phpclasses.org only has OOP based PHP programs and the tools you need to use templating, mailing, databases in a thoroughly modular manner, and dont forget the PEAR site which documents and make available the excellent PEAR classes for PHP.
A few other sites also are preparing PHP libraries and development environments that are a joy to work with.
For PHP public www information is better that 99% of the books out there, and in the case of this book... 100%
-
Re:Why WOULD you use classes and objects?
Unfortunately, in PHP4 (at least, not sure about 5) the native DB connection functions are named by the database they connect to. So, you have a function called mysql_fetch_array, another one (for PgSQL) called pg_fetch_array, and so on. That's why there is the PEAR DB database abstraction layer and ADODB (another one, this time with an ADO-style syntax). That's right, natively it's just that ugly. Does anyone know if they've changed it in 5?
-
Re:Not just a PHP problem
Low commentation (for godsakes, use # and throw in at least a few words every now and then
Offtopic, but, FYI, use of perl/shell style comments is discouraged by PEAR. I think if PEAR standards were more visible, we'd see less freakish code. Although, why they choose to use Allman over 1tbs is beyond me (-:
-
Re:PHP Design
I have been saying for years now that PHP design needs to be somewhat standardized so that we can all make our mods fit better.
Fit better with what? If you want a standard Web site, there's plenty of content management systems out there with a variety of module interfaces to choose from. If you want hard-core general purpose modules, look no further than PEAR.
If you're suggesting there ought to be something between those 2 then go ahead and start a project, but I think there's plenty of open-source infrastructure out there already.
If you're suggesting that there's a wide variety of PHP crap out there, then I agree wholeheartedly, but unfortunately there is no solution. The easier a language is to get into, the more beginners will release a bunch of crap for it. Your only option is to learn to sort through it.
-
Availble at talks.php.net
For those who can't enter the pages at ny1.php.net, it seems you can get 'em at talks.php.net (counting 34 pages).
Enjoy. -
Some demo!I went to a mirror, and this example just doesn't look right:
Perhaps the mirror was using PHP 4?<?php
namespace Language { ...
class Perl {
function exec_stmt($stmt) {
$command = escapeshellcmd($stmt);
system("echo $command | perl");
}
}
...
}
$p = new Language::Perl;
$p->exec_stmt("print 'Hello Freaky Deaky World!'");
?>
Parse error: parse error in /local/Web/sites/talks/presentations/slides/php5in tro/namespace.php on line 2 -
Re:Java? Hardly.
>You can throw it on top of an application layer to do the real work.
>Last I checked, you could only use SOAP to do this - has anyone tested how well that performs?
When did you last check, PHP3? PHP has had a Java binding, a Corba binding, and a COM binding for years (since early PHP4). And you can extend PHP with C if you need speed (rather than a more robust OO environment), you can even write your c code inline with php (see Inline_C) for a cool pear package.
The added OO features (and more importantly for speed matters, the fact that objects are now passed by reference and not by value by default) are just going to be a bonus. Exception handling will be nice for large projects.
>Just curious, how can you have an object model without namespaces? Or interfaces for that matter?
The objects in PHP where initially just glorified arrays (like Javascript). However, interfaces and namespaces -- useful as they are -- are certainly not necessary for an object model. You can do very nice OO programming in C if you are disciplined enough. You don't really need the language to hold your hand.
-
Re:PHP5 wishlist - Session Variables
System-wide objects are VERY easy to implement in PHP currently. Just use shared memory and sems....
For more information please see: http://www.php.net/manual/en/ref.sem.php
"This module provides wrappers for the System V IPC family of functions. It includes semaphores, shared memory and inter-process messaging (IPC).
Semaphores may be used to provide exclusive access to resources on the current machine, or to limit the number of processes that may simultaneously use a resource.
This module provides also shared memory functions using System V shared memory. Shared memory may be used to provide access to global variables. Different httpd-daemons and even other programs (such as Perl, C, ...) are able to access this data to provide a global data-exchange. Remember, that shared memory is NOT safe against simultaneous access. Use semaphores for synchronization. "
Please note that: "No external libraries are needed to build this extension."
-
Re:Where is the unified database interfase ?
I am waiting PHP can get something like that !
It's called PEAR DB and it already exists... Although, admittedly, it's not nearly as slick as JDBC and not quite as powerful as DBI. -
Re:Where is the unified database interfase ?
It does of course it still sucks, its not near as powerful as Perl's DBI but its a start and its much better than stupid_function_names()
-
the unified database interface is already in PEAR
See: pear.php.net
-
actually, if you read the article
(here's the pdf)
... many of the changes made bear a striking resemblance to the Java way of doing things Which is hardly a "flame," as one poster accused the article submitter; Java is (still) one of the cleanest language designs around, and gets a LOT of things right. -
Re:run PHP as a CGI
Especially after you upgrade to PHP 4.3.1 which was released with a fix for a serious CGI vulnerability
:)
advisory from php.net
-
WORKING LINK (for now)
http://talks.php.net/show/php5intro
Not trying to karma-whore, I just thought I'd use my +1 for something good because nobody seemed to notice the AC link. -
Re:Suexec-like support?
PHP has a semi-equivalent functionality already built in. You can set the open_basedir directive. It limits a script's ability to perform file operations based on the directory set, or the working directory of the script. For example, if you set it to "." (meaning working directory), and script resides in
/home/fred/html/, that script will only be able to mess with files in it's that directory and below. It's definitely not the same as SuExec, but it's a decent way of limiting the permissions of script based on who owns it - assuming, of course, that the script's path somehow reflects who owns/created it. More from the site -
Re:url
or click this
-
PHP docs are a great example.
My favorite docs are at the PHP Site. What I like is that they are first and foremost very complete and well organized but what I also have grown to really appreciate is the notes that are made within each section. It's very easy to document bugs or unexpected bahavior in that system. That said, I suspect that a lot of time and effort went into the PHP documentation. I would bet that a wiki system would work as long as a developer starts with a comprehensive outline and a developer or trusted individual combs the docs regularly to correct poor and inacurate information and to consolidte ideas. Actually what I think would be the ultimate system would be a Wiki with restricted access along with an unrestricted attached message board (like php.net). This would allow the people who really want to get involved to have access to the the entire system and allow casual users to contribute and discuss issues without breaking the core.
-
too many books for php...are they useful ?
Every week I see a new php book, about "profesionnal php", "php and mysql", "web apps with php"...but I'm not really sure that developpers need to buy books to learn php. I see no feature of this language, that need to be explained in a whole book.
ALL is in the online documentation, which is pretty good. More : php5 will soon be here...with that time, many new features (better OOP ie).
Ok, leave me alone now ! I need to concentrate, as I'm writting a "learning php5" book :) -
Re:Perl is turning into a completely new language
Then as time so pass, more and more "features" are added into perl 5.004 and the result is that now you have too many features spoils the broth.
I'm sorry. I think you are looking for this every-feature-is-in-the-core language.
Glad to point you in the right direction!
enoch -
Re:Printing is sooooo last centery.
As I said in another thread I'd love to. Just give me the ability to enter notes with the document and preserve them. The PHP documentation is actually a reasonable example of what I'm after. A lot of times the notes I've appended to the documentation are worth more than the documentation itself.
-
2 kind of booksI choose (well, when I can) what format I want for a book based in how I will read it.
If its a conceptual book to be read from first page to last (i.e. DNS and BIND, or Web Database Applications with PHP and Mysql to name a few) I prefer them in paper, so I can read them in bed, in the bathroom, in a bus or in the beach, where I'm more comfortable for the time that I will be reading it... at least, for the first time is a must.
In the other hand, books like the "in a nutshell" series, or dictionary-like books, or books where I have to read or focus only in one chapter without having to read all to understand, are best reading in a computer. In this category I surely put "books" like the PHP annotated manual. Also for this are best the "cookbooks" or the books that would be useful to have cut and paste. Or even the conceptual books of the first kind, once you have readed it in a printed version and the concepts are enough, but you have to verify something or reread some chapter.