Class DOMDocument not found

Hi,

I try to use my Yun as a web server.

I have the latest image and I have php5 installed.

I can host and access php-files from the www-folder, and everything seems to work, BUT:

When I try to load a webpage into a DOMDocument, I get a "Class 'DOMDocument' not found", from this place in the code, more specifically the second line:

$doc = new DOMDocument();
@$doc->load($html);

Everything works on my usual web server, so I recon the problem lies with the Yun? Anybody have an idea?

php5-mod-dom - 5.4.5-3 - DOM shared module

opkg update
opkg  install php5-mod-dom

That seems so easy. Thanks!

I did not realize I had to install dom by itself.

I will try it out when I get home and report if it solved the problem.

Everything works :slight_smile: Thanks again.

Edit:

What is the advantage of using the bridge library from the forum, instead of rest calls with e.g. cURL?

Does anyone know if there will be a step by step installation guide for the bridge library available?

SomethingClever:
...
Edit:

What is the advantage of using the bridge library from the forum, instead of rest calls with e.g. cURL?

Does anyone know if there will be a step by step installation guide for the bridge library available?

Should be 2 new threads.

SomethingClever:
Everything works :slight_smile: Thanks again.

Edit:

What is the advantage of using the bridge library from the forum, instead of rest calls with e.g. cURL?

Does anyone know if there will be a step by step installation guide for the bridge library available?

Upgrade the Yun system to latest version, it includes the php bridgeclient.

Then take a look at this example for using it YunBridge/bridge/php/example.php at master · arduino/YunBridge · GitHub

@sonnyyu

Okay - I will create new threads next time.

@Angelo9999

I have the latest installation (I think - how to check that?), but I am confused about "how to activate it", like when I activated the php on the linux side.

To check the version connect to your yun via ssh and run

cat /etc/arduino/openwrt-yun-release

and then compare the date with the changelog on github openwrt-yun/ChangeLog at master · arduino/openwrt-yun · GitHub.

To check if you have the php bridgeclient run

ls /usr/lib/php/bridge/

To use the php bridgeclient you have to install php5, php5-mod-sockets, php5-mod-json and php5-cgi (or php5-cli). Then you can write your php page that include the bridgeclient class.

Thank you :slight_smile:

I will look into it later. All I really need is to communicate TO the Arduino side. It never needs to send anything back, so don't know if there is an easier way.

So I got everything installed, but it is not working. Do I have to uncomment something again, like when installing php? If so, how exactly?

Sorry for being so noobish but I have almost zero experience with linux and php. So maybe this project is a little much :slight_smile:

What do you mean for "uncomment something again"? What is not working?

Warning: require(bridgeclient.class.php): failed to open stream: No such file or directory in /mnt/sda1/arduino/www/myproject/testfile.php on line 2

Fatal error: require(): Failed opening required 'bridgeclient.class.php' (include_path='.:') in /mnt/sda1/arduino/www/myproject/testfile.php on line 2

Seems like you have to specify the Include path. Probably it does not know where to search the file.