You are not logged in.

#1 2009-03-15 18:14:06

Dinth
Member
From: London
Registered: 2009-03-02
Posts: 238

[PHP]simple script, works everywhere except Archlinux

Here is my script. It works everywhere (Debian, Ubuntu, Gentoo, CentOS) except my new Arch distribution.

<?php

$domains_array = array();
$tested_array = array();

$id = "hgEqp";
$queries = array('aaaa','bbbb','cccc');

srand((float)microtime()*1000000);
shuffle($queries);

foreach ($queries as $query) {

    $url = 'http://some.url/&query='.$query;

    for($i=0;$i<10;$i++) {
        $array = unserialize(file_get_contents($url.(1+($i*100))));
        $array_result = $array['ResultSet']['Result'];
        foreach ($array_result as $a) {
        preg_match("[http://(www\..+?)\/(.+?)]", $a['Url'], $preg);
            if ($preg[1] != "" && !in_array($preg[1],$tested_array)) {
        array_push($tested_array, $preg[1]);
            $strona = @file_get_contents("http://".$preg[1]);
        if ((strpos($strona, "test string") != FALSE) || (strpos($strona, "test string 2") != FALSE) || (strpos($strona, "test string 3") != FALSE)) {
            if ((int)trim(exec('python ./test_page.py -s '.rawurlencode($preg[1]))) != 0) {
            array_push($domains_array, $preg[1]);
                    echo "Domain ".$preg[1]." passed test and added to $domain_array...\n";
            }
            sleep(10);
        }
        }
    }
    echo "Finished page ".$i." of tested pages...\n";
    }
}
echo "Finished adding tested pages to array...\n";

print_R($domains_array);
?>

On Arch it isnt throwing any error, but it is doing nothing (and extremly fast, normally it works very long). Somebody knows why it isnt working on Arch?

PS. I have Python installed and fopen allowed in php config

Last edited by Dinth (2009-03-15 18:14:45)

Offline

#2 2009-03-15 18:41:06

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,694
Website

Re: [PHP]simple script, works everywhere except Archlinux

Well... putting your file in my Arch web server gives me a but of errors (as expected)  but the files is definitely read and processed.

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/ralvez/public_html/testing.php on line 18

Warning: file_get_contents(http://humber.ca/&query=bbbb1) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/ralvez/public_html/testing.php on line 18

Warning: Invalid argument supplied for foreach() in /home/ralvez/public_html/testing.php on line 20
Finished page 0 of tested pages...
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/ralvez/public_html/testing.php on line 18

Try using /var/logs/httpd/error_log and /var/log/everything.log to find what's wrong with the file in your system.


R.

Offline

#3 2009-03-15 22:27:09

Dinth
Member
From: London
Registered: 2009-03-02
Posts: 238

Re: [PHP]simple script, works everywhere except Archlinux

Ahh i forgot, im using it from PHP-CLI, so Apache dont works here.

Offline

#4 2009-03-16 00:43:31

PinkFloydYoshi
Member
From: United Kingdom
Registered: 2008-11-20
Posts: 29

Re: [PHP]simple script, works everywhere except Archlinux

Could be PHP version. I noticed the ArchLinux version of PHP also comes pre-patched with the Suhosin patch too unless I'm downloading a [community] version of it without realising. That, or your open_basedir is restricted?

Offline

Board footer

Powered by FluxBB