SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy PHP Producing Error Messages in Browser?!?

    Hi all,
    I have installed Apache2 and MySql according to the online instructions in chapter one and they work as expected. I have also installed PHP and configured it to the requirements in the same chapter however this is where my problem starts. I have used the code:

    <?php
    phpinfo();
    ?>

    …to check that PHP works but get the following error messages displayed in my browser:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Program Files\Apache Group\Apache2\htdocs\about.php on line 2

    Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\about.php on line 2

    In attempting the first PHP example in chapter one I receive the same errors only the file name changes (of course) and the first error above is repeated twice. There is no backslash in either files or any out of the ordinary Strings so I’m completely stumped.
    I use the following to display the file in the browser:

    http://localhost/today.php

    …and the file is stored in:

    C:\Program Files\Apache Group\Apache2\htdocs\today.php

    …as shown in the errors above.

    Any help in fixing or reconfiguring PHP will be most appreciated as I’m totally new to web design, server management and databases.
    Chrome

    SYSTEM
    OS: Window XP Pro
    Text Editor: WordPad, Notepad or gvim
    IE: v6
    Apache2: v2.0.52
    MySql: v4.1.7
    PHP: v5.0.2

    P.S. I have searched and read many of the posts for the same problem and was unable to find any help so please post a reply.
    Chrome

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post the code from both about.php and today.php.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Houston
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Try not installing at all...

    I can't solve your problem but I do have a suggestion. If in fact you are new to php/mysql and/or web develepoment in general it would be my suggestion to not get bogged down in the installation process when instead you should be learning good coding skills. Later in your developement you will need to understand the process of uploading to the web anyway and will only need the "install" skills in a developement environment. There are a number of myriad issues that could be causing your problem. When I started I wasted 4 months on getting the answers to my installation questions.

    Instead you might try a hosted solution. There are several and they are cheap. My suggestion is www.1and1.com. They have 1-800 support that is friendly and curtious which you get for 10.00 per month. www.verio.com is one of the best of course but they are more expensive. The main thing is that you want to stay away from the webhosters that aren't going to help you with a live person. Later you will need to set up things like phpMyAdmin and the PEAR repository in your webspace. You will need someone to help you do it.

    I hope this is a helpful suggestion....

  4. #4
    SitePoint Member AlexBrina's Avatar
    Join Date
    Jul 2004
    Location
    office.bh.mg.br
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By looking to the error messages, it seems that the problem is with file's path, avoid the "Program Files" because the space between the 2 words may cause problems... I personally use c:\apache and c:\postgres (c:\mysql in your case) as installation directory.
    Try to reinstall everything in the root dir, at least, you will practice the process, I lost the times I had to reinstall everything to get it working fine.
    Alex Brina
    "...sempre q eu tirar a cabeça fora d'agua eu dou um alô..." JC

  5. #5
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Thanks for all your help guys. I will try a reinstall and have a look at the hosted solutions and report back to tell you if it all worked out. thanks for your time.
    Chrome

  6. #6
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or try to run/install it on linux

    My first install worked immediately, or maybe I was just lucky
    The Path of excess leeds to the tower of wisdom (W. Blake)

  7. #7
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Im Back,
    I've decided web hosting is not for me due to the cost and lack of personal control in what I can mess around with. The file paths are fine and I have reinstalled with the same disapointing results, eg. Apache and MySql still work but PHP is giving the same error messages. The code for the two files I was testing is now posted but I am sure the problem lies elsewhere. I wish I had the time to learn the in's and out's of Linux while also trying to understand databases, HTML and server apps but I think I'm in deep enough already, .

    Here's the code for 'today.php' :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Today's Date</title>
    <meta http-equiv="content-type"
    content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <p>Today's Date (according to this Web server) is
    <?php

    echo date('l, F dS Y.');

    ?></p>
    </body>
    </html>

    The code for 'about.php' is in my first post.
    Thanks again everyone, for all your help...keep it comin' .

    P.S. Perhaps I need to update to a later version of PHP?
    Chrome

  8. #8
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you call a function in php that is not supported by the current version you're running, you'll get something like:
    "call to unknown function in C:\...... on line ....."
    so the version issue is not the problem

    what is your root directory for the webapages?

    greetz,
    koen
    The Path of excess leeds to the tower of wisdom (W. Blake)

  9. #9
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what is your root directory for the webapages?
    Now thats just plain lazy, it's was in my first post, lol.
    But here it is again:

    C:\Program Files\Apache Group\Apache2\htdocs

    Cheers Pompompom
    Chrome

  10. #10
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've seen so many people have trouble with these individual installs, that I like to recommend Xampp...

    http://www.apachefriends.org/en/xampp.html

    A breeze to set up, with a choice of PHP 4 or 5.
    Lats...

  11. #11
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chrome
    Now thats just plain lazy, it's was in my first post, lol.
    But here it is again:

    C:\Program Files\Apache Group\Apache2\htdocs

    Cheers Pompompom
    No it wasn't lazy... Alexbrina suggested to put the installations in root directory, so you can't have problems with the white spaces in your path.
    Since you did a re-install I was wondering if you did so.

    and you didn't... so who's lazy, that's the question?

    greetz,
    koen
    The Path of excess leeds to the tower of wisdom (W. Blake)

  12. #12
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Thanks Lats but Problem Persists

    lol, sorry Pompompom.
    Did a reinstall using different path, got same result, did it again to original path.
    ...and yes Im very lazy

    Thanks Lats for the link mate, it made installation much easier!

    Unfortunatley I continue to get the same error messages.
    The about.php now works but the today.php still doesn't. Not only that, I get the same error messages no matter what I do to the code...including deleting all the code so that it's just a blank file.
    What the hell is happening here? Why does one file work while the other just refuses to even aknowledge my changes to the code, spitting out the same errors? Could it be Windows SP2? My browser settings? The UFO people?

    HELP..............
    Last edited by Chrome; Nov 20, 2004 at 16:47.
    Chrome

  13. #13
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what's the error you get with today.php??
    The Path of excess leeds to the tower of wisdom (W. Blake)

  14. #14
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile I Give Up!

    The same as in the first post:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Program Files\Apache Group\Apache2\htdocs\filename.php on line 2

    Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\filename.php on line 2

    It seem's the errors have nothing to do with the installation or configuration as I tried doing each component seperatley then I downloaded the package from Lats link which was self installed and self configured. It also has nothing to do with my editor or browser as I used the same apps for the about.php which now works. It also has nothing to do with whats in the file of today.php as I can delete the entire code and still get the same errors and was originally getting the same errors in about.php. It also has nothing to do with where I put the file, how I call it from the browser or the File Path because about.php works using the same procedures. So in other words everything SHOULD work...it just doesn't.

    Well thank you all who tried to help but I don't think there is any real solution. Think I will just learn straight HTML and never mention PHP again.
    Chrome

  15. #15
    SitePoint Member Chrome's Avatar
    Join Date
    Nov 2004
    Location
    Perth, Australia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    O' bloody hell...now it works!
    Why, why, why...lol.

    Thanks heaps Pompompom for all your help, Im just as miffed as you that it solved itself ...aaarrrgggggggggggggghhhhhhhh.
    Chrome

  16. #16
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chrome
    O' bloody hell...now it works!
    Why, why, why...lol.

    Thanks heaps Pompompom for all your help, Im just as miffed as you that it solved itself ...aaarrrgggggggggggggghhhhhhhh.
    solving itself?? You should share the code "that solves itself" this is a major breaktrough in the history of programming

    A good test now would be: re-install again and try to reproduce the errors, 'cause the problem is now that you're stuck with the question: why does it work?

    Are you 100% positively sure that you didn't change anything between the last time you got the errors and when it worked? amazing

    greetz,
    koen

    PS1 : sticking to HTML instead of PHP is yuckie.
    PS2 : PHP doesn't make HTML obsolete, it makes HTML just more fun.
    The Path of excess leeds to the tower of wisdom (W. Blake)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •