php speed test not working: missing library

Using applications, configuring, problems
Message
Author
fixit

php speed test not working: missing library

#1 Post by fixit »

This is a script that calculates download speeds.

Code: Select all

# php speedtest.php
php: error while loading shared libraries: libmcrypt.so.4: cannot open shared object file: No such file or directory

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#2 Post by Semme »

A reference :roll: would've been nice. Anything else wrong?

Other than that, your item's in the repo and may require a symlink to function properly.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#3 Post by fixit »

php is a program I installed using package manager.

I do not understand why it so many other programs listed in package manage don't come with all required libraries and other necessary items.

And a search for the missing library did not yield a Puppy version.

And view files in PM is not working anymore.
It used to open a text file.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#4 Post by Semme »

Missing lib, Pup version? Not sure what you meant there..

I don't necessarily grasp the next bit either. Are you hinting that Pups pkg mngr's broken?

What could I do to help you?
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#5 Post by fixit »

See my sig for Pup version. :-)

Puppy packager manager works, but I can't view missing libraries like I used to.

For example, I install a program and it has missing libraries.

There is a button (VIEW FILES) that shows missing libraries by opening up a text program with the missing libraries.

Clicking on it no longer does anything.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#6 Post by Semme »

Does it update?

Is there anything in /initrd/pup_ro2/usr/local/petget that isn't in /usr/local/petget?

I think maybe all this attribute fiddling has caught up with you.

Let's see your permissions:

Code: Select all

ls -l /usr/local/petget
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#7 Post by fixit »

Code: Select all

-rwxr-xr-x 1 root root 31273 Aug 12  2013 0setup
-rwxr-xr-x 1 root root   470 Aug 12  2013 ArchRunDotInstalls
-rw-r--r-- 1 root root 23409 Feb 10  2013 categories.dat
-rwxr-xr-x 1 root root 12117 Aug  4  2013 check_deps.sh
-rwxr-xr-x 1 root root  7891 Aug 12  2013 configure.sh
-rwxr-xr-x 1 root root 42848 Aug 12  2013 debdb2pupdb
-rwxr-xr-x 1 root root 12624 Aug  4  2013 dependencies.sh
-rwxr-xr-x 1 root root 22643 Aug  4  2013 downloadpkgs.sh
-rwxr-xr-x 1 root root  4575 Aug  4  2013 fetchinfo.sh
-rwxrwxrwx 1 root root 11340 Aug  4  2013 filterpkgs.sh
-rwxr-xr-x 1 root root 46816 Aug 12  2013 find_cat
-rwxr-xr-x 1 root root  7485 Aug  4  2013 findmissingpkgs.sh
-rwxr-xr-x 1 root root 12411 Aug  4  2013 findnames.sh
-rwxr-xr-x 1 root root  1783 Aug  4  2013 finduserinstalledpkgs.sh
-rwxr-xr-x 1 root root  5876 Aug  4  2013 hacks-postinstall.sh
-rw-r--r-- 1 root root  9727 Aug  4  2013 help-fr.htm
-rw-r--r-- 1 root root  9381 Aug  4  2013 help.htm
-rwxr-xr-x 1 root root 32994 Aug  4  2013 installpkg.sh
-rwxr-xr-x 1 root root 23551 Aug  4  2013 installpreview.sh
-rwxr-xr-x 1 root root  6808 Aug 12  2013 mageia2ppm
-rwxrwxrwx 1 root root 13538 Aug  4  2013 petget
-rwxrwxrwx 1 root root 22860 Aug 12  2013 pkg_chooser.sh
-rwxr-xr-x 1 root root  3408 Aug  4  2013 postfilterpkgs.sh
-rw-r--r-- 1 root root 10535 Aug  4  2013 README-add-repo.htm
-rw-r--r-- 1 root root   609 Aug  4  2013 README.txt
-rwxr-xr-x 1 root root  9849 Aug  4  2013 removepreview.sh
-rwxr-xr-x 1 root root  3833 Aug 12  2013 rpm2ppm
-rwxr-xr-x 1 root root  6582 Aug  4  2013 service_pack.sh
-rwxr-xr-x 1 root root  2197 Aug  4  2013 show_installed_version_diffs.sh
-rwxr-xr-x 1 root root  1045 Aug  4  2013 testurls.sh
-rwxr-xr-x 1 root root  7354 Aug  4  2013 ui_Classic
-rwxr-xr-x 1 root root  8950 Aug  4  2013 ui_Ziggy
-rwxr-xr-x 1 root root  2163 Aug  4  2013 verifypkg.sh
/initrd/pup_ro2/usr/local/petget does NOT exist.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#8 Post by Semme »

Those check out and libmcrypt's in a *functioning* PPM. What about my other question?
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#9 Post by fixit »

I can't compare 2 directories when I only have one.

Code: Select all

/initrd/pup_ro2/usr/local/petget does NOT exist.[/quote]

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#10 Post by Semme »

That directory's found on a *frugal* install. Since that's NOT what we're addressing, does PPM update?

No? Would you like a copy of that missing lib?
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#11 Post by fixit »

If by PPM update you mean does it update it's database, then yes it does does that.

Yes, thanks for the missing lib.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#12 Post by Semme »

That's good because it's important for pacman to function.

Now before the lib, search PPM for libmcrypt.. it should show.

As for what else may be missing from php, run: ldd /usr/bin/php

If it's somewhere else, use >> which php or find / -name php

If you can't get those to work, look here.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#13 Post by fixit »

libmcrypt 2.5.8 is installed.

# ldd /usr/bin/php
linux-gate.so.1 (0xffffe000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb76e6000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb76cd000)
libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0xb76a1000)
libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb7696000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb75af000)
libm.so.6 => /lib/libm.so.6 (0xb7583000)
libpcre.so.0 => /usr/lib/libpcre.so.0 (0xb7546000)
librt.so.1 => /lib/librt.so.1 (0xb753d000)
libnsl.so.1 => /lib/libnsl.so.1 (0xb7522000)
libz.so.1 => /lib/libz.so.1 (0xb750b000)
libssl.so.1 => /lib/libssl.so.1 (0xb74a8000)
libcrypto.so.1 => /lib/libcrypto.so.1 (0xb72f1000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb71a3000)
libdl.so.2 => /lib/libdl.so.2 (0xb719e000)
liblzma.so.5 => /lib/liblzma.so.5 (0xb7179000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb715e000)
libc.so.6 => /lib/libc.so.6 (0xb6fd9000)
/lib/ld-linux.so.2 (0xb771a000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb6fbc000)

What is this showing me ?

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#14 Post by Semme »

:? Does the script run? Confirm it's the one from the page I posted earlier.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#15 Post by fixit »

I can't find any script you posted, only some command line items.

Running this php script, yields the messages at the end of this message.

Code: Select all

#!/usr/bin/php5
<?php
/*
 *  Speedtest.net linux terminal client.
 *  This is free and open source software by Alex based on a script from Janhouse
 *  Script uses curl, executes ifconfig commands in shell and writes temporary files in temp_down folder. Make sure you have everything set up before using it.
 */
header("content-type: text/plain");
/* * *              Configuration                   * * */
$iface="eth0";
$maxrounds=4;
$downloads="temp_down/";
$uploads="upload/";
$datadir="data/";
/* * *              Speedtest servers               * * */
$do_server['seattle'] = "http://speedtest.rainierconnect.com";
$do_server['east oregon'] = "http://speedtest.eotnet.net";
$do_server['portland'] = "http://speed.opusnet.com";
$do_server['estacada,or'] = "http://speed.rconnects.com/";

/* Variables */
$randoms=rand(100000000000, 9999999999999);
$time=time();
$day=date("d-m-Y");
$do_size[1]=500;
$do_size[2]=1000;
$do_size[3]=1500;
$do_size[4]=2000;
$do_size[5]=2500;
$do_size[6]=3000;
$do_size[7]=3500;
$do_size[8]=4000;

/* * *              The rest                        * * */
function latency($round){
    global $server, $downloads, $do_server, $server, $iface, $randoms, $do_size,$globallatency,$maxrounds;

    $file=$downloads."latency.txt";
    $fp = fopen ($file, 'w+');
    $ch = curl_init($do_server[$server]."/speedtest/latency.txt?x=".$randoms);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 50);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

    $starttime=microtime(true);
    $response=curl_exec($ch);
    $endtme=microtime(true);

    $duration=$endtme-$starttime;

    curl_close($ch);
    fclose($fp);
    unlink($file);

    print round($duration, 2)."sec.";

    $globallatency+=$duration;
    if ($round > 1){
        latency(--$round);
    } else {
        print "\tAverage:".round($globallatency/$maxrounds, 2)."sec.\n";
    }
}

function download($size,$round){
    global $server, $downloads, $do_server, $server, $iface, $randoms, $do_size,$globaldownloadspeed,$maxrounds;

    $file=$downloads."fails_".$size.".jpg";

    print ".";
    $fp = fopen ($file, 'w+');
    $ln = $do_server[$server]."/speedtest/random".$do_size[$size]."x".$do_size[$size].".jpg?x=".$randoms."-".$size;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$ln);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 50);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

    $starttime=microtime(true);
    $sakuma_rx=shell_exec("sudo ifconfig ".$iface."|grep RX\ bytes|awk '{ print $2 }'|cut -d : -f 2");
    $response=curl_exec($ch);
    $beigu_rx=shell_exec("sudo ifconfig ".$iface."|grep RX\ bytes|awk '{ print $2 }'|cut -d : -f 2");
    $endtme=microtime(true);

    if ($response === false){
       print "Request failed:".curl_error($ch);
    }
    curl_close($ch);
    fclose($fp);

    #unlink($file);

    $duration=$endtme-$starttime;

    if($duration<4 && $size!=8) {
        download(++$size,$round);
    }else{
        $sakuma_rx=trim($sakuma_rx);
        $beigu_rx=trim($beigu_rx);
        $rx=$beigu_rx-$sakuma_rx;
        $rx_speed=((($rx*8)/1000)/1000)/$duration;
        write_to_file(round($rx_speed, 2), "d");
        if($duration<4){
          print "Duration is ".round($duration, 2)."sec - this may introduce errors.\n";
        }
        print round(filesize($file)/1000000,2)."Mb at ".round($rx_speed, 2)."Mb/s";
        $globaldownloadspeed+=$rx_speed;
        if ($round > 1){
           download($size,--$round);
        } else {
           print "\tAverage: ".round($globaldownloadspeed/$maxrounds, 2)." Mb/s.\n";
  }
    }
}

function upload($size,$round){
    global $server, $uploads, $do_server, $server, $iface, $randoms,$globaluploadspeed,$maxrounds;

    $file=$uploads."upload_".$size;

    print ".";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_URL, $do_server[$server]."/speedtest/upload.php?x=0.".$randoms);
    curl_setopt($ch, CURLOPT_POST, true);
    $post = array(
        "file_box"=>"@".$file,
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

    $starttime=microtime(true);
    $sakuma_tx=shell_exec("sudo ifconfig ".$iface."|grep TX\ bytes|awk '{print $6}'|cut -d: -f2");
    $response = curl_exec($ch);
    $beigu_tx=shell_exec("sudo ifconfig ".$iface."|grep TX\ bytes|awk '{print $6}'|cut -d: -f2");
    $endtme=microtime(true);

    if ($response === false){
       print "Request failed:".curl_error($ch);
    }
    $aiznem=substr($response, 5);
    $kopa=filesize($file)+$aiznem;

    $duration=$endtme-$starttime; // sekundes

    if($duration<4 && $size!=8){
        #print round(filesize($file)/1000000,2)."Mb is to small: ".round($duration, 2)."sec\n";
        upload(++$size,$round);
    }else{
        $sakuma_tx=trim($sakuma_tx);
        $beigu_tx=trim($beigu_tx);
        $tx=$beigu_tx-$sakuma_tx;
        $tx_speed=((($tx*8)/1000)/1000)/$duration;
        write_to_file(round($tx_speed, 2), "u");
        if($duration<4){
          print "Duration is ".round($duration, 2)."sec - this may introduce errors.\n";
        }
        print round(filesize($file)/1000000,2)."Mb at ".round($tx_speed, 2)."Mb/s";
        $globaluploadspeed+=$tx_speed;
        if ($round > 1){
           upload($size,--$round);
        } else {
           print "\tAverage: ".round($globaluploadspeed/$maxrounds, 2)." Mb/s.\n";
  }
    }
}

function write_to_file($data, $updown){ // u - upload; d - download
    global $day, $time, $datadir, $iface;
    $fp = fopen($datadir."data_".$day.".txt", "a");
    fwrite($fp, $time."|".$updown."|".$iface."|".$data."\n");
    fclose($fp);
}

foreach ($do_server as $server => $serverurl){
  $globallatency=0;
  print "* Testing latency for $server...";
  latency($maxrounds);
}
foreach ($do_server as $server => $serverurl){
  $globaldownloadspeed=0;
  print "* Testing download speed for $server...";
  download(1,$maxrounds);
}
foreach ($do_server as $server => $serverurl){
  $globaluploadspeed=0;
  print "* Testing upload speed $server...";
  upload(1,$maxrounds);
}
?>

# php speedtest.php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/dba.so' - libdb-4.8.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/gd.so' - libt1.so.5: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/intl.so' - libicui18n.so.49: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/snmp.so' - libnetsnmp.so.25: cannot open shared object file: No such file or directory in Unknown on line 0
Could not open input file: speedtest.php
#

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#16 Post by Semme »

When you installed PHP, did you forget the ones in my screenie?

You'll also need db48 and icu4c >> BOTH in PPM.

Here I went with the default servers..

Code: Select all

* Testing latency for seattle...0.21sec.0.2sec.0.21sec.0.21sec.	Average:0.21sec.
* Testing latency for east oregon...0.24sec.0.24sec.0.24sec.0.24sec.	Average:0.24sec.
* Testing latency for portland...0.22sec.0.22sec.0.22sec.0.22sec.	Average:0.22sec.
* Testing latency for estacada,or...0.22sec.0.22sec.0.22sec.0.22sec.	Average:0.22sec.
* Testing download speed for seattle....0.51Mb at 0.82Mb/s.0.51Mb at 0.98Mb/s.0.51Mb at 0.77Mb/s.0.51Mb at 0.97Mb/s	Average: 0.88 Mb/s.
* Testing download speed for east oregon....0.51Mb at 1.01Mb/s.0.51Mb at 0.8Mb/s.0.51Mb at 1.01Mb/s.0.51Mb at 0.78Mb/s	Average: 0.9 Mb/s.
* Testing download speed for portland....0.51Mb at 0.97Mb/s.0.51Mb at 0.97Mb/s.0.51Mb at 0.97Mb/s.0.51Mb at 0.75Mb/s	Average: 0.92 Mb/s.
* Testing download speed for estacada,or....0.51Mb at 1.03Mb/s.0.51Mb at 0.8Mb/s.0.51Mb at 1.03Mb/s.0.51Mb at 1.02Mb/s	Average: 0.97 Mb/s.
* Testing upload speed seattle.....0.51Mb at 0.39Mb/s.0.51Mb at 0.39Mb/s.0.51Mb at 0.39Mb/s.0.51Mb at 0.39Mb/s	Average: 0.39 Mb/s.
* Testing upload speed east oregon.....0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s	Average: 0.38 Mb/s.
* Testing upload speed portland.....0.51Mb at 0.39Mb/s.0.51Mb at 0.39Mb/s.0.51Mb at 0.38Mb/s.0.51Mb at 0.39Mb/s	Average: 0.39 Mb/s.
* Testing upload speed estacada,or.....0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s.0.51Mb at 0.38Mb/s	Average: 0.38 Mb/s.
Attachments
slacko_php-deps1.jpg
(64.75 KiB) Downloaded 421 times
slacko_php-deps2.jpg
(34.39 KiB) Downloaded 427 times
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#17 Post by fixit »

This is only a small part of the message I received.

:-(

I am looking for any working script that will show my DSL download speed.

# php speedtest.php
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /root/Downloads/speedtest.php on line 24
* Testing latency for seattle...PHP Warning: fopen(temp_down/latency.txt): failed to open stream: No such file or directory in /root/Downloads/speedtest.php on line 39
PHP Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /root/Downloads/speedtest.php on line 44
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /root/Downloads/speedtest.php on line 54
PHP Warning: unlink(temp_down/latency.txt): No such file or directory in /root/Downloads/speedtest.php on line 55
0.23sec.PHP Warning: fopen(temp_down/latency.txt): failed to open stream: No such file or directory in /root/Downloads/speedtest.php on line 39
PHP Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /root/Downloads/speedtest.php on line 44

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#18 Post by Semme »

Did you create the *required* directories? Did you run gen_upload_files.sh?

If you're too busy :):roll: you could always go with one of the online testers..
Attachments
directory_structure.jpg
(18.78 KiB) Downloaded 509 times
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

fixit

#19 Post by fixit »

After getting db48 and icu4c, some progress.

I am getting download speeds as well as some error messages.

PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /root/Downloads/speedtest.php on line 24

Line 24 is $day=date("d-m-Y");

I can't find date.timezone in download.php.

I'// get this "puppy" going. :-)

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#20 Post by Semme »

:D Well, we're closing in on twenty questions..
Last edited by Semme on Wed 17 Sep 2014, 01:24, edited 2 times in total.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

Post Reply