Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

PHP Debugging

News

PHP as Visual Basic of the Web

Recommended Links

 DBG | PHP Debugger and Profiler

Komodo IDE Humor Random Findings Etc

PHP does not have built-in debugger and as such is inferior scripting language to Perl, Python and Ruby. When push comes to shove, the simple fact is that almost anyone can learn the syntax and grammar of PHP well enough to write programs. However, as applications and projects become larger, the method of finding errors provided by the language became as important as the language itself. PHP sucks in this respect. It is inferiour language. No question about it.

The most well know debugger for PHP is DBG debugger. There are several external tools that are based on DBG debugger. They include Dev-PHP , Komodo and Eclipse.

Another free PHP debugger is Gubed and PECL. The latter is a full-featured profiler/debugger that is loaded as a zend_extension. It aims to be an analog of C's gprof or Perl's Devel::DProf.

Xdebug is debugger based of Xdebug protocol. Xdebug 2 is a true multi-language protocol. This means that a client written for Xdebug 2 will also work in combination with the Perl, Python, Tcl and XSLT debuggers from Active State. For a description of (a draft) of this new protocol, see the documentation - protocol page. The development of the protocol is sponsored by Maguma and will also be implemented in Maguma Studio 2.

PSD - A visual frontend for debugging PHP. It runs on Win98SE and newer and can be used remotely. [Freeware]


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Nov 28, 2005] Five common PHP database problems

Discover five common database problems that occur in PHP applications -- including database schema design, database access, and the business logic code that uses the database -- as well as their solutions.

[Nov 25, 2005] Debugging techniques for PHP programmers

Explore various methods for debugging PHP applications, including turning on error reporting in Apache and PHP, and by placing strategic print statements to locate the source of more difficult bugs through a simple example PHP script. The PHPeclipse plug-in for Eclipse, a slick development environment with real-time syntax parsing abilities, will also be covered, as well as the DBG debugger extension for PHPeclipse.

[Aug 12, 2004] PHP Debugging Basics by David Sklar

Program checking is not bebugging.

Whether you're a PHP newbie or a wizard, your programs are going to have bugs in them. Nobody's perfect. This article gives you some techniques for finding and fixing the problems in your programs. It covers three topics:

Configuring Error Reporting

First of all, you need to configure the PHP interpreter so that when an error happens, you can see information about it. The error info can be sent along with program output to the web browser. It can also be included in the web server error log. A common way to set things up is to have error output go to the web browser when you're debugging your program, and then to the web server error log once the program is finished and (supposedly) working properly. That way, web site users can't see any potentially sensitive data included with error output.

To make error messages display in the browser, set the display_errors configuration directive to On. To send errors to the web server error log, set log_errors to On. You can set them both to On if you want error messages in both places.

An error message that the PHP interpreter generates falls into one of five different categories:

You don't have to be notified about all of the different error categories. The error_reporting configuration directive controls which kinds of errors the PHP interpreter reports. The default value for error_reporting is E_ALL & ~E_NOTICE & ~E_STRICT, which tells the interpreter to report all errors except notices and strict notices.

PHP defines some constants you can use to set the value of error_reporting so that only errors of certain types get reported: E_ALL (for all errors except strict notices), E_PARSE (parse errors), E_ERROR (fatal errors), E_WARNING (warnings), E_NOTICE (notices), and E_STRICT (strict notices).

Because strict notices are rare (and new to PHP 5), they are not included in E_ALL. To tell the PHP interpreter that you want to hear about everything that could possibly be an error, set error_reporting to E_ALL | E_STRICT.

PHP Debugging PHP - Manual

Table of Contents
About the debugger
Using the Debugger
Debugger Protocol
About the debugger

PHP 3 includes support for a network-based debugger.

PHP 4 does not have an internal debugging facility. You can use one of the external debuggers though. The Zend IDE includes a debugger, and there are also some free debugger extensions like DBG at http://dd.cron.ru/dbg/, the Advanced PHP Debugger (APD) or Xdebug which even has a compatible debugger interface as PHP 3's debugging functionality as is described in this section.


add a note User Contributed Notes
Debugging PHP 13-Sep-2006 09:51 NuSphere Php IDE PhpED (www.nusphere.com) includes dbg from dd.kron.ru actually online _ use _ only == hotmail.com
15-Mar-2006 04:41 I still find that printing out variable values at problem points in the code is one of the easiest ways for me to debug. If you're interested in knowing the full contents of an object/array/scalar, then use

var_dump($var). linus at mccabe dot nu
24-May-2004 02:04 Another free (GPL) debugger is Gubed, http://gubed.sf.net .
Currently available for Linux, but also Windows soon.
tulpe at atomar dot de
07-Feb-2003 08:09 Tired of manualy printing out your variables and arrays for debugging?

Take a look at my debuglib at:

http://www.atomar.de/public/code/debuglib/debuglib.demo.php

Happy debugging!

Thomas Sch?/span> joe_fitchnospam at hotmail dot com

17-Dec-2002 01:15 I've tried many debuggers and PHP IDEs including Zend IDE, Komodo, PHPEdit, PHPEd and Maguma Studio.
After all I'm sure that the best one debugger is dbg. It supports breakpoints even conditional ones, all kind of steps throu php code, watch etc, so it's a fully functional debugger indeed and profiler too. Fortunately, it's an open-source product as PHP itself. Unfortunately, it does not contain any front-end, but 3rd party PHP IDEs. Seems, as for an IDE the best one is PHPEd 3.1 (http://www.phped.com), former PHP IDE from Ergin Soysal.
I was also deeply impressed with IonCube accelerator performance (http://www.ioncube.com). Commercial version of IONCUBE is many times faster than the commercial one from Zend (www.zend.com). Huh ?
Hope this info would help someone to find the better way faster.

23-Aug-2002 12:51 check out this great, cross-platform, my favourite php debugger:
http://www.activestate.com/Products/Komodo/

it not only allows "debugging PHP programs locally or remotely, including debugging in CGI or other Web Server API environments", but, besides, is a full fledged Perl, PHP, Python, Tcl, and XSLT IDE. based on mozilla.

current version 1.2.9 costs some money ($29.50 non commercial), previous version 1.1 is free (non commercial).

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

PHP Command Line Use
PHP has steadily progressed to the stage that command line usage of the PHP.exe is easier than ever before; especially with the new PHP 5 betas. This is most fortunate because it makes testing out little scriptlets of PHP code easier than ever. And with the new OOP and XML capabilities of PHP there are plenty of opportunities to test PHP fast and easily with command line test scripts and even simple batch harnesses that rip through 10 variations on a OOP definition theme. The side benefit ? Users suddenly discover that with regular expressions, great database connectivity, always great file I/O operations, easy array manipulation - in short the whole legacy Perl-like and enhanced features, PHP makes a great OS scripting agent.

The figure below shows the command options available when running PHP in command line mode.

SourceForge.net: PHP debugger DBG

DBG is a full-featured PHP Debugger and Profiler. Makes it easier to find problems or bugs in PHP scripts. DBG supports back-tracking, watching variables, viewing arguments passed to all nested function calls at any point of execution. Opensource.

DBG PHP Debugger and Profiler. -- home site of DBG debugger

Debugging techniques for PHP programmers

Zend Technologies - Beginner Tutorials - JavaScript Powered PHP ...

PHP: Debugging PHP - Manual

Komodo 3.1 - Online Docs : Debugging PHP

12 Steps to a Bigger, Better, Debugger evolt.org

Recommended PHP reading list

"Debugging techniques for PHP programmers"
Explore various methods for debugging PHP applications, including turning on error reporting in Apache and PHP, and placing strategic print statements to locate the source of more difficult bugs through a simple example PHP script. The PHPEclipse plug-in for Eclipse, a slick development environment with real-time syntax parsing abilities, is also covered, as is the DBG debugger extension for PHPEclipse.
"PHP Performance Profiling"
Learn how to use the Advanced PHP Debugger (APD) to profile your PHP code. Code profiling helps you identify bottlenecks or inefficient code in your application, enabling you to tune the code where needed.
Advanced PHP Debugger
The Advanced PHP Debugger (APD) is a Zend extension that provides traces suitable for debugging and profiling code, as well as full stack backtrace. Events-based logging is also supported, so different levels of information logging can be set on a script by script basis.
Xdebug
Xdebug is an extension that offers debugging information, including full traces and function/line indicators. Xdebug also includes profiling and script execution analysis.

Last updated: March 12, 2019

0 0 * * 1-3 /usr/bin/feeder.php

causes the script to be executed at midnight, Monday through Wednesday.

In order to change the contents of your crontab file, you need to use the crontab utility, which also automatically edits the correct file and notifies the dæmon that your schedule has changed. There aren't any special requirements to run a PHP script as a cron job, as long as it does not expect any input from a user.

Manipulating HTML Code

Even though your PHP-CLI scripts are not outputting HTML through a Web server, you still can use them to manipulate and produce HTML code. Because the script is written rather modularly, converting its output to HTML format involves changing only the format_feed function and modifying the call to mail(). This is done so the e-mail message can be recognized as a valid HTML document by the user's e-mail application.

One of the greatest advantages of scripting Web pages with PHP is the ability to mix dynamic statements directly with the static HTML code. As you can see from Listing 3, which shows an updated version of format_feed, this concept still works perfectly even when the script is not outputting to a Web page.

Listing 3. A Version of the format_feed Function that Produces HTML

// Feed formatting function

function format_feed ($feed, $url)
{

  ob_start();

  if (!is_object ($feed))
  {
  ?>
    <p>
    <b>Unable to load feed at
    <a href="<?= $url ?>"?>
    <?= htmlentities($url) ?></a></b></p>
  <?php
  }
  else
  {
    ?>

    <h1><a href="<?= $feed->url ?>">
    <?= $feed->title ?></a></h1>
    <p />

    <?php

    foreach ($feed->items as $item)
    {
    ?>
        <h2><a href="<?= $item->url ?>">
        <?= htmlentities ($item->title) ?></a></h2>
        <div width=500>
        <?= htmlentities ($item->description) ?>
        <hr>
        </div>
    <?php
    }
  }

  $res = ob_get_contents();
  ob_clean();

  return $res;
}


The trick that makes it possible to capture PHP's output in a variable essentially consists of engaging the interpreter's output buffer (disabled by default) by calling ob_start(). Once the appropriate information has been output, the script retrieves the contents of the buffer, then erases it and turns output buffering off with a call to ob_end().

Where to Go from Here

Although the news aggregator script I present in this article performs a rather complex set of functions—from grabbing content off the Web to parsing XML and formatting it in HTML—it requires only about 200 lines of code, including all the comments and blank lines. It is possible to write the same script in Perl or even as a shell script, with the help of some external applications such as wget, expat and sendmail. The latter approach, in my opinion, results in a complicated code base with plenty of opportunities for mistakes.

PHP-CLI rarely is installed by default on a machine running Linux, although you can count on Perl being readily available. Thus, if you have control over the make-up of the server on which you're running scripts and you're comfortable with PHP, there's no reason why you need to learn another language to write most of your shell applications. If, on the other hand, you're writing code to run on a separate machine over which you have no control, you may find PHP a slightly more problematic choice.

Marco Tabini is an author and software consultant based in Toronto, Canada. His company, Marco Tabini & Associates, Inc., specializes in the introduction of open-source software in enterprise environments. You can reach Marco through his weblog at blogs.phparch.com.

[Nov 27, 2002] Some Thoughts on PHP

Author: John Lim
Posted: 11/27/2002; 9:37:30 AM
Topic: Some Thoughts on PHP
Msg #: 2082 (top msg in thread)
Prev/Next: 2078/2085
Reads: 8413

Some Thoughts on PHP I just received this interesting email from Derek Comartin. I thought I would share his message and my response with you.

John,

I have been reading PHPEverywhere ever since I found it about a year back. I love reading it and your thoughts about the latest tech. Just recently I started using ADOdb for a project and love it. I am not a huge fan of PEAR's DB or PEAR in general (although I am using its SOAP package).

Anyways, the real point of my e-mail is that I am really getting frustrated with PHP. I have been developing applications with PHP for 3 years now, mainly developing intranet and CMS the like. My problem is that it seems like PHP is close to what I want it todo, but not quite. I would like to hear your thoughts and the thoughts of other php developers (people that use it everyday).

Let me say first of all I have absolutely no influence on the direction of PHP. I do not have CVS access to the PHP source code, and wouldn't have the time to contribute even if I wanted to. However some people might be interested in my opinion.

To me PHP is a pragmatic language. It is not based on any formal theory nor specification. It grew the same way as Perl, due to demand from skilled hackers. However Rasmus Lerdorf and company seem to be more keen on pruning the core language than the Perl gods and keeping it really simple. For example, to me the lack of the more advanced OOP features is a blessing. I was never impressed with C++ and its complexity, although I coded in it nearly every working day for 5 years.

(BTW, sorry if this is going to get long.. my real goal here is maybe you can post this on your site and hope to get some feedback in your comments section).

1) Templates Almost everyone agrees that mixing HTML and PHP is a bad idea. Personally I have developed my own template library that is simple and thin. Since PHP is geared toward web applications why in gods name don't they develop a SIMPLE template library built-into PHP. I cannot understand for 1 minute the point of smarty? I do think smarty is a very well designed library but I don't understand the point of making a library that introduces more business logic. Isn't the point of a template to seperate buisiness logic from UI? Who is coming up with this stuff?

The development of templates was an attempt to fight against complexity. This is good. Yes PHP is a template-based language, but that doesn't mean that good techniques preclude more advanced strategies for separating code,data and presentation. For very big scripts, we split code into functions and into several include files. We store data in an RDBMS for better management. So for very big web pages, it makes sense to split it into multiple files, and split presentation to template files too. Then we have a N-layer architecture of:

DATABASE 
   |
PHP BUSINESS LOGIC
   |
PRESENTATION LAYER TEMPLATES
   | 
PHP ENGINE 
   |
APACHE

From a theoretical point of view, perhaps Smarty has gone too far. Smarty does not merely deal with presentation issues, but has a full-blown programming language built-in. There is always the temptation to add functionality to something that began as a simple project. In some ways, Smarty compiled code is obfusticated PHP :-)

However from a commercial perspective, Smarty is cool. I can release a Zend encoded PHP product, and provide customization features by basing my user interface on Smarty, which the client can modify and even script without touching my compiled code.

So it really depends on your perspective. One man's Toyota is another man's Rolls Royce. And some people refuse to learn to drive and will never see the point of using Smarty.

(BTW: I have been wondering if someone has written a template library that is something like this:

If you had a template that had a <form id="myForm"> tag, then in your PHP you could modify tag properties etc... im not sure if ASP.net does something like this.. so your code would be:

$tmpl->myForm->setAction('myform.cgi');
$tmpl->myForm->setMethod('POST');

Kinda like how Javascript can minipulate objects, you could do with any HTML tag.. ie: forms, tables, yadda yadda

There are several libraries that do this already if you search on hotscripts.com. including (wink-wink) my company's product, phpLens which goes one step further in providing graphical ui designers/wizards. And my point of view is a little bit more radical - doing this without graphical aids is a step backward. For example this doesn't excite me:

$tmpl->myForm->DrawInput('text',$size=32,$maxlength=64);

because you lose the benefits of a graphical tool like dreamweaver that recognizes input tags for the obscure benefit of coding everything as objects. Half the power of MS.NET is the graphical tools of Visual Studio.NET.

Note that I had to use $size and $maxlength before you could even guess what the parameters of the function were. The beauty of HTML is that it is self-documenting.

2) Database

Thanks to you I use a great database abstraction. But why on earth isnt there abstraction built-in? I still like having functions for a specific API, but there should be db abstraction on top of that built in for speed.

Anyways these are just my random thoughts... I love PHP but there are too many things that are beginning to piss me off (did I also mention nonsense like how functions like explode, strstr have there haystack/needle arguments in different orders? Shouldnt this be common across all functions.... ah the little things.)

What are your thoughts?

PHP was developed to meet a need. PHP has grown organically, not because it was sponsored by big companies like Sun or IBM (eg java). People originally used PHP to create web-sites where the database was probably known; in contrast, database abstraction is only required if you are creating web applications that can be installed in different environments. I rarely do web-sites, most of my PHP work is for web-applications that run on Intranets/Extranets. That's how ADOdb came about. That's how PHP came about - to meet an immediate need.

So as PHP has matured, so has the needs become more sophisticated. Some people will always want PHP to do more and grow in more powerful ways (data abstraction, 100% OOP, etc), but as PHP growth is organic, you have to wait till someone faces the problem and comes up with the solution and post it to the net. This laissez-faire approach works because the number of PHP developers has reached a critical mass (perhaps when PHP4 was released).

Of course some things could have been better planned from the beginning of PHP, but no one would have started work till the last bit of the plan was nailed solid, which would have taken too long. Instead Zeev and Andi (and Rasmus?) are still very conservative about the core language, and they let you and me build whatever we like without comment. PHP-Nuke and Post-Nuke might never have been developed if Rasmus had blessed Midgard as the way to go. Of course there are people who say that the Nuke forks cannot compare to Zope or Soup or Whatever, or that the PHP api is not as nice as Java's or Python's -- but that misses the point. Millions of people are using and benefiting from the free software when programming in Java or Python or C# would have been too difficult. And this gives impetus for people to create better software.

-- John Lim PHPBuilder.com - Introduction to PHP5

PHP5 is not yet official but the development versions are already usable (and unstable!) so we can start to learn and practice the new features of the upcoming version of PHP. In this article I will focus in three major new features of PHP5:.

* The new object model
* Exceptions
* Namespaces

First of all a couple of disclaimers:

* Some of the techniques described in this article can be done with PHP4, but are presented anyway to make the whole article more readable.
* Some of the features described in this article may change in the final release of PHP5.

PHP5 has not been released yet and I don't know when that will be but you can already try and investigate the new features of the language by downloading and installing a PHP5 development version from http://snaps.php.net. There you will find Linux and Windows versions of PHP5 ready to be used. Installation proceeds as in any normal PHP distribution so go there and grab a brand new toy.

Message # 1016053:
Date: 04/12/03 07:01
By: Marcel Swinkels
Subject: Oh my god!

If this is the future for PHP why not start using JSP? :-(

Message # 1016064:
Date: 04/13/03 11:28
By: John C. Ghormley Profile
Subject: Look like Java to me

As an old time procedural coder, I didn't continue to pursue Java simply because I can't seem to get my mind around the OO paradigm when trying to think through a problem. So PHP was a great solution. Very procedural even if not politically correct for the times. Now, it seems the powers of PHP want to make it OO. That causes me a bit of concern and the concerns are these:
1) We're adding a lot of code overhead into the PHP code base to support OO.
2) Will that additional overhead slow the response time of PHP significantly?
3) If it does, how soon will the procedural elements begin to be extracted in favor of a more politically acceptable OO?
4) Assuming there is not degradation in performance, how soon will the pressure to conform to more politically acceptable practices cause the procedural elements to disappear?

On first read, I think i'd concur with Swinkels -- why not switch to JSP?


Message # 1016192:
Date: 04/20/03 17:24
By: Scott R.S.
Subject: RE: Look like Java to me

PHP CURRENTLY (4.3.x) outruns any JAVA code and 99% of the latest .NET stuff from MicroSoft/MajorGreedy!!! Mind you I spent YEARS as a die hard MS guru building major systems for investment and retail banks as well as insurance, medical and communications sectors using MS tools. I looked at moving to Java and being something of a purist found all the OOP crap (forgive me folks) to be much ado about nothing that simply adds significant amounts of time and thus expense to projects without being able to support the speed and stability enterprise customers demand. Further while Java is somewhat portable, it still has light years to go before it can compete with .NET in terms of speed... I kept looking, and then, the BEST OF BREED, PHP!!!! Portable, powerful, FAST when it's free and when you compile it, get out of the way!!!!!!!! What a piece of software!!!! Take a look at http://www.partysite.com for some compiled PHP in action, be sure to notice the transaction timer in the lower left corner of results, then keep in mind the database has 1.7 million rows in it right now. Let's see MS or Java do that in under a second, oh that's right, THEY CAN'T!!!! The math ALONE is too much for either to support at any speed, then factor in the amount of data involved and neither can hope to touch it... I know, I was CTO of a startup that TRIED to build something for insurance companies in WINDOWS and WITHOUT any math, and only a couple hundred thousand records CHOKED and locked up the server... Want REAL power, and speed (which is simply defined as "power in excess of a given task") then build in PHP and compile it!!!! Compiling PHP is now SO MUCH more affordable with the Small business program from http://ZEND.COM that it pays to compile!!!!

Scott....

Message # 1016118:
Date: 04/15/03 08:39
By: Zeev Suraski
Subject: PHP's direction - reassurance

Just to reassure the people here that don't want to see PHP becoming an OO language - have no worries, this is not going to happen.

We've definitely added lots of OO features to the Zend Engine 2, but all of the structured code features remain intact. PHP's built-in functions are and will remain procedural. I think Jean-Marc hit it well - we want to give authors of larger-scale projects, or those that buy into the OO model, the tools to write their apps better. They've been using OO in PHP 4, but were bumping into all sorts of problems and limitations. We have no plan or will to try and encourage people to move away from procedural programming if they're happy with it.

Message # 1016603:
Date: 05/29/03 01:36
By: Excorcist
Subject: This is so stupid

I can't believe this

In PHP4 as you may already know variables are passed to functions/methods by value (a copy is passed) unless you use the '&' symbol in the function declaration indicating that the variable will be passed as a reference. In PHP5 objects will be passed always as references. Object assignation is also done by reference.

WTF is that crap??? You're trying to rip php out of it's roots and make it some kind of psuedo java. WHat the hell? If this isn't a step backwards I don't know what is. My god I can't believe this.

Message # 1016746:
Date: 06/16/03 04:34
By: Zeev Suraski
Subject: RE: This is so stupid

You should be thankful, then, that you'd be able to enable compatibility mode and have your objects behave in the same way as previous versions of PHP have, and be passed by value.

If you consider the old behavior an advantage, in any way, then I believe you've never written an OO piece of code. That's fine, by the way - as PHP 5 will definitely not force you to write OO, it'll just make it a heck of a lot easier.

Message # 1016750:
Date: 06/16/03 10:16
By: David Fells
Subject: I guess IL is next...

Seems like the php team is on the right track with finally giving try/catch exception handling and providing access modifier keywords for class members. I'm just not really convinced of the necessity in using OOP in php...

In some tests I ran recently before deciding whether to completely rebuild or just reuse some old code someone else wrote for a new project, the OOP code they wrote ran approximately 10 times more slowly than the procedural code I wrote... by simply putting what would be a "class" in it's own include file and including as needed, you still have the basic reusability of OOP without the extra compile/execute time of objects.

I'm just afraid the addition of namespaces, exception catching, catchalls, and access modifiers are only going to make the performance of OOP in PHP get worse =( I just hope they don't choose to go to an IL/JIT model to compensate ! Yuck.

Message # 1016549:
Date: 05/21/03 19:27
By: Brandon Goodin
Subject: RE: Look like Java to me

Let me preface by saying.. 'to each their own'.

Having been a long time Java programmer and currently still, I find that many of the comments that have been made in this thread regarding java are outdated and even innacurate.

I don't have the time to go back and speak on each point specifically. But, from a personal standpoint Java has been progessing as fast and furious as other technologies (including php). Short comings from 2 years ago don't apply to today.

To state some positives about Java:
- Object generation and garbage collection has improved drastically.
- Various open-source and commercial frameworks have emerged to allow for quick and efficient assembly of applications (client and server). Most use good OO design patterns.
- Because of the decoupling of various layers of the application better code management is possible. (i.e View/Controller/Logic/Data Layer/Web Services)

I encourage you all to post your statements to a Java discussion board and see what responses you get. You might learn something about Java that you didn't know.

Personally, I like php. It's a great language... for the web and for small-midsize to small jobs. I got away from the page scripting as a mainstay because it became to difficult to manage in a team environment. All of the dependencies on the view passing the right parameters to the next page and the tight coupling with the data layer in the end makes things too complex. I use good php coding standards. But, it still doesn't compete with a well formed Java envrionment. Once the job gets to a certain size I find that I can create in Java a lot faster.

I think the direction that php is going with it's Java/C# OOP look and feel is a good thing. But, even with php5 it appears it has a ways to go before it's competing with the maturity of Java/C#/Python type OOP languages. BTW for all the complaining against OOP I find it humorous that php is adopting the very principals you dislike. Procedural will always be around. But in the economy of scale (IMHO) OOP wins.

So, long live PHP OOP!!! :-))

Yahoo Goes PHP in Open Source Embrace By Ryan Naraine

Mega portal Yahoo (Quote, Company Info) has switched to the PHP scripting language for its back-end programming, a decision that's sure to bring smiles to the faces of open-source advocates.

The Sunnyvale, Calif.-based Yahoo is undergoing a switch from a proprietary system written in C/C++ to PHP (define) for its backend scripting, according to a company engineer in a case study presented this week at the PHPCon 2002 conference.

Michael Radwin, who is co-leading the PHP crusade at Yahoo, told the conference that Yahoo's size and complicate server-side software made the switch to PHP a no-brainer, pointing to the huge savings cost associated with migrating to an open-source platform.

He said Yahoo, which serves more than 1.5 billion page views a day, had already adopted open-source software like Perl (define), Apache (define) and FreeBSD (define) to run its 74 Web properties, which includes 25 international sites.

Back in 1994, when Yahoo was launched, Radwin said free technologies like PHP did not scale and were considered too "immature" to run large, complex destinations. However, the growth of the open-source movement has spurred a change in thinking because languages like PHP aid performance and integration, he explained.

The Apache-backed PHP project, which was created in 1995 by Rasmus Lerdorf, has seen startling usage growth since 1999 and its adoption by a high-profile Web property like Yahoo has sent tongues wagging in the developer community.

Because PHP is embedded within tags, code writers can jump between HTML (define) and PHP (similar to ASP and Cold Fusion) instead of having to rely on heavy amounts of code to output HTML. PHP is shipped standard with a number of Web servers, including RedHat Linux.

Radwin, who has worked as a Yahoo engineer since 1998, said proprietary scripting language became a "pain in the neck to maintain and use" and was difficult to integrate with third-party software. He said coding in C++ (define) was too cumbersome and prone to buffer overflows, making it a security risk for Yahoo.

Yahoo, which has felt the financial crunch from the online advertising recession and has been dabbling with paid services to stem the flow of red ink, said cost savings drove the PHP migration plan.

"Yahoo is a cheap company. (We) can't afford to waste engineering resources (on proprietary coding)," Radwin said, adding that the company first moved to embrace open-source technology back in 1996 when it replaced the Filo server with Apache. Since then, the company has moved some of its database management from Oracle to the open-source MySQL.

"Server-side languages is the natural next step," Radwin told the conference, touting improved features, performance and integration within PHP. Yahoo chose PHP ahead of alternatives like Perl, ASP or Cold Fusion mostly because it was designed for server side Web scripting and because of the large, open-source developer community that has helped improve the integration and training of software engineers.

He said "simple and clear syntax" in the PHP language fit perfectly with Yahoo's plans, adding that tests done by the portal were very successful.

Yahoo has already started using PHP for new properties, like the remember.yahoo.com site which was created as a September 11 tribute. Other early adopters of PHP at Yahoo included the PayDirect Site, the Classifieds - "Express" premium service, the personalized Yahoo News feature and almost the entire Yahoo Travel site.

The ionCube PHP Accelerator Home

The ionCube PHP Accelerator is an easily installed PHP Zend engine extension that provides a PHP cache, and is capable of delivering a substantial acceleration of PHP scripts without requiring any script changes, loss of dynamic content, or other application compromises.

Unlike scripting languages such as Microsoft ASP1, compilation of any unchanged scripts is entirely eliminated when PHPA is installed, and so a typical PHP request incurs no compilation overhead at all.

PHPA is free, and not only the top performing non-commercial solution of its kind, but also a match for the commercial alternatives. Delivering typically up to a 5 times speed gain and with a near 10 times speed-up measured with some Smarty based applications, sites such as Yahoo! have found PHPA to be the ideal PHP script caching solution. The testimonials give some user reactions to PHPA.

Create dynamic sites with PHP & MySQL

This tutorial shows you how to use two open source, cross-platform tools for creating a dynamic Web site: PHP and MySQL. When we are finished, you will know how dynamic sites work and how they serve the content, and you will be ready to serve your own dyn...
Publisher: www.codewalkers.com

O'Reilly Network GoLive 6 Adobe's Open Source Embrace [May. 31, 2002] by Glenn Fleishman

Author's Note -- Before GoLive 6 shipped, I would have tried to dissuade anyone but an already experienced Unix administrator or someone who needed to become one as part of a job from trying to self-install all the components needed to run MySQL, PHP, Apache, and JSP on a Mac OS X machine or under Windows XP or 2000. If you're already serving pages that need these elements and want to migrate them to a desktop server, or want to start serving content that requires these elements, the GoLive Preconfigured Servers substantially lower the bar.

In this article I'll show you where these components are located in the GoLive 6 shrink-wrap, and then once you have a handle on these tools, I'll show you how to upgrade them the good, old-fashioned, open source way.

GoLive 6 Breaks From Tradition

Adobe has never expressed close feelings for either open-source software or the Unix and Linux platforms. As Linux has risen in popularity and open source has increased in quality and availability, Adobe provided only sporadic and incomplete support. Photoshop under Red Hat? Nope. But Acrobat Reader for certain Unix flavors? Sure.

GoLive 6 marks a decided change in attitude from Adobe. In the interests of a competitive product and a complete server feature set, the company leapt into bed with Apache, Tomcat (a JSP server), MySQL, and PHP under both the Darwin environment of Mac OS X and the modern NT-style architecture of Windows XP and 2000.

As Derrick Story noted in the first article of this series, GoLive emerged from the graphic design world in which the program started as a WYSIWYG page layout tool. Over time, it evolved into a full-featured editor with support for JavaScript, Cascading Style Sheets, and Dynamic HTML, working alongside a drag-and-drop site management system.

At the same time as GoLive, Inc. (and later Adobe-developed GoLive), Macromedia pushed and pulled its own page and site tool, Dreamweaver. As GoLive became more graphically intense and expanded its reach into directly editing different kinds of media (QuickTime, images, vector art) and integrating with other Adobe graphic tools (Photoshop, Illustrator, ImageReady, LiveMotion), Dreamweaver kept climbing up the code ladder, including more and more built-in or add-on support for code development that worked alongside page and site creation.

Dreamweaver UltraDev, for instance, was a powerful package that supports authoring ASP, JSP, and ColdFusion. It integrates many kinds of databases and database conduits with page layout tools, and provides end-to-end support in the case of JSP (with their JRun server) and ColdFusion (part of their Allaire merger) for design to code to database to server testing and development. (Dreamweaver MX expands this to incorporate UltraDev, and to work with and create Web services and Web applications using JavaServer Pages, ColdFusion, SOAP, and .Net.)

GoLive lagged on the code side, and its initial foray into database integration, called Dynamic Link, only worked with ASP servers running ADO DB conduits or Microsoft Access databases. It was frustrating to configure and use, and I only know a handful of users who had the right combination of server and savvy to build a functioning system.

Adobe wisely jettisoned Dynamic Link, replacing it with Dynamic Content. The change wasn't cosmetic, but reflects instead a significant improvement in features, flexibility, and troubleshooting. GoLive 6 supports ASP, JSP, and the Internet favorite PHP for database integration of content. It also ships with a full set of preconfigured servers for both Mac OS X and the Windows XP/2000 environments. The preconfigured servers include Apache 1.3.22 with PHP 4.1.2 precompiled in; Tomcat 3.2.2, a JSP server; and MySQL 3.23.47.

For many users, the preconfigured servers allow them to suddenly tap the potential of database integration with a Web site without the vast ramp up in knowledge typically required to compile and configure server software. This package is simple to get started with, but, as with any commercial release, hard-won tips help smooth the process.

Installing GoLive 6 Preconfigured Servers

The preconfigured servers ship on a disk bound into the Adobe Web Workgroup Server manual. (More on AWWS later: it's a JSP-based WebDAV server that supports versioning via a GoLive interface.) Once installed, a set of test scripts allows some configuration and displays example results and projects.

Installing it is typically a snap. The installation system is slightly different under Windows 2000/XP and Mac OS X, but both involve a package-style graphical installer, which includes screens of instructions. The Apache/PHP and JSP servers are in the Dynamic Content folder. This single installer puts all of the software in the right place.


Related Reading

Web Database Applications with PHP & MySQL
By Hugh E. Williams, David Lane

Table of Contents
Index
Sample Chapter
Read Online--Safari


The installer allows you to set non-default ports for any of the associated applications. PHP is compiled as part of Apache, so Apache calls it internally. Tomcat is a JSP server that Apache connects to. MySQL is a server that any scripting language can interact with through the appropriate conduit or interface.

MySQL's installer is found in the Extras folder, which also has the JDBC driver (the Java Database Connectivity or database conduit) for MySQL.

To install MySQL, you need to follow the instructions in the Readme file, which include copying the install script to the local hard drive, launching Terminal, and creating a new user account. The instructions are actually quite clear and more than adequate.

MySQL, as installed, still requires a command-line entry to set the root password for the server. The install script offers up a reminder to run these two commands:

./bin/mysqladmin -u root -p password 'new-password'
./bin/mysqladmin -u root -h localhost -p password 'new-password'

The "localhost" item is literally "localhost": if your system identifies itself by a host name, "localhost" isn't the right value. MySQL is very particular.

When you're choosing MySQL passwords, keep in mind a later issue we'll cover: MySQL passwords are stored in the clear in well-known locations as part of the GoLive Dynamic Content system. The passwords are enveloped in a script file that prohibits access. But nonetheless, they're in the clear on your server. In my case, I opted to create a special, limited permission account that wouldn't wreak havoc if my server were compromised. Adobe should take note: this is a giant, gaping security error.

The iconv library is also in the Extras folder; it must be installed into your PHP directory following the instructions in the same folder for PHP to work. This appears to be a licensing issue.

The installation process also creates server start, stop, and restart scripts for all servers and individual servers in the package.

Both the Apache/PHP and JSP servers can be used as actual production systems by editing the configuration file. The installer creates shortcuts for opening and editing the configuration files associated with the two servers, or you can just use Terminal to edit the files with vi or another text editor.

Many GoLive users, even sophisticated ones, may balk at the command-line SQL sequences that MySQL (and other databases) require. A colleague pointed me to the superb phpMyAdmin set of scripts that put a Web front-end onto MySQL administration. Download the source code from phpmyadmin.sourceforge.com.

Why and How I Installed PHP4, MySQL, and Apache on Windows 98
Sep 27, 2000, 18 :29 UTC (1 Talkback[s]) (1052 reads) (Other stories by Edward Tanguay)

Originally appearing in The Web Developer's Journal.

By Edward Tanguay

Four months ago I was selected as Web developer for a large Web site project for six hospitals here in Berlin. It was going to be an exciting project in which I would work together with a marketing company to realize a network of Web sites. However, when we had the first meeting, the head of the computer department said, "Wait a minute. You program in ASP? We run Linux boxes here and can't justify the cost or security risk of an NT-Server." They were unwilling to budge and I didn't want to force Microsoft on them and then have to work with disgruntled system administrators, so I backed out gently and declined the contract.

Beyond ASP: JSP, ColdFusion or PHP

Since that day I've been looking for ways to extend my server-side programming skills beyond the powerful but environment-limited Active Server Pages. I concluded that I basically had three choices outside ASP for server-side scripting: JSP, ColdFusion and PHP. The first, JSP, is promising but still has a relatively small community and a lack of ISPs which support it. In addition, if you use the JSP server from Allaire it is quite expensive. The second choice, ColdFusion, also from Allaire, provides you with a powerful and robust server-side scripting environment centered around databases and e-commerce, but again, the problem is it simply costs too much. If you don't have access to the multi-thousand dollar Enterprise server, you're out of luck (the free ColdFusion Express server doesn't even support session variables - not very useful).

LAMP is red hot and free

PHP, on the other hand, is free. It is combined with three other technologies to form a powerful Web development solution abbreviated LAMP: Linux (operating system), Apache (Web server), MySQL (database) and PHP (scripting language). Even with MySQL's insistance that businesses pay a nominal fee for its use, Linux, Apache and PHP are absolutely free which make the LAMP solution the most cost-effecive solution for individuals, universities and businesses. Web devlopers wishing to acquire valuable scripting skills can do so for free. On top of that, LAMP is generally known to be more secure and robust than other solutions (less crashing, less rebooting, inherent UNIX security). On top of that, LAMP has one of the largest, most active, most dedicated communities on the Web. PHP and the LAMP solution was clearly the best choice for me and I was excited.

The Linux hurdle

However, if you are a Windows user, learning Linux is like being parachuted into Italy without knowing Italian. You will be hopelessly and thoroughly lost at the UNIX prompt. Although my repeated forays into the Linux world have enabled me to install Suse Linux 6.4, set up the X Window System and even use the vi editor, I still lack so much basic knowledge of Linux that even the simplest things such as unpacking files or installing software bring me to a paralyzing stop. So even if you are the type of Windows user who can buy a $50 computer book on almost any application and become an expert in it by the end of the week, Linux is not something you are going to learn in a week, or a month or even a year without an inordinate investment of time, effort, paradigm shifting and lots of long, frustrating nights. Hence LAMP is not an option for the casual Windows user wanting to learn PHP scripting.

Settling for WAMP

Luckily, PHP, MySQL and Apache can also run on Windows (hence WAMP). Note that this is not the most stabile platform to serve your pages to the world, but it is an adequate solution if you want to learn and begin developing with PHP/MySQL while remaining in your familiar Windows environment. You can install Apache, PHP and MySQL on your Windows 98 machine, then upload your applications via FTP to a more stabile LINUX or UNIX server. WAMP is a good compromise for Windows-based Web developers who want to expand their server-side scripting skills into PHP and MySQL.

WAMP installation cryptic but not impossible

It took me a full seven days until I had Apache, PHP and MySQL on my Windows 98 installed, configured and working. It was not easy. The Web is full of well-meaning but conflicting manuals which give you instructions such as to enter "/php4win/" when it should be "c:/php4win/" - that one took me two days to figure out. Another two days was spent downloading incorrect MySQL packets (the manuals tell you to "download MySQL" but when you get to the page you are faced with a choice of about 30 different download possibilities). Luckily there were some very helpful people on the Web Developer's List who kept helping me until I got it. Thanks again to all of you!

Free workshop on installing PHP4, MySQL, Apache on Windows 95/98

If you want to install PHP4, MySQL and Apache on Windows 95 or 98, take my free online workshop on how to do it. This 14-step workshop has explicit instructions and screen shots which will lead you past all the pitfalls. With this Workshop, you can have PHP4, MySQL and Apache installed, configured and working on your Windows 98 within the hour.

Edward Tanguay is a Web developer and language trainer based in Berlin. For more diaries and tips on development visit Edward's Web Developer Site.

[Jan 23, 2000] Linux.com - Featured Articles PHP Questions - January 23rd, 2000
by Jeff Alami
-- another intro

[Jan 23, 2000] http://www.phpbuilder.com -- great site. If you never visited it stop here. You should visit it first.

[Jan 23, 2000] http://phpclasses.upperdesign.com

[Dec 25, 1999] dotcomma; Article; An Introduction to PHP -- short intro.

LinuxPlanet: Adding PHP to Apache on Linux (Dec 23, 1999)
osOpinion: PHP: a silent killer (Dec 22, 1999)
LinuxPower: Interview with the PHP Team (Nov 15, 1999)
Network Computing: Web-Page Generator PHP Gets A Much-Needed Jolt in Version 4 (Nov 02, 1999)
Apache+mod_ssl+PHP Step-by-Step (Sep 11, 1999)

[June 24, 1999] Web mail in PHP [Part 1]

[June 20, 1999] .MySQl-PHP club [.ru] -- in Russian

[June 14, 1999]Linux Today Ext2 Perl versus PHP for Web Design -- interesting discussion (links to the original papers are reproduced below):

InfoWorld: Treasure trove: PHP offers features that will make your Web apps sparkle (Jun 19, 1999)

  • Matt's Script Archive
  • perlWWW -- a (personal) attempt to index (free) Perl programs, and libraries, related to the World Wide Web.
  • Perl Scripts -- some file processing cripts, etc.
  • Abigail's Perl stuff -- some interesting algorithms
  • Dale Bewley's Perl Scripts and Links -- contains an impressive collection of links
  • Software Composition Group Archive -- htgrep
  • My little world in Perl Examples
  • Etc

    CGI Scripts


    Other IDEs

    The listed IDEs support Perl. The list is undoubtedly incomplete, but should form a good starting point for anyone wishing to look into this further.

    Related Topics

    Random Findings



    Etc

    Society

    Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

    Quotes

    War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

    Bulletin:

    Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

    History:

    Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

    Classic books:

    The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

    Most popular humor pages:

    Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

    The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


    Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

    FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

    This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

    You can use PayPal to to buy a cup of coffee for authors of this site

    Disclaimer:

    The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

    Last modified: March, 12, 2019