Laravel/artisan can not find "node" in puphpeteer package - php

I'm working on using puphpeteer, which is a PHP wrapper for the original puppeteer functionality, to do some automated downloads from a website. I've followed the instructions as they were written in the documentation and tried to create an object:
public function getReport(){
$puppeteer = new Puppeteer;
}
Simply instantiating the object above produces the following error:
Exit Code: 1(General error) Working directory: C:\Users\username\Projects\projectfolder\public
Output: ================ Error Output: ================
node' is not recognized as an internal or external command, operable program or batch file
I did find that the object is just failing to be instantiated in the __constructor(). I can follow the stack trace of the code but none of it is helping me understand what is going wrong, which is that Laravel/artisan do not see node as a valid command.
General notes:
PHP 7.3.9
Laravel 7.1.3
Composer 1.9.0
node v12.16.1
node is in my path as the first variable
using Windows 10
How do I get Laravel/artisan to recognize that I have a node installation for this package?

Do you know the location of node on your system? Try placing it here:
$puppeteer = new Puppeteer([
'executable_path' => "PATH_TO_NODE_HERE"
]);

I am facing the same problem with Laravel/Artisan.
'node' is not recognized as an internal or external command, operable program or batch file
after adding
$puppeteer = new Puppeteer([
'executable_path' => "PATH_TO_NODE_HERE"
]);
Puppeteer generate socket error so I move my project to wamp instead of Laravel/Artisan.
all working fine with out adding 'executable_path' on wamp. better to move your project to Wamp or Xampp server. you can read nesk comment here
https://github.com/rialto-php/puphpeteer/issues/35

Related

VS Code can not reach Symfony\Component and Symfony\Bundle

I am trying to create a simple symfony project.
I run this on console:
composer create-project symfony/skeleton myProjectName
php -S 127.0.0.1:8000 -t myProjectName/public
Project succesfully run at localhost:8000. However, when I begin to inspect the code, I realized VS Code editor is indicating "Undefined type" error in projectDirectory/src/Kernel.php file. Do you have any ideas why this happens and any suggestions towards solution?
I use PHP v7.4.32 and Symfony 5.4 for development. My helper extentions are PHP Intelephense v1.8.2 and PHP IntelliSense v1.0.11.
projectDirectory/src/Kernel.php
The Error
Since it runs succesfully on browser, I dubted that the classes exist somewhere but the VSCode could not solve the relative paths. Then, I tried a couple of extensions. Installation of PHP v1.22.11089 created by DEVSENSE and PHP Namespace Resolver v1.1.9 created by Mehedi Hassan has solved the problem.

Symfony messenger can't consume messages

Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.

Why can't PHP find a libpng15.so.15?

I'm running ArchLinux 64bit, I'm trying to create a Clickstack to run Symfony on Cloudbees.
I've created a Clickstack that extends PHP-ClickStack
When trying to test the bundled PHP I get the following error:
php: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
I've downloaded and installed LibPng15 to /usr/local/.
I've also copied that file to: /path/to/php/lib/, /path/to/php/include/, and /path/to/php/bin/. It hasn't fixed the error.
I've also downloaded tried downloading the source for PHP-5.4.24 and 5.5.8 but, when I compile them they both some of the Intl tests.
So how can I get a working binary version of PHP that I can upload to Cloudbees?
The solution was to create LD_LIBRARY_PATH as an environment variable in script.
Apparently it didn't exist.
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib/:/path/to/libpng/
NOTE: adding the normal directories prevents other tools/apps from breaking.

SoapClient: faultcode WSDL

When I try to use SoapClient:
try {
$client = new SoapClient('http://someurl/somefile.wsdl');
} catch (SoapFault $e) {
var_dump($e);
}
I have catch error with:
["faultstring"] => "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://someurl/somefile.wsdl' : failed to load external entity "http://someurl/somefile.wsdl"
["faultcode"] => "WSDL"
I can manually download http://someurl/somefile.wsdl and can file_get_contents for this file. I try to use it before on different computer and it worked. Possible problem with php or apache settings..
ArchLinux with last updates for php and apache. I tried to enable all php extensions.
Were you able to get wsdl using file_get_contents() in browser?
I had similar issue recently in Archlinux with same faultstring, no matter what wsdl file was used. The same code was working without any problem on other Archlinux machine and Windows XP box.
After some research, it came out that problem arose only when I tried to access the page in browser - script accessed from command line worked as expected. Then I changed the script to download the wsdl file directly, using aforementioned file_get_contents() - it gave me a warning "php_network_getaddresses: getaddrinfo failed: Name or service not known".
Few tutorials (on SO, or this one: http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/ ) later I haven't fought off the problem yet. But then I discovered what introduced the issues: I had been running NetworkManager since the installation of Arch (to better handle wireless), and few weeks later I've added mysqld and httpd as last to DAEMONS section in rc.conf - it seems this broke DNS resolution for apache.
Having two solutions (go back to starting servers manually or try other network manager) I've switched to wicd and haven't run into the issue again.

Trouble using sandbox of symfony

I'm new to symfony and I am trying to run a simple command on the command line but I get an error message.
When I try to execute the command:
d:\new_xam\xampp\htdocs\sf_sandbox_1_2\sf_sandbox>symfony propel:build-model "
I get the error:
'php.exe' is not recognized as an
internal or external command,operable
program or batch file.
Can anybody help me?
This is a fairly common issue on Windows systems for people new to Symfony and/or PHP. It seems to be an issue with the PHP path. See here: http://forum.symfony-project.org/index.php/m/44895/?srch=php.exe+command#msg_44895
Can you try to use the real path for PHP?
i.e.,
"C:\Program Files\PHP\PHP.exe" symfony propel:build-model
At your Symfony directory.
You should be able to prefix everything with "php".
So instead of symfony propel:build-model you can do php symfony propel:build-model.

Categories