Search the Community
Showing results for tags 'php'.
-
Hi, I'm creating a social media with a real-time chat application using PHP WebSocket, the basic functionalities are working properly but I need to implement some other features as well. So I need help with the following related to the chat application: Login to the WebSocket using the credentials users use to log into the social media. Allow users to chat with their friends only. Identify users from the database using their ID and fetch data from the database. Show online/offline status based on the WebSocket. Show if a message is pending/sent/delivered/seen status. Show typing notification to the other user. I'm attaching a screenshot of the chat screen:
-
Hey! I've tried working through this as much as possible before wasting your time here, but I'm at a loss. I was trying to set up MongoDB Atlas alongside php to dynamically load what's essentially just a directory with some filters. Nothing memory-heavy, but a few hundred entries long with ~12 fields each, and I already have it in csv format, so I was thinking that it would just be really nice to not have to deal with typing everything in on static pages. Anyways, I have everything connected and working on my local machine (connected to Atlas), but was running into a wall getting the Mongodb drivers for PHP installed on HelioHost (or even finding out if it's possible in the first place). I had also tried using the composer.json file to install the dependencies, and while it brought up the package that would work, it couldn't install it due to the php.ini file and missing MongoDB extension. Then, after spending all night trying various versions of PHP, I kind of threw in the towel and thought I'd just go with what I wanted to do in the first place and utilize Node.js (or more specifically React/Next.js). But I'm running into similar issues of just not seeing what I'm missing/what needs done. I've read through the documentation and created the app.js file (with provided code), scrubbed this forum, and have looked on most every other forum that I can find. The parts around node.js in the Heliohost documentation mention/show some settings that I just don't see anywhere in my Plesk control panel. Same for PHP. I can change the version (as previously mentioned), but is there a way to install drivers/extensions beyond what's already shown in phpinfo? I'm hoping that I'm just missing something simple or perhaps it's just something that I need to ask for/about. So 2 questions: 1. Is it possible to use PHP with Mongodb's cloud database on here? 2. What's needed in order for the Node.js settings to show up?
-
I need urgent for this problem to be fixed: 1). php_value max_input_vars 5000 2). add this domain: barashada.helioh.st
-
Admin can you update all the apps that are on my server to the newest, please !
-
Hello, First of all, thank you for the service you provide. The "'--without-pear'" parameter seems to be active on the server's PHP.INI configuration, but I'm looking to use a tool that requires the features provided by "PEAR". Would it be possible for you to activate "PEAR" on the instance used by my domain, please? Server : johnny User : monsieurtom Domain : monsieurtom.helioho.st Thank you in advance for your reply. Best regards, Tom
-
Severity: Warning --> is_dir(): open_basedir restriction in effect. File(/var/lib/php/session) is not within the allowed path(s) Severity: Warning --> mkdir(): open_basedir restriction in effect. File(/var/lib/php/session) is not within the allowed path(s) My Config.php: $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = NULL; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE;
-
Hi, I'm trying to sort an array of colors based on their group/category. But, unfortunately, the sorted colors are not linear. So here's some codes for your reference. Function: sortColors: function sortColors($colors) { $s = $hue = $sat = $val = $final = []; foreach($colors as $k => $info) { $color = $info['hex']; $hex = strtolower(str_replace('#', '', $color)); $info['hex'] = $hex; $colors[$k] = $info; list($r, $g, $b) = str_split($hex, 2); $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); //$s[$k] = rgbtohsv($r, $g, $b); $s[$k] = rgbToHsl($r, $g, $b); $info['hex'] = "#$hex"; } //Split each array up into H, S and V arrays foreach($s as $k => $v) { $hue[$k] = $v['h']; $sat[$k] = $v['s']; $val[$k] = $v['l']; //$val[$k] = $v['v']; } $r = $s; $keys = array_keys($r); uasort( $r, function($a, $b) { if(!huesAreinSameInterval($a['h'],$b['h'])){ if ($a['h'] < $b['h']) return -1; if ($a['h'] > $b['h']) return 1; } if ($a['s'] < $b['s']) return -1; if ($a['s'] > $b['s']) return 1; if ($a['l'] < $b['l']) return 1; if ($a['l'] > $b['l']) return -1; return 0; } ); $i = 0; foreach($r as $k => $hsv) { $info = $colors[$k]; $hex = $info['hex']; $info['hex'] = "#$hex"; $info['hsv'] = $hsv; $final[] = $info; $i++; } return $final; } Input Array of Colors: Array ( [0] => Array ( [name] => Black [hex] => #000000 ) [1] => Array ( [name] => White [hex] => #FFFFFF ) [2] => Array ( [name] => Red [hex] => #FF0000 ) [3] => Array ( [name] => Red Devil [hex] => #860111 ) [4] => Array ( [name] => Pink [hex] => #FFC0CB ) [5] => Array ( [name] => Blue [hex] => #0000FF ) [6] => Array ( [name] => Lavender Blue [hex] => #CCCCFF ) [7] => Array ( [name] => Mint Green [hex] => #98FF98 ) [8] => Array ( [name] => Lincoln Green [hex] => #195905 ) [9] => Array ( [name] => Electric Yellow [hex] => #FFFF33 ) ) Output of the Sorted Array: Array ( [0] => Array ( [name] => White [hex] => #ffffff [rgb] => Array ( [r] => 255 [g] => 255 [b] => 255 ) [hsl] => Array ( [h] => 0 [s] => 0 [l] => 1 ) [hsv] => Array ( [h] => 0 [s] => 0 [l] => 1 ) ) [1] => Array ( [name] => Black [hex] => #000000 [rgb] => Array ( [r] => 0 [g] => 0 [b] => 0 ) [hsl] => Array ( [h] => 0 [s] => 0 [l] => 0 ) [hsv] => Array ( [h] => 0 [s] => 0 [l] => 0 ) ) [2] => Array ( [name] => Red [hex] => #ff0000 [rgb] => Array ( [r] => 255 [g] => 0 [b] => 0 ) [hsl] => Array ( [h] => 0 [s] => 1 [l] => 0.5 ) [hsv] => Array ( [h] => 0 [s] => 1 [l] => 0.5 ) ) [3] => Array ( [name] => Electric Yellow [hex] => #ffff33 [rgb] => Array ( [r] => 255 [g] => 255 [b] => 51 ) [hsl] => Array ( [h] => 60 [s] => 1 [l] => 0.6 ) [hsv] => Array ( [h] => 60 [s] => 1 [l] => 0.6 ) ) [4] => Array ( [name] => Lincoln Green [hex] => #195905 [rgb] => Array ( [r] => 25 [g] => 89 [b] => 5 ) [hsl] => Array ( [h] => 105.71429 [s] => 0.89362 [l] => 0.18431 ) [hsv] => Array ( [h] => 105.71429 [s] => 0.89362 [l] => 0.18431 ) ) [5] => Array ( [name] => Mint Green [hex] => #98ff98 [rgb] => Array ( [r] => 152 [g] => 255 [b] => 152 ) [hsl] => Array ( [h] => 120 [s] => 1 [l] => 0.79804 ) [hsv] => Array ( [h] => 120 [s] => 1 [l] => 0.79804 ) ) [6] => Array ( [name] => Lavender Blue [hex] => #ccccff [rgb] => Array ( [r] => 204 [g] => 204 [b] => 255 ) [hsl] => Array ( [h] => 240 [s] => 1 [l] => 0.9 ) [hsv] => Array ( [h] => 240 [s] => 1 [l] => 0.9 ) ) [7] => Array ( [name] => Blue [hex] => #0000ff [rgb] => Array ( [r] => 0 [g] => 0 [b] => 255 ) [hsl] => Array ( [h] => 240 [s] => 1 [l] => 0.5 ) [hsv] => Array ( [h] => 240 [s] => 1 [l] => 0.5 ) ) [8] => Array ( [name] => Red Devil [hex] => #860111 [rgb] => Array ( [r] => 134 [g] => 1 [b] => 17 ) [hsl] => Array ( [h] => 352.78195 [s] => 0.98519 [l] => 0.26471 ) [hsv] => Array ( [h] => 352.78195 [s] => 0.98519 [l] => 0.26471 ) ) [9] => Array ( [name] => Pink [hex] => #ffc0cb [rgb] => Array ( [r] => 255 [g] => 192 [b] => 203 ) [hsl] => Array ( [h] => 349.52381 [s] => 1 [l] => 0.87647 ) [hsv] => Array ( [h] => 349.52381 [s] => 1 [l] => 0.87647 ) ) ) Any help will be appreciated. Thank you.
-
My script uses get request and it suddenly stopped to work with timeout error. PHP Warning: file_get_contents(https://api.telegram.org/bot{$token}/sendMessage?chat_id=287438493&text=hoho+09%3A06%3A56&parse_mode=html&disable_notification=0): Failed to open stream: Connection timed out in /home/jeanstonic.helioho.st/src/lightbot/v2/Messenger.php on line 27 I can perform this php script from my local machine or execute query from browser. Script worked until 23d January
-
Hello, I am getting this error in my PHP script: Warning: require_once(): open_basedir restriction in effect So I want to change it for me to to /home/mrj. I think it would be best if you set it /home/{username} for all user. Thanks in advanced.
-
Hello can you please enable intl extension on php 7.3 ?
-
how to enable php errors in johnny server pls i have check many things but cant find the right soluton anyone can help me ! pls i know about error_logs but i dont want that
-
Hi I can't run php in a html file on johhny. What do I need to do?
-
Hello again, I've got a problem with PHP GD. The problem is I'm trying to draw charts (i.e.Bar) and I'm trying to draw the Bell Curve of a data or an array with "Normal Distribution", but the problem is the chart is not fitting inside the allocated image size (1920 x 1080) so the chart is exceeding the boundaries of the image. So I've just tried a library "JpGraph" it works very well but doesn't fit my requirements, so I saw that the library is using some kind of canvas to draw the chart and then merging the image with the original one and I'm trying to do the same but I couldn't understand how. Please help me out, it's very urgent, I've to finish the project within a week. public function histogram(array $samples, int $bins, string $heading = null, string $xAxisHeading = null, string $yAxisHeading = null) { if(is_array($samples)) { $data = $_bins = $this->calculateBins($samples, $bins); /* * Chart settings and create image */ // Margin between label and axis $labelMargin = 8; $count = count($samples); // Max value on y-axis $yMaxValue = max(array_column($data, 'count')); if($yMaxValue % 2 == 1) $yMaxValue++; // Distance between grid lines on y-axis $yLabelSpan = ceil($yMaxValue / $bins); $t1 = ($yLabelSpan * $bins); if($t1 > $yMaxValue) $yMaxValue = $t1; // Bar and line width $lineWidth = 1; $barWidth = 20; // Image dimensions $imageWidthActual = round(count($data) * $barWidth * ($labelMargin / 2)); $imageHeightActual = round((count($data) / 2) * $count / 2); $imageWidth = min(1920, $imageWidthActual); $imageHeight = min(1024, $imageHeightActual); // Grid dimensions and placement within image $gridTop = 40; $gridBottom = round(($imageHeight - $gridTop)); $gridLeft = 50; $gridRight = round(($imageWidth - $gridLeft)); $gridHeight = $gridBottom - $gridTop; $gridWidth = $gridRight - $gridLeft; // Bar space $barSpacing = $gridWidth / count($data); // Font settings $font = PHPML_ROOT.'assets/fonts/OpenSans-Regular.ttf'; $headingFont = PHPML_ROOT.'assets/fonts/OpenSans-Bold.ttf'; $fontSize = 10; $headingFontSize = 12; // Init image $chart = imagecreatetruecolor($imageWidth, $imageHeight); // Setup colors $backgroundColor = imagecolorallocate($chart, 255, 255, 255); $headingColor = imagecolorallocate($chart, 0, 0, 0); $axisColor = imagecolorallocate($chart, 85, 85, 85); $gridColor = imagecolorallocate($chart, 212, 212, 212); //$barColor = imagecolorallocate($chart, 47, 133, 217); $labelColor = $axisColor; imagefill($chart, 0, 0, $backgroundColor); imagesetthickness($chart, $lineWidth); /* * Print grid lines bottom up and Y-Labels */ for($i = 0; $i <= $yMaxValue; $i += $yLabelSpan) { $y = $gridBottom - $i * $gridHeight / $yMaxValue; // draw the line imageline($chart, $gridLeft, $y, $gridRight, $y, $gridColor); // draw right aligned label $labelBox = imagettfbbox($fontSize, 0, $font, strval($i)); $labelWidth = $labelBox[4] - $labelBox[0]; $labelX = $gridLeft - $labelWidth - $labelMargin; $labelY = $y + $fontSize / 2; imagettftext($chart, $fontSize, 0, $labelX, $labelY, $labelColor, $font, strval($i)); } /* * Draw x- and y-axis */ imageline($chart, $gridLeft, $gridTop, $gridLeft, $gridBottom, $axisColor); //Left //imageline($chart, $gridRight, $gridTop, $gridRight, $gridBottom, $axisColor); //Right //imageline($chart, $gridLeft, $gridTop, $gridRight, $gridTop, $axisColor); //Top imageline($chart, $gridLeft, $gridBottom, $gridRight, $gridBottom, $axisColor); //Bottom $headingBox = $this->getTextBoundingBox($chart, $headingFontSize, $headingFont, strval($heading), 0); $xAxisHeadingBox = $this->getTextBoundingBox($chart, $fontSize, $font, strval($xAxisHeading), 0); $yAxisHeadingBox = $this->getTextBoundingBox($chart, $fontSize, $font, strval($yAxisHeading), 90); if(!empty($heading)) imagettftext($chart, $headingFontSize, 0, $headingBox['x']['center'], $headingBox['y']['top'], $headingColor, $headingFont, $heading); if(!empty($xAxisHeading)) imagettftext($chart, $fontSize, 0, $xAxisHeadingBox['x']['center'], $xAxisHeadingBox['y']['bottom'], $headingColor, $font, $xAxisHeading); if(!empty($yAxisHeading)) imagettftext($chart, $fontSize, 90, $yAxisHeadingBox['x']['left'], $yAxisHeadingBox['y']['middle'], $headingColor, $font, $yAxisHeading); /* * Draw the bars with X-labels */ $itemX = $gridLeft + $barSpacing / 2; $canvasWidth = ($imageWidth * 2); $canvasHeight = ($imageHeight * 2); $canvas = imagecreatetruecolor($canvasWidth, $canvasHeight); $canvasBackgroundColor = imagecolorallocate($canvas, 255, 255, 255); $labelColor = imagecolorallocate($canvas, 85, 85, 85); $barColor = imagecolorallocate($canvas, 47, 133, 217); imagefill($canvas, 0, 0, $canvasBackgroundColor); foreach($data as $key => $bin) { // Draw the label $labelBox = imagettfbbox($fontSize, 0, $font, $key); $labelWidth = $labelBox[4] - $labelBox[0]; $labelX = $itemX - $labelWidth / 2; $labelY = $gridBottom + $labelMargin + $fontSize; imagettftext($canvas, $fontSize, 0, $labelX, $labelY, $labelColor, $font, $key); foreach($bin as $k=>$value) { // Draw the bar $x1 = $itemX - $barWidth / 2; $y1 = $gridBottom - $value / $yMaxValue * $gridHeight; $x2 = $itemX + $barWidth / 2; $y2 = $gridBottom - 1; imagefilledrectangle($canvas, $x1, $y1, $x2, $y2, $barColor); } $itemX += $barSpacing; } $resized = $this->resize($canvas, $imageWidth, $imageHeight); imagealphablending($canvas, false); imagesavealpha($canvas, true); //imagecopyresampled($chart, $canvas, 0, 0, 0, 0, $canvasWidth, $canvasHeight, $imageWidth, $imageHeight); imagecopymerge($chart, $resized, 0, 0, 0, 0, $canvasWidth, $canvasHeight, 100); //imagecopyresized($chart, $canvas, 10, 10, 0, 0, $canvasWidth, $canvasHeight, $imageWidth, $imageHeight); /* * Output image to browser */ //header('Content-Type: image/png'); ob_start(); imagepng($chart); $outBlob = ob_get_contents(); ob_end_clean(); imagedestroy($canvas); imagedestroy($chart); $outImg = "data: image/png;base64,".base64_encode($outBlob); /* * Output image to file */ //imagepng($chart, 'chart.png'); return $outImg; } return false; }
-
Php extension sodium: As of PHP 7.2.0 this extension is bundled with PHP So i can ask, how can i activate that. Im running php 7.2.30 version, but i can't use that.
-
Hi, I am using following function to get online users count. But it appears that there is no permission for reading content of that dir. Can you help me please? Server: tommy function onlineUsers() { $i = 0; $path = session_save_path(); if (trim($path)=="") { return FALSE; } $d = dir($path); while (false !== ($entry = $d->read())) { if ($entry!="." and $entry!="..") { if (time()- filemtime($path."/$entry") < 1 * 60) { $i++; } } } $d->close(); return $i; }
-
Hi, I just transferred my local files to the server. But it seems my sessions are not working. But all of them work fine in the localhost. So, I'm sure the code works fine. But only problem is that those working sessions are not working in the server. Event the header('location: ../index.php'); didn't work please help me. Thanks.
-
Hi, is it possible to add PHP 7.4 to Tommy? Thanks
-
Hi, there. I'd like to know if it's possible to use a chat system here (PHP, JS, Websocket). I have a chat system made in php and integrated with a socket by using JS, and in localhost, everytime I want to use it, I have to start the server first using the command below in terminal: php.exe websocket_server.php Is there any way of doing this here? If so, what are the procedures? How do I do this here? Thank you!
-
Hi guys, I want to setup a typo3 webpage on my account. When using softaculous Apps installer to install typo3 it shows an error: Required PHP extension not found : soap Could you please enable the php soap extension on tommy? My username is frischid. Thank you very much. Edit: I'm currently running php7.2
-
I am getting a "Fatal error: Class 'PDO' not found" where I was not previously. I had recently moved some code around, but after restoring it I'm still getting this error. Is there some trick to pointing to the extension properly. The line causing the fault is: $dbh = new PDO('sqlite:'.$db_name); The php.ini in my root folder has extension = sqlite3.soextension = pdo_sqlite.so phpinfo has PDO drivers mysql, pgsql, sqlite
-
Hello everyone! PHP sessions don't seem to be working. After a few searches, I checked /tmp disk usage and still have plenty of space. I wrote a class, which I use in other projects and I am 99% sure is working. Also checked the logs but there is no error related to sessions. What could be causing this? Thanks in advance! Julio.
-
Hi, could you install Imagick extension on PHP 7.3 on Tommy? Thanks
-
Hello. I am on the Johnny server for my site, and i am trying to install MediaWiki. However, it says this. The following errors were found : Required PHP extension not found: iconvI looked it up, and iconv is supposed to be enabled by default, so I don't know why its disabled or not there. Requesting it to have it be put back. EDIT: Fixed it, i changed to a newer version of PHP (i was on 7.2) and now it installed correctly. Lock this thread or something, or delete it.