Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Running multiple Puphpeteer instance in parallel #129

Answered by nesk
tugrulcan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I'm not sure what you are trying to do, for me you want two instaciate the Nesk\Puphpeteer\Puppeteer class multiple times? This is perfectly possible and it works out of the box, check out this script:

<?php

require_once 'vendor/autoload.php';

// First instance
$pu1 = new \Nesk\Puphpeteer\Puppeteer;
$br1 = $pu1->launch(['headless' => false]);

// Second instance
$pu2 = new \Nesk\Puphpeteer\Puppeteer;
$br2 = $pu2->launch(['headless' => false]);

echo shell_exec('ps | grep node');

sleep(10);

Try it, you should see the following output:

36819 ttys005    0:00.15 node /absolute/path/to/puphpeteer/node_modules/@nesk/rialto/src/node-process/serve.js /absolute/path/to/puphpeteer/src/Puppet…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by nesk
Comment options

You must be logged in to vote
1 reply
@nesk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #125 on February 11, 2021 12:09.