Category : node.js

I am looking to build a docker image for laravel. FROM php:7.4-fpm as dev RUN docker-php-ext-install -j$(nproc) pdo_mysql # Composer install FROM composer:latest as vendor WORKDIR /app COPY composer.json composer.json COPY composer.lock composer.lock RUN composer install –ignore-platform-reqs –no-interaction –no-plugins –no-scripts –prefer-dist # npm Build FROM node:12-alpine as node WORKDIR /app COPY package*.* ./ COPY resources/ ..

Read more

I have a web application that interacts with API. In html file is an element with onclick property for this function: function executePHP() { $.ajax({ type: "POST", url: ‘index2.php’, }); } Then index2.php has written only this code: <?php exec("/usr/local/bin/node script.js"); ?> The script.js is just a file which is executed. Everything works fine on ..

Read more

Can anyone help me convert the following PHP code to Nodejs. public function encrypt($arr) { $data = json_encode($arr); $arrEncrypted = array(); $arrData = str_split($data, 64); foreach ($arrData as $subData) { $subEncrypted = null; openssl_public_encrypt($subData, $subEncrypted, $this->server_public_key); $arrEncrypted[] = $subEncrypted; } $result = implode(”, $arrEncrypted); return $result; } Sourc..

Read more

I am trying to get PHP to run a node.js test script on Ubuntu sudo chmod 755 $(which node) sudo -r chmod 755 /home/test.js In php I try and run: $io=array( 1=>array(‘pipe’,’w’),//stdout 2=>array(‘pipe’,’w’)//stderr ); $process=proc_open(‘/usr/local/bin/node /home/test.js 1 2 3’,$io,$pipes); var_dump(stream_get_contents($pipes[1])); var_dump(stream_get_contents($pipes[2])); proc_close($process); but I get the error: string(0) "" string(43) "sh: /usr/local/bin/node: Permission denied" What ..

Read more