Hi Sonny,

2013/6/10 Sonny Karlsson <[email protected]>

> Hi Luigi
>
> On Sun, Jun 09, 2013 at 05:41:36PM +0200, Luigi D'Andrea wrote:
> >
> > I can use my cgi scripts in the
> /home/pi/Desktop/monkey-1.2.1/htdocs/cgi-bin  directory, i can see all html
> in the htdocs directory but I cannot see any php rendered file.
> > Safari returns back
> >
> > Safari can’t open the page “http://192.168.2.7:2001/template.php”. The
> error is: “The operation couldn’t be completed. (kCFErrorDomainCFNetwork
> error 303.)” (kCFErrorDomainCFNetwork:303)
> >
> >
> > What am I doing wrong?
> >
>
> I've tested this setup and there seems to be a plugin interaction issue
> going on.
> With this fastcgi configuration and the default cgi configuration, some
> files will be served by fastcgi and some by cgi.
> You must make sure that the cgi plugin does not handle .php files by
> commenting one line in conf/plugins/cgi/cgi.conf.
> It should look like this:
>
>     # Execute PHP scripts through php-cgi interpreter:
>     # Match /.*\.php /usr/bin/php-cgi application/x-httpd-php


One problem has gone!
Now I commented out the " Match line"



>


> With this change the setup works fine with wordpress on my raspberry.
>
> If you've already made this change and it's still not working, the issue
> may be due to how monkey and your php script uses HTTP headers.
> Could you please perform the same request using curl -v in terminal and
> post it's output here on the mailing list if that is the case?
> This will hopefully give some additional insights.
>
> $ curl -vs http://192.168.2.7:2001/template.php 2&>1 | tee output.txt
>



localhost:~ $ curl -vs http://192.168.2.7:2001/c2/template.php
* About to connect() to 192.168.2.7 port 2001 (#0)
*   Trying 192.168.2.7...
* connected
* Connected to 192.168.2.7 (192.168.2.7) port 2001 (#0)
> GET /c2/template.php HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0
OpenSSL/0.9.8r zlib/1.2.5
> Host: 192.168.2.7:2001
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Monkey/1.2.1
< Date: Mon, 10 Jun 2013 18:04:49 GMT
< Content-Type: text/html
< Content-Length: 1616
< X-Powered-By: PHP/5.4.4-14
<
Closing connection #0
 ...
....
....


> Additionally, are your php script publicly available somewhere so that I
> may test them locally?
>
> menu.php, aside.php and add only some graphics.



upload.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"; xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>xAppSoftware</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" href="sample.css" type="text/css" media="screen" />
</head>
<body>
<?php
include 'menu.php';
include 'aside.php';
?>
<h2>Upload a new tweets file</h2>

    <form enctype="multipart/form-data" method="post"
action="upload_file.php">
        Select File:
        <input name="uploaded_file" type="file"/><br/>
        <input type="submit" value="Upload"/>
    </form>

<?php
include 'footer.php';
?>
</body>




upload_file.php
<?php
$fileName = $_FILES["uploaded_file"]["name"];//the files name takes from
the HTML form
$fileTmpLoc = $_FILES["uploaded_file"]["tmp_name"];//file in the PHP tmp
folder
$fileType = $_FILES["uploaded_file"]["type"];//the type of file
$fileSize = $_FILES["uploaded_file"]["size"];//file size in bytes
$fileErrorMsg = $FILES["uploaded_file"]["error"];//0 for false and 1 for
true
$target_path = "./uploads/" . basename( $_FILES["uploaded_file"]["name"]);

    if(!$fileTmpLoc)//no file was chosen ie file = null
    {
        echo "ERROR: Please select a file before clicking submit button.";
        exit();
    }
    else
       if($fileErrorMsg == 1)//if file uploaded error key = 1 ie is true
       {
           echo "ERROR: An error occured while processing the file. Please
try again.";
           exit();
       }

if(file_exists($target_path))
{
    echo "<h2><center> File Exists <center></h2>";
exit();
}
else
{
    $moveResult = move_uploaded_file($fileTmpLoc, $target_path);
    echo "<h2><center> File uploaded <center></h2>";
}

?>




Thank you for your time
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to