Apache + PHP + NodeJS + Puppeteer

Job ID: 35987701

Budget: $30 – $250 USD

PLEASE, IF YOU ARE NOT REALLY A LINUX ADMINISTRATOR, DON'T WASTE MY TIME.
PROBABLY YOU WILL SEARCH ON GOOGLE AND EVERYTHING THAT IS ON GOOGLE I ALREADY DID AND IT DIDN'T WORK, I'VE BEEN TRYING TO SOLVE THIS PROBLEM FOR 72 HOURS AND I CAN'T.
IF YOU REALLY DON'T HAVE EXPERIENCE, DON'T TAKE THE JOB.

Hello!

I'm having some problems getting Puppeteer to work.
I had already saved all the installation commands and just ran it and everything worked fine.
But due to some change/update of the libraries, it doesn't work anymore.

This steps:

apt-get update
apt-get install nano apache2 zip unzip -y
apt-get install php libapache2-mod-php -y
apt-get install php-curl php-zip php-cli php-json nodejs -y

/etc/init.d/apache2 restart

Ok, at this step, we installed apache + php + nodejs.
All works fine!
So, I really need the puppeteer plugin working on /var/www/html, and I need that when the file is opened on the web, it shows the output.

Now, we install rest of plugins:


cd /var/www/html
chmod -R 777 *
apt install nodejs npm -y ;npm install utf8 striptags figlet chalk request cheerio puppeteer fs os figlet ;sudo apt-get install -y libgbm-dev libxtst6 libnss3 libnspr4 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgdk-pixbuf2.0-0

And create test.php:
<?php system("node test.js"); ?>

And create test.js:
'use strict';
const puppeteer = require('puppeteer');
const fs = require('fs');
(async () => {
console.info("Starting browser");
let browser;
try {
browser = await puppeteer.launch({});
} catch (e) {
console.info("Unable to launch browser mode in sandbox mode. Lauching Chrome without sandbox.");
browser = await puppeteer.launch({args:['--no-sandbox']});
}
console.info("Browser successfully started");
console.info("Closing browser");
await browser.close();
console.info("Done");
})();

So, if you run on terminal: php -e test.php
It works fine! Shows output, everything ok!

BUT, if you access on web: https://ip-server/test.php
Dont works, dont show output, THIS IS MY PROBLEM.

I just need you to give me a ready-made configuration script to get this all working.

I will grant you a clean server ubuntu 22.04 or whatever version you want with root access.
Related categories: PHP System Admin Linux Apache Nginx