Forum Moderators: coopster

Message Too Old, No Replies

your views on php

         

lindajames

6:18 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



Hi,

I have recently started to learn PHP. I would like to know what peoples views are about PHP. Before i actually touched PHP i came across many sites that are PHP based and I used to get some sort of warning errors on the top of every page. I thought maybe it was a bug on PHP coz not everyone can have dodgy codes. From time to time i still come across many php based sites that generate some sort of warning error in the top of the page, what is this due to?

I would like to know this because i am building my website based on php includes etc. and i dont want to end up experiencing any errors after a month or so.

Any suggestions would be appreciated

Cheers
Linda

Dayo_UK

6:20 pm on Jun 30, 2003 (gmt 0)



Lindajames

Not heard of that before - can you remember what the warning message says?

Also - what browser are you using?

lorax

6:38 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Browser and platform of your machine?

lindajames

6:52 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



I use Internet Explorer and Windows 2000, i cant really remember what the errors where but they all look very identical. Starts with a Warning: etc...

lorax

6:57 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's strange. I've never encountered an error and since PHP is server side the only thing I could think of is that you're using an oddball browser - but apparently not. Are you sure the error is PHP related?

mack

7:11 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It is quite likely that the error might be mysql related. A lot of php sites use mysql on backend. Eny errors related to mysql often are displayed at the top when the page loads.

Only other thing I can sugest is a site error where the author has included a page that does not reside at the specified locaton.

Mack.

[edited by: mack at 7:12 pm (utc) on June 30, 2003]

lindajames

7:11 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



yes definately php based, i have come across these Warning messages on many sites that use php, it always has the path to the script that the error is in and some of errors are related to something about the header

vincevincevince

7:12 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sure, i've often seen them - it's either due to bad code on the webmaster's part, or bad setup on the part of his/her host. you must remember that one php file will often rely on lots of other files, and databases to run correctly - and webmasters get a "blind eye" to pages that they did a long time ago and are no longer considered by them to be "the current site" - however they are often still indexed by google. so - keep your site maintained, and you'll not get those horrid errors. secondly... @ prefix potential problem functions to stop them showing in the browser.

as for starting php - i really recommend learning it properly by following a book or tutorial - not downloading readymade scripts and trying to learn by editing them to do what you want to do... with the latter route lies not knowing important things about security, and a long hard route to being effective in php.

good luck :-)

lorax

7:46 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> something about the header

I normally see this while I'm developing my own sites LOL. Does the error say something about Headers already sent? Not that it really matters. As noted above - it is most likely because of poor coding practices on the part of the programmer.

In general, I love PHP and there are only 2 other languages I'd like to learn that might surpass PHP for usefulness to me - PERL and C++.

Tuesday

8:07 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



Does Google penalize for merely having an "index.php" file rather than an "index.html" file?

jatar_k

8:17 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Tuesday,

Debatable, I stick to .html whenever possible but I have worked with tons of .php sites and could not attribute any adverse effect to the extension.

As to warnings on various sites. Warnings are from bad code. If you have warnings you should probably fix them. There are a million and one explanations/possibilities why these errors are appearing on page but all of them are the fault of the programmer.

fun job ;)

vincevincevince

8:23 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



no, index.php is treated like index.html by google
an advantage of using .php is google will support the?arguments
however, it's no bother to make php parse .html as well

dotbiz

8:41 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



I once had a php site hosted by a poorly managed shared virtual host. Every week or two, something would crash, especially mysql server, and I saw that ugly warning message.

vincevincevince

8:48 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



that is a good point
with .html you pretty much either serve the page or you don't
with .php you can serve the page, or the page with errors due to bad coding, or the page with errors due to the database being down, and even if the database is running, you may have problems with php, as well as apache, and there's always scope for getting crazy results when people use your pages in ways you didn't expect...

jatar_k

9:03 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well I can definitely sympathize dotbiz it happens more than one would expect unfortunately they still blame the programmer.

an advantage of using .php is google will support the?arguments

G will support, to the best of it's limited abilities, strings on html pages too but google has trouble with query strings in general so they should never be used.

willybfriendly

9:10 pm on Jun 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



lindajames, the best thing I ever did in this realm was to commit myself to learning PHP. The next best thing was to come to WW and learn from some real experts.

As for errors, they are usually bad coding, but I have had a server change configurations on me and crash one of my scripts. I was using the UNIX dictionary for generating passwords. THey reconfigured and "forgot" to reinstall the dictionary.

This created an endless loop in my script :(

Also created a lot of unhappy clients and mega-nasty-grams:( :(

There is something to be said for learning how to build in decent error checking.

WBF

griz_fan

10:53 pm on Jun 30, 2003 (gmt 0)

10+ Year Member



In my opinion, PHP is great. Even if you only plan on building simple, static HTML pages, I definitely recomend having PHP available as an option. Having support for server-side scripting will open up a lot of possibilities ranging from a simple contact form to a database driven image gallery, for example.
Regarding the errors you've seen, I've seen them as well, especially when researching the various PHP portal systems (PHP Nuke, PostNuke, etc...). Nine times out of ten, I'd say these are due to incorrectly configured scripts.
My advdise: dive into PHP. You won't regret it. But... Start off simple. PHP includes is a great starting point, you get a feel for the syntax and they're pretty easy to set up. From there, you can move on to more complicated stuff. Do yourself a favor and setup PHP/Apache/MySQL on your own system to test things out first. For Windows, there are lots of install kits such as FoxServ, PHP Triad or FirePages. If you are on a Mac, check out PHPmac.com, lots of good info on getting PHP to run on a Mac. Without much effort, you can come pretty close to recreating you web hosting environment on your local PC (some exceptions, though. for example, my web host prefixes all MySQL database names with my user name. Pretty minor, though, and easy to work around).
The lesson to take away from this is to test, test and test. Work out the kinks on your system, then upload to your "live" site. If you do that, I think you'll find PHP to be incredibly reliable and robust.

Sander

12:09 am on Jul 2, 2003 (gmt 0)

10+ Year Member



I know what you mean. And I know the cause of the problem.

It's actually the script trying to send headers after having put out data to the client. Then these errors are displayed. There are two ways to get rid of them:

- check which headers will need to be sent during the script and send them all at once

- use ob_start();. This nifty function buffers the whole output until it encounters ob_end_flush();, that's when it sends all the buffered data to the browser. This has some advantages: sites display at once (except for images etc), and all headers are sent at the same time.

Good luck, and please do PHP, it's the best scripting language around, and it's free and opensource.