Prev: Bug #52782: DOMDocument subclass forgotten using ->ownerDocumentafter closure
Next: Filesystem path creation function
From: Steve Staples on 5 Oct 2010 14:39 On Tue, 2010-10-05 at 14:32 -0400, tedd wrote: > At 1:56 PM -0400 10/5/10, tedd wrote: > >At 12:54 PM +0100 10/5/10, Col Day wrote: > >>Hi Shreyas, > >> > >>Ok, as far as I can tell the script should show "This is an HTML > >>line" reflecting that I am seeing the HTML part of the script > >>followed by "This is a PHP line" to show that PHP is installed and > >>working fine. > > > >Col: > > > >Do this: > > > >1. Create a file and entitle it "index.php" (without quotes) > >2. Enter "<?php phpinfo();?>" (without quotes) > >3. Save the file. > >4. Upload the file to your host. > >5. Open a browser and enter the url (i.e., http://yourdomain.com/index.php) > > > >What do you see? > > > >Cheers, > > > >tedd > > > Col: > > You don't have to tell what you see, but rather do you see anything? > > Cheers, > > tedd > > -- > ------- > http://sperling.com/ > Tedd: He is working off his localhost, running on vista... so what it seems (to me at least) is that he is getting the php to work when he uses the localhost, but when he tries to open a php file from say his desktop, he doesn't see the php stuff... which is exactly as designed since running form your desktop, php does not execute the code... i am guessing that he just needs to use his localhost directory. Steve.
From: "Col Day" on 7 Oct 2010 03:33 Morning all, Apologies for the delay, I've just become a Dad for the first time so a little distracted! If I explain exactly what I am trying to do then it may become clear as to where I'm going wrong. Needless to say, new baby so want to show him off (Callum, 7lb4oz) so decided to buy a webname and pay for hosting, however money is a bit tight, so being adventurous (or stupid, not sure which yet) I set up apache on my laptop and started writing a website in Serif's WebPlus10. However I wanted to have an upload area on the site for friends and family to send their pictures of Callum (and the family and anything else they wanted) so there was a central "store". However I tried to find some html to handle the upload of these files but wasn't able to work it out, google and various other bitsx of research on the net showed that I probably needed to run a script to do this and PHP seemed the simplest, so I downloaded PHP 5.3.3 and installed it. This is where it started getting tricky as I was using the PHP for dummies book from 2006. I typed that piece of code in (direct from the book) but added it as an html attachment into my site I was building. Uploaded the site to my localhost and had a look. I only got the HTML line from the script. This is where I started contacting you bunch of fine programmers! I have now learned that if I save the script as a .php file and navigate direct to it on localhost it works fine, but I think what I am trying to do is get it to work in an existing webpage so that I can then get my upload working. Any help you can offer from explanantions to whole bits of code will be greatly received! Many thanks! "Steve Staples" <sstaples(a)mnsi.net> wrote in message news:1286281586.4703.63.camel(a)webdev01... > Col: > > If i am reading this correctly, then i think you're looking at this all > wrong. > > If you're working within some kind of page, stored outside of the > http://localhost served by apache, like say the .php file is on the > desktop... then yeah, you're not going to get the PHP information > displayed. > > (tech people bare with me here...) > PHP pages, are "compiled" when called... so you need apache to call php > and translate the PHP code so that if there is any output, it will > display that output. > > If you're trying to show a .php file from teh desktop, then apache isn't > handeling this request, and therefor has no idea that there is php code > that has to be compiled, and therefore it will just ignore it. > > I am sure that I am goign to get flamed for that, but i think that it > kinda simplifies what apache does for php. > > NOW... you can run a php file from the command line, but you're not > going to get the HTML results as you would had you ran if from the > localhost where apache knows what to do with a .php file. > > So... long story short, if you want PHP to display the PHP stuff, then > you will need to have it interpreted by apache (or IIS, or whatever your > web server software is) to have it spit back to a web browser client. > > Hopefully this makes sense, it is early here, i am just getting into > work :(, and it made sense while i was typing it... but my coffee intake > has not had time to work it's wonderful magic with me yet, so my > thoughts may be scattered. > > Steve > > > > On Tue, 2010-10-05 at 12:57 +0100, Col Day wrote: >> LOL! >> >> This is WITH xammp!! >> >> >> >> "Gary" <php-general(a)garydjones.name> wrote in message >> news:i8f26m$j4r$2(a)dough.gmane.org... >> > Col Day wrote: >> >> ""Col Day"" <colinday3(a)aol.com> wrote in message >> >> news:23.81.45586.2820BAC4(a)pb1.pair.com... >> >>> <html> >> >>> <head> >> >>> <title>PHP Test</title> >> >>> </head> >> >>> <body> >> >>> <p>This is an HTML line >> > </p> <!-- close your tag, you evil man! :-) --> >> >>> <?php >> >>> echo "<p>This is a PHP line</p>"; >> >>> phpinfo(); >> >>> ?> >> >>> </body> >> >>> </html> >> > >> >> If I paste this into a webpage I only get the "HTML" line as before. >> > >> > What do you mean, "webpage"? foo.php, for example, or foo.html? If the >> > latter then I am guessing your Apache will serve the page purely as >> > html, and it will never be processed by php. If the former then check >> > that Apache is configured to run php files through php before serving >> > them (must admit, I'm not sure how to do that, it depends on your >> > Apache >> > and PHP). Or, really, just install xampp, it's by far the easiest way >> > and will avoid all the problems associated with configuring two rather >> > complex pieces of software. >> > >> >> > >
From: "=?utf-8?B?YXNoQGFzaGxleXNoZXJpZGFuLmNvLnVr?=" on 7 Oct 2010 04:00 It will only work if your listing supports php, but you should just be able to put the whole sure up on your hosting, give the upload directory the correct permissions ( its most likely a more secure Linux hosting than insecure windows hosting) Thanks, Ash http://www.ashleysheridan.co.uk ----- Reply message ----- From: "Col Day" <colinday3(a)aol.com> Date: Thu, Oct 7, 2010 08:33 Subject: [PHP] Re: Continuance of the struggle (trying to understand) To: <php-general(a)lists.php.net> Morning all, Apologies for the delay, I've just become a Dad for the first time so a little distracted! If I explain exactly what I am trying to do then it may become clear as to where I'm going wrong. Needless to say, new baby so want to show him off (Callum, 7lb4oz) so decided to buy a webname and pay for hosting, however money is a bit tight, so being adventurous (or stupid, not sure which yet) I set up apache on my laptop and started writing a website in Serif's WebPlus10. However I wanted to have an upload area on the site for friends and family to send their pictures of Callum (and the family and anything else they wanted) so there was a central "store". However I tried to find some html to handle the upload of these files but wasn't able to work it out, google and various other bitsx of research on the net showed that I probably needed to run a script to do this and PHP seemed the simplest, so I downloaded PHP 5.3.3 and installed it. This is where it started getting tricky as I was using the PHP for dummies book from 2006. I typed that piece of code in (direct from the book) but added it as an html attachment into my site I was building. Uploaded the site to my localhost and had a look. I only got the HTML line from the script. This is where I started contacting you bunch of fine programmers! I have now learned that if I save the script as a .php file and navigate direct to it on localhost it works fine, but I think what I am trying to do is get it to work in an existing webpage so that I can then get my upload working. Any help you can offer from explanantions to whole bits of code will be greatly received! Many thanks! "Steve Staples" <sstaples(a)mnsi.net> wrote in message news:1286281586.4703.63.camel(a)webdev01... > Col: > > If i am reading this correctly, then i think you're looking at this all > wrong. > > If you're working within some kind of page, stored outside of the > http://localhost served by apache, like say the .php file is on the > desktop... then yeah, you're not going to get the PHP information > displayed. > > (tech people bare with me here...) > PHP pages, are "compiled" when called... so you need apache to call php > and translate the PHP code so that if there is any output, it will > display that output. > > If you're trying to show a .php file from teh desktop, then apache isn't > handeling this request, and therefor has no idea that there is php code > that has to be compiled, and therefore it will just ignore it. > > I am sure that I am goign to get flamed for that, but i think that it > kinda simplifies what apache does for php. > > NOW... you can run a php file from the command line, but you're not > going to get the HTML results as you would had you ran if from the > localhost where apache knows what to do with a .php file. > > So... long story short, if you want PHP to display the PHP stuff, then > you will need to have it interpreted by apache (or IIS, or whatever your > web server software is) to have it spit back to a web browser client. > > Hopefully this makes sense, it is early here, i am just getting into > work :(, and it made sense while i was typing it... but my coffee intake > has not had time to work it's wonderful magic with me yet, so my > thoughts may be scattered. > > Steve > > > > On Tue, 2010-10-05 at 12:57 +0100, Col Day wrote: >> LOL! >> >> This is WITH xammp!! >> >> >> >> "Gary" <php-general(a)garydjones.name> wrote in message >> news:i8f26m$j4r$2(a)dough.gmane.org... >> > Col Day wrote: >> >> ""Col Day"" <colinday3(a)aol.com> wrote in message >> >> news:23.81.45586.2820BAC4(a)pb1.pair.com... >> >>> <html> >> >>> <head> >> >>> <title>PHP Test</title> >> >>> </head> >> >>> <body> >> >>> <p>This is an HTML line >> > </p> <!-- close your tag, you evil man! :-) --> >> >>> <?php >> >>> echo "<p>This is a PHP line</p>"; >> >>> phpinfo(); >> >>> ?> >> >>> </body> >> >>> </html> >> > >> >> If I paste this into a webpage I only get the "HTML" line as before. >> > >> > What do you mean, "webpage"? foo.php, for example, or foo.html? If the >> > latter then I am guessing your Apache will serve the page purely as >> > html, and it will never be processed by php. If the former then check >> > that Apache is configured to run php files through php before serving >> > them (must admit, I'm not sure how to do that, it depends on your >> > Apache >> > and PHP). Or, really, just install xampp, it's by far the easiest way >> > and will avoid all the problems associated with configuring two rather >> > complex pieces of software. >> > >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
From: Steve Staples on 7 Oct 2010 08:25
Col: Congratulations on becoming a father!! As a father of 3 myself, I know the joys that infants bring :) As for your scripting issues, I would suggest that you save your files with the .php extension, and not the .html. The .php extension will tell the php compliler/parser/whatever and spit back the "compiled" php script. If you're looking to just have a "photo gallery", there are many free/opensource gallery scripts out there that you can use. Mind you, there is no "sense of accomplishment" when you do it this way, but if you're unsure about security, and file injection/sql injection, then you may be better off using one of those, until you're further along in your book :) http://www.google.ca/#sclient=psy&hl=en&q=opesource+php +gallery&aq=f&aqi=g-sx1g-o1&aql=&oq=&gs_rfai=&pbx=1&fp=f85a0cf66583c3ac in the past, I set up coppermine for a friend of mine, and he said it works ok... but like I said, there are lots out there, and maybe consider using one of them for now, so you can spend more time with your new baby :) Steve. On Thu, 2010-10-07 at 09:00 +0100, ash(a)ashleysheridan.co.uk wrote: > It will only work if your listing supports php, but you should just be able to put the whole sure up on your hosting, give the upload directory the correct permissions ( its most likely a more secure Linux hosting than insecure windows hosting) > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > ----- Reply message ----- > From: "Col Day" <colinday3(a)aol.com> > Date: Thu, Oct 7, 2010 08:33 > Subject: [PHP] Re: Continuance of the struggle (trying to understand) > To: <php-general(a)lists.php.net> > > Morning all, > > Apologies for the delay, I've just become a Dad for the first time so a > little distracted! > > If I explain exactly what I am trying to do then it may become clear as to > where I'm going wrong. > > Needless to say, new baby so want to show him off (Callum, 7lb4oz) so > decided to buy a webname and pay for hosting, however money is a bit tight, > so being adventurous (or stupid, not sure which yet) I set up apache on my > laptop and started writing a website in Serif's WebPlus10. However I wanted > to have an upload area on the site for friends and family to send their > pictures of Callum (and the family and anything else they wanted) so there > was a central "store". However I tried to find some html to handle the > upload of these files but wasn't able to work it out, google and various > other bitsx of research on the net showed that I probably needed to run a > script to do this and PHP seemed the simplest, so I downloaded PHP 5.3.3 and > installed it. > > This is where it started getting tricky as I was using the PHP for dummies > book from 2006. I typed that piece of code in (direct from the book) but > added it as an html attachment into my site I was building. Uploaded the > site to my localhost and had a look. I only got the HTML line from the > script. This is where I started contacting you bunch of fine programmers! > > I have now learned that if I save the script as a .php file and navigate > direct to it on localhost it works fine, but I think what I am trying to do > is get it to work in an existing webpage so that I can then get my upload > working. > > Any help you can offer from explanantions to whole bits of code will be > greatly received! > > Many thanks! > > "Steve Staples" <sstaples(a)mnsi.net> wrote in message > news:1286281586.4703.63.camel(a)webdev01... > > Col: > > > > If i am reading this correctly, then i think you're looking at this all > > wrong. > > > > If you're working within some kind of page, stored outside of the > > http://localhost served by apache, like say the .php file is on the > > desktop... then yeah, you're not going to get the PHP information > > displayed. > > > > (tech people bare with me here...) > > PHP pages, are "compiled" when called... so you need apache to call php > > and translate the PHP code so that if there is any output, it will > > display that output. > > > > If you're trying to show a .php file from teh desktop, then apache isn't > > handeling this request, and therefor has no idea that there is php code > > that has to be compiled, and therefore it will just ignore it. > > > > I am sure that I am goign to get flamed for that, but i think that it > > kinda simplifies what apache does for php. > > > > NOW... you can run a php file from the command line, but you're not > > going to get the HTML results as you would had you ran if from the > > localhost where apache knows what to do with a .php file. > > > > So... long story short, if you want PHP to display the PHP stuff, then > > you will need to have it interpreted by apache (or IIS, or whatever your > > web server software is) to have it spit back to a web browser client. > > > > Hopefully this makes sense, it is early here, i am just getting into > > work :(, and it made sense while i was typing it... but my coffee intake > > has not had time to work it's wonderful magic with me yet, so my > > thoughts may be scattered. > > > > Steve > > > > > > > > On Tue, 2010-10-05 at 12:57 +0100, Col Day wrote: > >> LOL! > >> > >> This is WITH xammp!! > >> > >> > >> > >> "Gary" <php-general(a)garydjones.name> wrote in message > >> news:i8f26m$j4r$2(a)dough.gmane.org... > >> > Col Day wrote: > >> >> ""Col Day"" <colinday3(a)aol.com> wrote in message > >> >> news:23.81.45586.2820BAC4(a)pb1.pair.com... > >> >>> <html> > >> >>> <head> > >> >>> <title>PHP Test</title> > >> >>> </head> > >> >>> <body> > >> >>> <p>This is an HTML line > >> > </p> <!-- close your tag, you evil man! :-) --> > >> >>> <?php > >> >>> echo "<p>This is a PHP line</p>"; > >> >>> phpinfo(); > >> >>> ?> > >> >>> </body> > >> >>> </html> > >> > > >> >> If I paste this into a webpage I only get the "HTML" line as before. > >> > > >> > What do you mean, "webpage"? foo.php, for example, or foo.html? If the > >> > latter then I am guessing your Apache will serve the page purely as > >> > html, and it will never be processed by php. If the former then check > >> > that Apache is configured to run php files through php before serving > >> > them (must admit, I'm not sure how to do that, it depends on your > >> > Apache > >> > and PHP). Or, really, just install xampp, it's by far the easiest way > >> > and will avoid all the problems associated with configuring two rather > >> > complex pieces of software. > >> > > >> > >> > > > > > > -- Steve Staples Web Application Developer 519.258.2333 x8414 |