PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Thu Nov 29, 2007 3:18 pm Reply with quote Back to top

CURL is a library for doing http type stuff. That's a really lame answer. They should be able to tell you immediately if fsockopen() is ok to use. Hint: get a new host. Smile
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15210
Location: Kansas

PostPosted: Fri Nov 30, 2007 10:13 am Reply with quote Back to top

Try
Only registered users can see links on this board!
Get registered or login to the forums!
and/or change hosts.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
benson
Worker
Worker


Joined: May 15, 2004
Posts: 119
Location: Germany

PostPosted: Tue Jan 01, 2008 6:32 am Reply with quote Back to top

Hello,

first of all, HAPPY NEW YEAR to all of you!

Now my problem:

After updating to NukeSentinel(tm) 2.5.15 I can not access to the admin panel anymore.

I get this error:
Code:
Fatal error: Call to undefined function socket_create() in /srv/www/htdocs/nuke/admin/modules/nukesentinel.php on line 22
and above mentioned scrip dies with
Code:
Fatal error: Call to undefined function socket_create() in /srv/www/htdocs/nuke/admin/modules/nukesentinel.php on line 22


That may have something to do with 'Ravens Improved socket testing. (Thanks to Raven)' Embarassed ?

It does not work on my local OpenSuse system and even not on my vendor system. What can I do to get it fixed?
View user's profile Send private message Visit poster's website
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2846

PostPosted: Tue Jan 01, 2008 6:51 am Reply with quote Back to top

Hm socket_create is available for PHP 4.07 and higher. So it should work.
Only registered users can see links on this board!
Get registered or login to the forums!

One caveat is that the web server must be running as root. My guess your server, as is most servers, isn't. Not a fix, but at least an explaination
View user's profile Send private message Visit poster's website
benson
Worker
Worker


Joined: May 15, 2004
Posts: 119
Location: Germany

PostPosted: Tue Jan 01, 2008 7:14 am Reply with quote Back to top

evaders99 wrote:
Hm socket_create is available for PHP 4.07 and higher. So it should work.


That is what the server shows to me:

* PHP Version 4.4.4
* MYSQL_SOCKET /var/lib/mysql/mysql.sock
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15210
Location: Kansas

PostPosted: Tue Jan 01, 2008 12:47 pm Reply with quote Back to top

Also, please see these posts that might help. We will look into this further.
Only registered users can see links on this board!
Get registered or login to the forums!
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15210
Location: Kansas

PostPosted: Tue Jan 01, 2008 12:50 pm Reply with quote Back to top

Evaders99 wrote:
One caveat is that the web server must be running as root

This is dependent on how the socket_create function is being called. User scripts can also execute an equivalent operation. We (and/or Bob) need to look into this as I believe this was an issue before v2.5.15.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
bobbyg
Regular
Regular


Joined: Dec 05, 2007
Posts: 72
Location: Tampa, Florida

PostPosted: Mon Jan 07, 2008 2:29 am Reply with quote Back to top

Gremmie wrote:
CURL is a library for doing http type stuff. That's a really lame answer. They should be able to tell you immediately if fsockopen() is ok to use. Hint: get a new host. Smile


To test Fopen and Curl
Code:
<?PHP

// This script tests two methods of connecting to the feed server to see which are enabled
$data = getDataViaFopen("http://www.msn.com");
if (!empty($data1)) print "Fopen Works<br>";
$data = '';

$data = getDataViaFsockopen("http://www.msn.com/");
if (!empty($data)) print "Fsockopen Works<br>";
$data = '';

$data = getDataViaCURL("http://www.msn.com/");
if (!empty($data)) print "cURL Works (This is the prefered access method)<br>";
$data = '';

function getDataViaFopen($url){
   $file_contents = '';
   $file_handle = fopen ($url, "r");
   
   if (!$file_handle) {
      print "Fopen test failed.<br>";
      exit;
   }

   while (!feof($file_handle)) {
      $file_contents .= fread($file_handle, 8192);
   }
   fclose($file_handle);
   return $file_contents;
}

function getDataViaFsockopen( $url ) {
   $file_contents = '';
   $url_parsed = parse_url($url);
   $host = $url_parsed["host"];
   $port = 80;
   $path = $url_parsed["path"];
   $query = isset($url_parsed["query"]) ? "?".$url_parsed["query"]  : "";

   //if url is http://example.com without final "/"
   //I was getting a 400 error
   if (empty($path)) $path="/";

   $path .= $query;
   $out = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n";
   $fp = fsockopen($host, $port, $errno, $errstr, 30);
   
   if (!$fp) {
      echo "Fsockopen test failed.";
   } else {   
      fwrite($fp, $out);
      $body = false;
      while (!feof($fp)) {
         $file_contents .= fgets($fp, 8192);
      }
      fclose($fp);
      return $file_contents;
   }
}

function getDataViaCURL($url){
   $ch = curl_init();    // initialize curl handle

   curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
   curl_setopt($ch, CURLOPT_FAILONERROR, 1);              // Fail on errors
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);    // allow redirects
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
   curl_setopt($ch, CURLOPT_PORT, 80);            //Set the port number
   curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out

   $file_contents = curl_exec($ch);

   return $file_contents;
}

?>
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum