I have created a Youtube to mp3 script with PHP. I would like to add the ability to add metadata of the title, artists, album, etc. I have created a test PHP script, using the id3_set_tag() function to add metadata to an MP3 but when I load the page it is blank and the file remains untouched.
<?php
$data = array(
"title" => "Re:Start",
"artist" => "Re:\Legion",
"comment" => "A nice track"
);
$result = id3_set_tag( "Test.mp3", $data, ID3_V1_0 );
if ($result === true) {
echo "Tag successfully updated
";
}
?>
Here are the Apache/PHP logs:
[Mon Jun 11 17:54:39.197984 2018] [php7:error] [pid 1458] [client 127.0.0.1:51864] PHP Fatal error: Uncaught Error: Call to undefined function id3_set_tag() in /Library/WebServer/Documents/index.php:7 Stack trace: #0 {main} thrown in /Library/WebServer/Documents/index.php on line 7
Specs: Apache
PHP 7
macOS High Sierra
So my question is: How do I add song metadata to a MP3 file with PHP on Mac?