Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Curl / GD not working, pulling my hair out!

Featured Replies

Hi Guys,

 

I have the latest version of Uniserver ZeroXL installed and running. I've transferred across from XAMPP and I wanted something lighter and less bloated.

 

The only issue I'm having is that one of my PHP scripts relies on curl and GD to pull images from my IP camera, sadly I cannot get this to work using Uniserver - it works fine with the default install of XAMPP.

 

The message displayed is attached, I've also ensured that both curl and GD are ticked under PHP modules.

 

Any help getting this resolved would be greatly appreciated, I've spent hours googling around and trying various things with no luck...

 

I also tried the following code in check.php and it just displays a blank page.

<?
// is curl installed?
if (!function_exists('curl_init')){ 
die('CURL is not installed!');
}

// create a new curl resource
$ch = curl_init();
echo "OK";
?>

post-6846-0-34034500-1429260449_thumb.png

post-6846-0-05523800-1429261604_thumb.png

SecureImageDisplay.php

The above example code will not work because you are using short PHP tags Uniform Server defaults to using full PHP tags.



The following examples show curl and gd operation on a default installation 11_7_4_ZeroXI



curl example save as file z2.php



$image_url = "http://www.uniformserver.com/ZeroXI_documentation/common/images/us_zero_logo.png";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);

// output to browser
header("Content-type: image/png");
print $image;
?>

gd example save as file z3.php



header("content-type: image/png");
$src_img = imagecreatefrompng("images/logo.png");
$srcsize = getimagesize("images/logo.png");
$dest_x = $srcsize[0] / 2;
$dest_y = $srcsize[1] / 2;
$dst_img = imagecreatetruecolor($dest_x, $dest_y);

imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);
imagepng($dst_img);
imagedestroy($src_img);
imagedestroy($dst_img);
?>

To run type http://localhost/z2.php and http://localhost/z3.php



All the best


Ric


  • 2 years later...

 

The above example code will not work because you are using short PHP tags Uniform Server defaults to using full PHP tags.

 

The following examples show curl and gd operation on a default installation 11_7_4_ZeroXI

 

curl example save as file z2.php

<?php
$image_url = "http://www.uniformserver.com/ZeroXI_documentation/common/images/us_zero_logo.png";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);

// output to browser
header("Content-type: image/png");
print $image;
?>

gd example save as file z3.php

<?php
    header("content-type: image/png");
    $src_img = imagecreatefrompng("images/logo.png");
    $srcsize = getimagesize("images/logo.png");
    $dest_x = $srcsize[0] / 2;
    $dest_y = $srcsize[1] / 2;
    $dst_img = imagecreatetruecolor($dest_x, $dest_y);

    imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);
    imagepng($dst_img);
    imagedestroy($src_img);
    imagedestroy($dst_img);
?>

To run type http://localhost/z2.php and http://localhost/z3.php

 

All the best

Ric

 

Is there some set of instructions which CLEARLY state how to activate that can be found ANYWHERE? It's probly me, but I've read every question where there was difficulty with enabling the module, and that stock answer about downloading from PHP.net the same module of PHP as the Uniform Server is about as useful to me as breasts on a man. Can I get a clearcut pointer to some current information? PLEASE?!?!?!?!?

As it turns out...Google IS your friend in this case (lol!). Using the query "curlopt_cainfo option. Uniform Server", I was able to find a clue to my cURL dilemma, as well as anticipate for when I need access to the SSL extension for soon-to-come development. I've changed both the dev and production PHP ini files as I'm not sure which one is the default (posited the dev version, since I'm not using my box as an IIS platform). https://sorastation.com/tmp/JoomlaPC33/core/php54/php_production.ini - jarred loose confusion for me. Just seeing it laid out in front of me, led me to resolve this logjam myself, HTHSO.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.