The Wayback Machine - https://web.archive.org/web/20210622064735/https://github.com/oscarotero/Embed/issues/330
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed project not working #330

Open
wdevlop opened this issue Nov 13, 2019 · 5 comments
Open

embed project not working #330

wdevlop opened this issue Nov 13, 2019 · 5 comments

Comments

@wdevlop
Copy link

@wdevlop wdevlop commented Nov 13, 2019

I created a folder name it embedcode in that folder I installed the embed/embed

Nixas-MacBook-Pro-3:embedcode Yanick$ composer require embed/embed
Using version ^3.4 for embed/embed
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing composer/ca-bundle (1.2.4): Loading from cache
  - Installing embed/embed (v3.4.2): Loading from cache
Writing lock file
Generating autoload files
Nixas-MacBook-Pro-3:embedcode Yanick$


I created a file embedcode/test.php and add the code

<?php

use Embed\Embed;

//Load any url:
$info = Embed::create('https://www.youtube.com/watch?v=PP1xn5wHtxE');

var_dump($info->code);

?>

But I get 500 Internal Server Error

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

@oscarotero
Copy link
Owner

@oscarotero oscarotero commented Nov 13, 2019

Could you provide more info of why this 500 status? Try to execute the code in a try/catch in order to get the exception message.

@wdevlop
Copy link
Author

@wdevlop wdevlop commented Nov 13, 2019

Could you provide more info of why this 500 status? Try to execute the code in a try/catch in order to get the exception message.

It's return only blankpage and in network tab it show

This page isn’t workinglocalhost is currently unable to handle this request.
HTTP ERROR 500

Status Code : 500 Internal Server Error
HTTP/1.0 500 Internal Server Error

@RichardDern
Copy link

@RichardDern RichardDern commented Apr 2, 2020

I just installed the lib using:

composer require embed/embed

Got a 500 error, here is why:

Cannot instantiate abstract class Embed\Embed

Turns out, composer added Embed's 3.4 instead of 4.0 because I run PHP 7.3 instead of 7.4 (which is a requirement for Embed 4).

I guess it could be the same kind of problem you had.

@oscarotero
Copy link
Owner

@oscarotero oscarotero commented Apr 2, 2020

For v3, the docs are different: https://github.com/oscarotero/Embed/tree/v3.x

@RichardDern
Copy link

@RichardDern RichardDern commented Apr 2, 2020

I know, but I forgot I ran php 7.3, so I didn't notice embed 3.4 was installed, hence the instantiation error. Forcing 3.4 version in composer (and, of course, adapting the code) worked.

That said, upgrading to php 7.4 and embed to 4.0 lead me to another issue, a syntax error in Embed.php:

private Crawler $crawler;

I have absolutely no idea what happens here. Syntax is correct for php 7.4, I can confirm php 7.4 ran the code, but it still awaits for something else than the Crawler type. It's almost certainly not embed's fault, but I need time to check further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants