Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2005, 12:58 AM
Authorized User
 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default No input file specified

I get this error message when I try and run php on my remote webserver (windows based not Linux):

'No input file specified'

It works ok on my computer server (apache) and parses the XML file, but on my website server it doesn't work. My code is basically the same as the code in the XML chapter, but slightly modified to suit my purpose. This is not the problem as it parses XML ok on my PC.

Here is my code:

Code:
<?php
    // Open the Termine file
    $xmlTermine    = fopen("http://www.bungert.co.uk/tests/alicehoffmann_updater/xml/termine.xml", "r");
    if (!$xmlTermine) die ("Cannot open file");

    $itemCount            = 0;
    $itemData            = array();
    $currentTagState    = '';

    // Define callback functions
    function startElementHandler($parser, $elementName)
    {
        global $itemCount;
        global $itemData;
        global $currentTagState;

        $currentTagState = $elementName;
    }

    function endElementHandler($parser, $elementName)
    {
        global $itemCount;
        global $itemData;
        global $currentTagState;

        $currentTagState = '';

        if ($elementName == "ITEM")
        {
            $itemCount++;
        }
    }

    function itemDataHandler($parser, $data)
    {
        global $itemCount;
        global $itemData;
        global $currentTagState;

        // Return if $currentTagState is empty
        if ($currentTagState == '')
        {
            return;
        }

        // Otherwise put data in the array for later use
        if ($currentTagState == "DATUM")
        {
            $itemData[$itemCount]["datum"] = $data;
        }

        if ($currentTagState == "ORT")
        {
            $itemData[$itemCount]["ort"] = $data;
        }

        if ($currentTagState == "ZEIT")
        {
            $itemData[$itemCount]["zeit"] = $data;
        }

        if ($currentTagState == "HALLE")
        {
            $itemData[$itemCount]["halle"] = $data;
        }

        if ($currentTagState == "STÜCK")
        {
            $itemData[$itemCount]["stück"] = $data;
        }
    }

    // Create XML parser
    $xmlParser = xml_parser_create();
    if (!$xmlParser) die ("Couldn't create XML Parser");

    xml_set_element_handler($xmlParser, "startElementHandler", "endElementHandler");
    xml_set_character_data_handler($xmlParser, "itemDataHandler");

    while ($data = fread($xmlTermine, 4096))
    {
        if (!xml_parse($xmlParser, $data, feof($xmlTermine)))
        {
            break; // Get out of while loop when finished with the file
        }
    }

    xml_parser_free($xmlParser);
?>

<html>
    <head>
        <title>Alice Hoffmann: Website Updater * TESTING *</title>

        <meta http-equiv="content-type"            content="text/html; charset=iso-8859-1">
        <meta http-equiv="imagetoolbar"            content="false">
        <meta name="MSSmartTagsPreventParsing"    content="true">
    </head>

    <body>
        <?php
            echo "XML file parsed, it contains the following termine items:<br><br>";

            for ($index = 0; $index < $itemCount; $index ++)
            {
                echo "Datum is: <b>" . $itemData[$index]["datum"] . "</b><br>";
                echo "Ort is: <b>" . $itemData[$index]["ort"] . "</b><br>";
                echo "Zeit is: <b>" . $itemData[$index]["zeit"] . "</b><br>";
                echo "Halle is: <b>" . $itemData[$index]["halle"] . "</b><br>";
                echo "Stück is: <b>" . $itemData[$index]["stück"] . "</b><br><br>";
            }
        ?>
    </body>

</html>
Anyone know what the problem might be? I searched Google but every one with this problem seems to have a different reason, there doesn't seem to be one reason for this error message.

 
Old January 7th, 2005, 08:54 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

http://www.google.com/search?q=php+%...e+specified%22

This search turns up quite a few results. Sorry, don't have time to sift through them for the answer.

-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old January 27th, 2006, 09:22 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just had to registered, if only to respond that that was the least helpful comment I've ever seen. stephen_c clearly has already used google and attempted to scour through the results, since he stated that himself. Did you even read his post? Sheesh.

 
Old January 27th, 2006, 10:00 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Since you said the code works fine on your apache but not on the host server I guess the problem is there...
Did you run phpinfo() on the host to see if they run something old like PHP3 ?





Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i get input of file through servlet? myhrvod Servlets 1 March 26th, 2007 01:46 AM
How do I validate file input? grstad Classic ASP Professional 1 February 18th, 2007 08:45 PM
input file... joeore BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 February 23rd, 2004 07:58 PM
Any File (input #1) experts help? enterbase Access VBA 2 February 2nd, 2004 08:35 AM
Multiple file input single file output.... jdm_mboy Biztalk 1 July 2nd, 2003 03:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.