LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 09-12-2014, 07:13 AM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
php: error while loading shared libraries: libmcrypt.so.4


This is a script that calculates download speeds.

Code:
php speedtest.php


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

php is a program I installed using Puppy package manager.

I do not understand why it so many other programs listed in package manager 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.
 
Old 09-13-2014, 04:56 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
you missed an important point I think. Php itself does not require libmcrypt, but probably that speedtest.php. I do not know it, but probably you have a readme or other documentation.
Furthermore I think you need to install libmcrypt4 too (if it was not installed).
 
1 members found this post helpful.
Old 09-13-2014, 11:00 PM   #3
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Who is using Puppy Linux as their primary O.S. ?
 
Old 09-16-2014, 10:28 AM   #4
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Running this php script, yields the messages at the end of this message.

Code:
#!/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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libgda-4.0.so.4: cannot open shared object file mahesh1234 Linux - Newbie 2 10-22-2013 11:06 PM
./testSo: error while loading shared libraries: libsy.so: cannot open shared object rohaanembedded Programming 5 06-03-2013 07:23 AM
top: error while loading shared libraries: libproc.so.2.0.6: cannot open shared objec ramesh_india2020 Linux - Newbie 6 07-29-2010 01:49 PM
top: error while loading shared libraries: libproc.so.2.0.6: cannot open shared objec ramesh_india2020 Linux - Server 1 07-29-2010 12:52 PM
gxine: error while loading shared libraries: libmozjs.so: cannot open shared object.. khronosschoty Slackware 10 11-10-2008 07:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration