Go Back   CodingForums.com > :: Server side development > PHP > Post a PHP snippet

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-21-2011, 12:08 AM   PM User | #46
Pwnubis
New to the CF scene

 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Pwnubis is an unknown quantity at this point
any updates on this?
Pwnubis is offline   Reply With Quote
Old 06-21-2011, 06:40 PM   PM User | #47
Vicar
New to the CF scene

 
Join Date: May 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Vicar is an unknown quantity at this point
The reason is the version of PHP. XAMPP use PHP5 while my server use PHP4

No?
Vicar is offline   Reply With Quote
Old 06-25-2011, 07:34 PM   PM User | #48
Rapso
New to the CF scene

 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rapso is an unknown quantity at this point
Quote:
Originally Posted by Vicar View Post
The reason is the version of PHP. XAMPP use PHP5 while my server use PHP4

No?
It's possible that the server you are using is Linux, ffmpeg.exe only works on Windows
Rapso is offline   Reply With Quote
Old 06-27-2011, 09:40 AM   PM User | #49
Vicar
New to the CF scene

 
Join Date: May 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Vicar is an unknown quantity at this point
And there is nothing for linux?
Vicar is offline   Reply With Quote
Old 06-27-2011, 01:54 PM   PM User | #50
kbluhm
Senior Coder

 
kbluhm's Avatar
 
Join Date: Apr 2007
Location: Philadelphia, PA, USA
Posts: 1,502
Thanks: 2
Thanked 258 Times in 254 Posts
kbluhm will become famous soon enough
http://www.lmgtfy.com/?q=ffmpeg+php+linux+install
__________________
ZCE
kbluhm is offline   Reply With Quote
Old 07-21-2011, 07:45 PM   PM User | #51
expertmac
New Coder

 
Join Date: Mar 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
expertmac is an unknown quantity at this point
hello,

i am using this script & its working fine till yesteday..but today i got error Error generating MP3 file

I got this error after 2 month so please tell me you also got this error or this is my server problem?
expertmac is offline   Reply With Quote
Old 07-21-2011, 08:15 PM   PM User | #52
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
I just converted a YouTube video successfully, so it's working for me.

What is the URL of the video you are trying to convert?
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 07-22-2011, 08:07 AM   PM User | #53
expertmac
New Coder

 
Join Date: Mar 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
expertmac is an unknown quantity at this point
I trying with many videos but i got same error.i can't convert single video

http://www.youtube.com/watch?v=6g6g2mvItp4
this url i trying

UPDATE:

I can convert only one Video here this URL: http://www.youtube.com/watch?v=abRmvlSKknc

but other videos cant convert so what a problem?

Last edited by expertmac; 07-22-2011 at 08:26 AM..
expertmac is offline   Reply With Quote
Old 07-22-2011, 09:15 AM   PM User | #54
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by expertmac View Post
I trying with many videos but i got same error.i can't convert single video

http://www.youtube.com/watch?v=6g6g2mvItp4
this url i trying
I was able to convert the video at that URL (the Maroon 5 song)...

So if the code is working for me, and I was able to convert a video that you are not able to convert, then I can only assume the problem is with your server setup...

If it was working for you before, then your server setup must have changed recently. I would:

1) Turn error handling on in the code (comment out ini_set('display_errors',0)
2) Check your server error logs
3) Make sure FFmpeg is functional within your server setup
4) Download a fresh copy of FFmpeg
5) Make sure that you can execute commands on the server with PHP's exec()

Also I saw a comment somewhere else in this thread about which PHP version can run this code. Since my code uses PHP 5 OOP, it should be run on PHP 5 or higher.

Good luck!
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 07-22-2011, 09:16 PM   PM User | #55
expertmac
New Coder

 
Join Date: Mar 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
expertmac is an unknown quantity at this point
i found error in error log:
[22-Jul-2011 16:07:22] PHP Fatal error: Maximum execution time of 1 second exceeded in /home/user/public_html/YouTubeToMp3Converter.class.php on line 78

waiting for your reply
expertmac is offline   Reply With Quote
Old 07-22-2011, 09:36 PM   PM User | #56
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
http://www.php.net/manual/en/info.co...execution-time

Try adjusting this value:

ini_set('max_execution_time',0);

in my index.php....Or just comment that line out....I honestly can't remember why I set that to '0'...It might be some left over code that I never removed, and possibly an error on my part?

Hope it helps.

Quote:
Originally Posted by chump2877 View Post
I honestly can't remember why I set that to '0'...
This must be the reason why: http://www.php.net/manual/en/functio...time-limit.php

From that URL:

Quote:
The maximum execution time, in seconds. If set to zero, no time limit is imposed.
Whether or not the following 2 lines of code are equivalent in terms of what they accomplish, I'm not sure:

PHP Code:
set_time_limit(0);  // or

ini_set('max_execution_time',0); 
So you might also try replacing the existing ini_set() call with a set_time_limit() call, as illustrated above.

This seems to corroborate that the following lines of code do in fact do the same thing:

PHP Code:
set_time_limit(0);  // or 

ini_set('max_execution_time',0); 
...even though this is not made abundantly clear in the PHP manual (at least per my understanding of it)...

Also, you could try adding either of those lines of code to the top of YouTubeToMp3Converter.class.php, since that is where the error occurred for you...
__________________
Regards, R.J.

Last edited by Inigoesdr; 07-22-2011 at 10:08 PM..
chump2877 is offline   Reply With Quote
Old 07-23-2011, 09:48 AM   PM User | #57
expertmac
New Coder

 
Join Date: Mar 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
expertmac is an unknown quantity at this point
it's converting now but one more error found.
when i start ripping i got error Error downloading video!

can't download many videos but same videos can download & convert succesfully.
So why i geting Error downloading video! even videos are playing fine on youtube.
expertmac is offline   Reply With Quote
Old 07-23-2011, 12:55 PM   PM User | #58
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
How experienced are you with PHP? With some knowledge of PHP programming, this shouldn't be that hard to troubleshoot...

The error you are receiving is due to the DownloadVideo() method failing:

PHP Code:
        function DownloadVideo($youTubeUrl
        { 
            
$file_contents file_get_contents($youTubeUrl); 
            if (
$file_contents !== false
            { 
                
$this->SetSongFileName($file_contents); 
                
$this->SetFlvUrl($file_contents); 
                if (
$this->GetSongFileName() != '' && $this->GetFlvUrl() != ''
                { 
                    return 
$this->SaveVideo($this->GetFlvUrl()); 
                } 
            } 
            return 
false
        } 
Whch means any of the following could be an issue here:

1) You have entered an invalid YouTube URL into the application
2) The regex used to obtain the FLV file name is not working
3) The regex used to extract the song name is not working

But before you start investigating those possibilities, you should do as I said earlier for your previous problem:

1) Turn error handling on in the code (comment out ini_set('display_errors',0)
2) Check your server error logs
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 07-23-2011, 02:13 PM   PM User | #59
expertmac
New Coder

 
Join Date: Mar 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
expertmac is an unknown quantity at this point
hey i just try this script on my another server & there working fine.
that means problem in my server,so can you give me server requirement then i can check,whats problem in server.
expertmac is offline   Reply With Quote
Old 07-23-2011, 02:59 PM   PM User | #60
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
compare the php.ini of one server to the other...You could also download XAMPP and check the default PHP configuration there...I run the app inside XAMPP successfully
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Users who have thanked chump2877 for this post:
expertmac (07-26-2011)
Reply

Bookmarks

Tags
audio, class, conversion, dailymotion, ffmpeg, mp3, php, script, video, youtube

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:20 PM.


Advertisement
Log in to turn off these ads.