PHP - Imagefilledellipse() Renders As A Square On My Server, Not On My Xampp
This is really strange and throwing me for a loop. I suspect there's a config setting somewhere in my PHP setup on my server which I am missing...
I have a PHP script that renders a vector drawing (as a series of lines/points) into a png image. When I'm testing the script on my local machine (XAMPP + OSX) everything works great. When the script runs on my host (hostgator) the imagefilledellipse() function renders as a square instead of a circle. Screenshots below. Try the server version for yourself at http://sundrynotes.com/alpha/ (press "create new note" in the lower right then long-press on the note and select the "whiteboard" option, draw, then press "accept"). Similar TutorialsI have a website uploaded onto Host Gator hosting and the sessions are carried over to the other pages ok. When using the same website in XAMPP it does not carry over the session to the next page and need to login again. If i log in it puts the following after the URL - ?sid=3b71942d410d84c45f9f4433561c325a The when i go to another link it loses the sid and i'll need to manualy past it into the next URL to get it working unless i log in again on the new page. This is only happening with XAMPP but working fine in the Host Gator hosting environment. Please help! My login is integrated with the phpbb3 login. This is the code at the beginning of every page - Code: [Select] <?php ob_start(); define('IN_PHPBB', true); $phpbb_root_path = './phpbb3/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); ?> Hi all, $account="54646456456464"; $station= "12345"; $options="11-1"; $image="C:/Desktop/Sample Images/usco1.jpg"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://dfdgfsfs.com/kgdfgd.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image' => '@'.$image, 'account' => $account, 'station' => $station, 'options' => $options)); $postResult = curl_exec($ch); curl_close ($ch); $xmlobj = simplexml_load_string($postResult); echo (string)$xmlobj->ID->attributes()->value; echo (string)$xmlobj->FullName->attributes()->value;All, I have spend days trying to figure this out without any luck. I am now in crisis mode. I need to get this working asap. The following code works perfect on my local xampp machine. As soon as I upload it to my web server, I don't get any data back. I have narrowed it down to the image i am trying to send is not being received properly. Thanks in advance. Hi, this, i think, is a 'php in firefox' issue despite me mentioning css in the title so please read on!.. please have a look, using firefox, at http://www.laureleroch.com/gallery.php... As you can see, when choosing different images via clicking on the thumbnails the page reloads and there's an amount of time where we see the page loaded without css applied..., however doesn't seem to be happening in IE9, opera, chrome, or safari. It IS happening in firefox on W7 and OSX. the file gallery.php has... <?php session_start(); ob_start(); include("scripts/php/gallery_display.php"); include("scripts/php/file_reader.php"); ...as its start...and... </body> </html> <?php ob_flush() ?> ..at its end. I can post all the code from the includes if required. I'd say there's a fair bit of processing done by these includes but really, not THAT much, plus other browsers seem to be doing ok with it. Also, the background images are big. That's a fact. The site will be in this way and I plan to use a preloader once I get the main build sorted...nearly there. One other thing...I really am a coding newbie. I've been toying with it for years, first with actionscript in flash, then html/css and now I'm getting really into php, however I'm sure my coding is pretty inefficient here and there thru nothing other than pure, undiluted ignorance...good, eh?! so, if anyone got some pointers that would be really brilliant... any other info required - please shout. cheers, Scott I am returning the following through JSON: Code: [Select] $this->view->lead_query=$lead_query->fetchALL(); header('OK', true, 200); header('Content-type: application/json'); echo json_encode($this->view->lead_query); I am getting the results in this format: [{"client_name":"Steve Harris","state":"TX"}] Now if the above output was displayed without the square brackets [] I can populate the values in my form correctly. Is there a way i can return the output without the square brackets? Hi all, In my string I have hidden characters that has a shape of square. When I print the string, it shows questions mark. When I opened it with notepad, it show a square shaped character. I want to remove this character in my strings. I have searched the web. Somebody says its carriage return but i think it is not. Could you please help me with this issue. Thanks alot. Hello, I'm trying to calculate the square root of X values in an array minus the average of the array, but the first half of the values are negative, so I'm using the abs(); function to change them to positives first, but I'm still getting "NAN" as the result for the negative values that 'should' be positive. $x = array(7,3,4,6,4,2,7); $sqrt = true; $x = sort($x); $mean = 4.71; // average $XminA = array(); foreach($x as $val) { ($sqrt == true) ? $XminA[] = round(sqrt(abs($val) - $mean),2) : $XminA[] = round($val - $mean,2); } echo "<pre>"; print_r($XminA); echo "</pre>"; and my result is... Quote [XminA] => Array ( => NAN [1] => NAN [2] => NAN [3] => NAN [4] => 1.14 [5] => 1.51 [6] => 1.51 ) Not sure what I'm doing wrong, any help is appreciated. Thank you! Kind Regards, Ace EDIT: stupid mistake, need it to the power of 2 not square root. Using the wrong function sorry: ($sqrt == true) ? $XminA[] = round(pow((abs($val) - $mean),2) : $XminA[] = round($val - $mean,2); // pow() not sqrt() Quote [XminA] => Array ( => 7.34 [1] => 2.92 [2] => 0.5 [3] => 0.5 [4] => 1.66 [5] => 5.24 [6] => 5.24 ) Hi, I have just created an algorithm and could this be the greatest algorithm invented for calculating square roots? Perhaps the answer is yes with 100% accuracy unlike some algorithms that round the last digit up. Below is the algorithm I have created and I used php. Also this algorithm can easily be imported into any language with any bitrate and is very scalable unlike some of the standard built in square root algorithms for some interpreters (all of the ones tested so far). Now below is the code with it in both the form of a class and the form of a function. You may notice that the function name is funny but it is tatically named that way so that the string length of the function name is the same as the sqrt() function so you don't get qwerky results when comparing the two. <?php class sqrt { public $value; function __construct($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } echo $i; $this->value = $i; return $this->value; } } function mysq($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } return $i; } $s = microtime(true); mysq(128); $e = microtime(true); $a=($e-$s); unset($e,$s); sleep(1); $s = microtime(true); sqrt(128); $e = microtime(true); echo 'mysq time &#160;&#160;='.$a.'<br>'; echo 'mysq result='.mysq(128).'<br>'; echo 'sqrt time&#160;&#160;='.($e-$s).'<br>'; echo 'sqrt result='.sqrt(128).'<br>'; echo 'The mysq function is '.bcdiv(substr(($e-$s),0,11),$a,0).' times faster for this calculation.<br>'; I am trying to work on a code for php where you first have a form that asks the user to input a message then input a color. When they click the submit button it takes them to the output page. It should take their message and output it into boxes in a square. And the background should turn the color that they types in. can abybody tell where to write php code & sql statements in Xampp Please help. I am running xampp for windows - it contains apache, ssl, php, mysql. I am unable to generate a key/cert via php even though everything is apparently set up and running correctly. I ran a script and it said the following Quote Warning: openssl_csr_sign() [function.openssl-csr-sign]: cannot get CSR from parameter 1 in C:\xampp\htdocs\cert.php on line 31 Warning: openssl_csr_export() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cert.php on line 40 Warning: openssl_x509_export() [function.openssl-x509-export]: cannot get cert from parameter 1 in C:\xampp\htdocs\cert.php on line 41 Warning: openssl_pkey_export() [function.openssl-pkey-export]: cannot get key from parameter 1 in C:\xampp\htdocs\cert.php on line 42 error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib cert.php <?php $configargs = array( 'config' => '../apache/bin/openssl.cnf', 'digest_alg' => 'md5', 'x509_extensions' => 'v3_ca', 'req_extensions' => 'v3_req', 'private_key_bits' => 666, 'private_key_type' => OPENSSL_KEYTYPE_RSA, 'encrypt_key' => false, ); $dn = array( "countryName" => "IE", "stateOrProvinceName" => "cork", "localityName" => "cork", "organizationName" => "org", "organizationalUnitName" => "Organizational Unit Name", "commonName" => "example.com", "emailAddress" => "Email Address" ); // Generate a new private (and public) key pair $privkey = openssl_pkey_new($configargs); // Generate a certificate signing request $csr = openssl_csr_new($dn, $privkey); // You will usually want to create a self-signed certificate at this // point until your CA fulfills your request. // This creates a self-signed cert that is valid for 365 days $sscert = openssl_csr_sign($csr, null, $privkey, 365); // Now you will want to preserve your private key, CSR and self-signed // cert so that they can be installed into your web server, mail server // or mail client (depending on the intended use of the certificate). // This example shows how to get those things into variables, but you // can also store them directly into files. // Typically, you will send the CSR on to your CA who will then issue // you with the "real" certificate. openssl_csr_export($csr, $csrout) and var_dump($csrout); openssl_x509_export($sscert, $certout) and var_dump($certout); openssl_pkey_export($privkey, $pkeyout, "mypassword") and var_dump($pkeyout); // Show any errors that occurred here while (($e = openssl_error_string()) !== false) { echo $e . "\n"; } ?> This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=334216.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=348673.0 Hi, i had today problem with my script. Everything worked well on my localhost(xampp server) and when i uploaded on dedi machine functions with MySQL database stoped working. Problem was with mysql_real_escape_string and i forgot that i must first open connection and then mysql_real_escape_string... But strange thing is that on xampp server i dont need to open connection for mysql_real_escape_string, and everything worked well... is there any solutio to php scripts on xampp worke same as php script on linux apache server? Hey, practicing my PHP for the first time, starting with a simple upload script with Xampp. Script: Code: [Select] $target = '/Uploads'; $uploadedfile = $target . basename($_FILES['file']['name']); if(move_uploaded_file($_FILES['file']['tmp_name'], $target)){ echo "The file ". basename($_FILES['file']['name'])." has been uploaded."; } else { echo 'Failed'; } error_reporting(E_ALL); It echos out a successful, but the file is nowhere? Uploads is inside htdocs. Checked my php.ini file: file_uploads = On upload_tmp_dir = "C:\xampp\tmp" upload_max_filesize = 128M Just wondering if there are any permission i may have missed? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=345826.0 Hey guys! I am using xampp 1.7.7 usb edition for my php server and I am trying to include a php file that's different from where I have all my php files at. I have them in: \xampp\htdocs\xampp\RecipeSite. Is there a certain path I should use instead of <?php include('/xampp/splash.php'); ?> to allow for xampp to pick up my file? I appreciate your solutions guys. This topic has been moved to Installation in Windows. http://www.phpfreaks.com/forums/index.php?topic=332859.0 I have a Xampp Timezone Error Error Warning: strtotime() [function.strtotime]: 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 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\NoXIp\Toplist\inc\vote.php on line 56 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' NOW())' at line 1 Line 56 $diffrence = time() - strtotime($getDate['lastVoteDate']); The Date Function in Php.ini [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "America/New_York" date.timezone = "America/New_York" ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 ; http://php.net/date.default-longitude ;date.default_longitude = 35.2333 ; http://php.net/date.sunrise-zenith ;date.sunrise_zenith = 90.583333 ; http://php.net/date.sunset-zenith ;date.sunset_zenith = 90.583333 |