PHP 5.2.5 / Apache / NT / COM Objects Problem.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lonetraceur
Forum Newbie
Posts: 4
Joined: Mon Mar 17, 2008 12:06 pm

PHP 5.2.5 / Apache / NT / COM Objects Problem.

Post by lonetraceur »

Hi everyone,

This is my first post, not sure if I've put this in the right section but I have a bit of a head scratcher and can't for the life of me work it out...
I've got a Win NT Server with Apache 2.2 & PHP 5.2.5 installed and working on it correctly... I'm now trying to access a COM object from the PHP script but it just won't work. I've run it on my local XP Machine with the same versions of PHP and Apache and it works fine... I just can't work out the issue on the Server!
The code should just basically just open IE...

Oh, I've also set the Apache service to "interact with the Desktop" too, so I know it isn't that..

Code: Select all

<?php
    // Start Sessions.
    session_start();
    
    if (isset($_GET['thumbnailurl'])){
        $inputurl = $_GET['thumbnailurl'];
        // Regular Expression to remove http:// from front of URL.
        $url = ereg_replace("http://","",$inputurl);
        //echo htmlentities($url);
        grab_url($url);
    }
    
    function grab_url($graburl){
 
                // Open IE
                $browser = new COM("InternetExplorer.Application");
                //$handle = $browser->HWND;
                
                // Set IE Attributes
                $browser->Visible = true;
                $browser->FullScreen = true;
                
                // Navigate to URL
                $browser->Navigate($graburl);   
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
</head>
<body>
  <form id="formurl" method="get" action="testgrab3.php" >
      <input id="formtext" type="text" name="thumbnailurl"/>
      <input id="formbuttonurl" type="submit" name="Submit" value="Grab URL"/>
  </form>
</body>
</html>
www.WeAnswer.IT
Forum Newbie
Posts: 24
Joined: Wed Mar 19, 2008 6:33 pm

Re: PHP 5.2.5 / Apache / NT / COM Objects Problem.

Post by www.WeAnswer.IT »

I have no idea why you would want to do whatever you're trying to do, but it is almost definitely a security setting on your server. Your best bet is to post again, but this time describe what you want to do, rather than asking people to fix what you're already trying.

PHP (unless you're talking about PHP-GTK) is not really a good language for interacting with client-side applications like Internet Explorer. It was made to process hypertext, hence the name: PHP Hypertext Processor.
lonetraceur
Forum Newbie
Posts: 4
Joined: Mon Mar 17, 2008 12:06 pm

Re: PHP 5.2.5 / Apache / NT / COM Objects Problem.

Post by lonetraceur »

Thank you for your response. I don't have a lot of experience with the Security Settings of Servers unfortunately... do you have any tips for things to check?

Sorry for the vagueness of the question above, its just that it would take FAR too much explaning of why i'm trying to do what i'm trying to do... so I have isolated it to a smaller question... Many thanks though, i'll research security settings.
www.WeAnswer.IT
Forum Newbie
Posts: 24
Joined: Wed Mar 19, 2008 6:33 pm

Re: PHP 5.2.5 / Apache / NT / COM Objects Problem.

Post by www.WeAnswer.IT »

Since you know it works locally, the best place to start is to make sure that your server and your home computer have PHP installed the exact same way. Differences in their configuration or installation could tell you why one works and the other doesn't.

There are two methods you should use to do this: the first is to compare the output of ini_get_all() on both computers, and the second is to compare the phpinfo() output on both your server and your home computer.

Method 1: comparing ini_get_all()
1. Create a new file on your home server. Put this in it:

Code: Select all

 
<?php header("Content-Type: text/plain"); ?>
<?php
$server_ini = init_get_all();
$home_ini = <?php var_export(init_get_all()); ?>;
$differences = array_diff_assoc($server_ini, $home_ini);
print_r($differences);
?>
2. Open up the file from step 1 in your browser. You should see (lengthy) output that looks like PHP. Copy and paste all of the output (NOT the source!) into a new file in your Win NT server and run it.

It should print_r() the differences in the php.ini files of your server's PHP installation and your home PHP installation. I just wrote that code and I am not on my own computer, so I can't try it, so let me know if you get an error and I'll fix it.


Method 2: comparing phpinfo()
1. Create a file on your home computer. Do not tell anyone what you're naming it, and do not name it "phpinfo.php" or "info.php" or "php.php".
2. Put this line in the file:

Code: Select all

<?php phpinfo(); ?>
3. Save this to two places, your local Apache web folder and your server's web folder.
4. Open both files in your browser and scan them for differences. This will probably be time-consuming, but there should be whole chunks of settings and information that you can rule out as being part of your COM problem.
Post Reply