LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   PHP script not being interpreted properly (http://www.linuxquestions.org/questions/programming-9/php-script-not-being-interpreted-properly-896301/)

ShaqDiesel 08-09-2011 02:53 AM

PHP script not being interpreted properly
 
I wrote a php script that was running fine as a standalone script. Now I am attaching it to a web form and it goes to the script, but the php is not being interpreted correctly, I have the php as:

<?php
code that is interpreted until object->variable
?>

The interpretation seems to stop after the '->' syntax. what is going on? Thanks.

eSelix 08-09-2011 05:24 AM

Please post your real script fragment and real error message. If you have no errors visible, enable it by "error_reporting" and "display_errors" directives in php configuration file. Also check that on the server is the same version of php.

ShaqDiesel 08-09-2011 08:12 AM

<?php
$email = $_POST['email'];
$pw = $_POST['password'];
$date_start = $_POST['start_date'];
$connectionStr = "XXXXX";
if($mailbox = imap_open($connectionStr, $email, $pw))
{
echo "Connected\n";
}
$mail_check = imap_check($mailbox);
$msg_headers = imap_fetch_overview($mailbox, "1:{$mail_check->Nmsgs}",......

i looked at the page source in firefox and it looks like everything is interpreted(in pink) up to and including the -> sign. According to my apache/errors/error.log:
[Tue Aug 09 05:39:54 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
As you can see I am doing this in localhost

Proud 08-09-2011 09:29 AM

Edit Nope, realised I misread that, your use of Nmsgs looks right and as per the example for imap_check and imap_fetch_overview... I'll ponder it some more.
To clarify, the examples and related docs:
http://php.net/manual/en/function.im...h-overview.php
http://www.php.net/manual/en/function.imap-check.php

So you're trying to reference(->) a valid object variable(Nmsgs) in the 1 to number of messages portion of the string you're building and passing to imap_fetch_overview().

The "File does not exist: C:/xampp/htdocs/announce" error seems unrelated.

eSelix 08-09-2011 10:36 AM

Quote:

it looks like everything is interpreted(in pink)
What does it mean - pink? Do you see your php code in the browser? You shouldn't. It would means that your server has no PHP installed or only files with .php extension are interpreted by it and you edited .html. You can parse html files too, by editing .htaccess file but it depends on server configuration, so you can ask admin.

ShaqDiesel 08-09-2011 06:48 PM

I figured it out, it was the fact that I didn't prepend my url with http://localhost.


All times are GMT -5. The time now is 08:42 AM.