title: FFMpeg with PHP-7.0 on Ubuntu
body: <p>I have a NGINX server with PHP-7.0 and I would like to install the ffmpeg-php extension. I've been trying for a few days now and in many ways.</p>
  
  <p>The method that worked so far was compiling ffmpeg (<a href="https://ffmpeg.org/releases/ffmpeg-4.0.2.tar.bz2" rel="nofollow noreferrer">https://ffmpeg.org/releases/ffmpeg-4.0.2.tar.bz2</a>) manually, but when trying to compile ffmpeg-php (https: // sourceforge. net / projects / ffmpeg-php / files / ffmpeg-php / 0.6.0 / ffmpeg-php-0.6.0.tbz2 / download) I am encountering the following error message:</p>
  
  <blockquote>
    <p>root@zumbiserver-mercury:~/php7-ffmpeg# make /bin/bash</p>
    
    <p>/root/php7-ffmpeg/libtool --mode=compile cc  -I. -I/root/php7-ffmpeg
    -DPHP_ATOM_INC -I/root/php7-ffmpeg/include -I/root/php7-ffmpeg/main -I/root/php7-ffmpeg -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/  -DHAVE_CONFIG_H  -g -O2 -Wall -fno-strict-aliasing   -c /root/php7-ffmpeg/ffmpeg-php.c -o ffmpeg-php.lo libtool: compile:  cc
    -I. -I/root/php7-ffmpeg -DPHP_ATOM_INC -I/root/php7-ffmpeg/include -I/root/php7-ffmpeg/main -I/root/php7-ffmpeg -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /root/php7-ffmpeg/ffmpeg-php.c  -fPIC -DPIC -o .libs/ffmpeg-php.o In
    file included from /usr/include/x86_64-linux-gnu/sys/stat.h:104:0,
                     from /usr/include/php/20151012/Zend/zend_stream.h:28,
                     from /usr/include/php/20151012/Zend/zend.h:41,
                     from /usr/include/php/20151012/main/php.h:36,
                     from /root/php7-ffmpeg/ffmpeg-php.c:40: /usr/include/x86_64-linux-gnu/bits/stat.h:91:21: error: field
    ‘st_atim’ has incomplete type
         struct timespec st_atim;  /* Time of last access.  <em>/
                         ^ /usr/include/x86_64-linux-gnu/bits/stat.h:92:21: error: field
    ‘st_mtim’ has incomplete type
         struct timespec st_mtim;  /</em> Time of last modification.  <em>/
                         ^ /usr/include/x86_64-linux-gnu/bits/stat.h:93:21: error: field
    ‘st_ctim’ has incomplete type
         struct timespec st_ctim;  /</em> Time of last status change.  <em>/
                         ^ /usr/include/x86_64-linux-gnu/bits/stat.h:152:21: error: field
    ‘st_atim’ has incomplete type
         struct timespec st_atim;  /</em> Time of last access.  <em>/
                         ^ /usr/include/x86_64-linux-gnu/bits/stat.h:153:21: error: field
    ‘st_mtim’ has incomplete type
         struct timespec st_mtim;  /</em> Time of last modification.  <em>/
                         ^ /usr/include/x86_64-linux-gnu/bits/stat.h:154:21: error: field
    ‘st_ctim’ has incomplete type
         struct timespec st_ctim;  /</em> Time of last status change.  <em>/
                         ^ In file included from /usr/include/php/20151012/Zend/zend_stream.h:28:0,
                     from /usr/include/php/20151012/Zend/zend.h:41,
                     from /usr/include/php/20151012/main/php.h:36,
                     from /root/php7-ffmpeg/ffmpeg-php.c:40: /usr/include/x86_64-linux-gnu/sys/stat.h:364:31: error: array type has
    incomplete element type ‘struct timespec’
             const struct timespec __times[2],
                                   ^ /usr/include/x86_64-linux-gnu/sys/stat.h:371:54: error: array type has
    incomplete element type ‘struct timespec’  extern int futimens (int
    __fd, const struct timespec __times[2]) __THROW;
                                                          ^ In file included from /usr/include/php/20151012/main/php.h:395:0,
                     from /root/php7-ffmpeg/ffmpeg-php.c:40: /usr/include/php/20151012/Zend/zend_virtual_cwd.h:218:2: error:
    unknown type name ‘time_t’   time_t                         expires;<br>
    ^ /usr/include/php/20151012/Zend/zend_virtual_cwd.h:248:86: error:
    unknown type name ‘time_t’  CWD_API realpath_cache_bucket</em>
    realpath_cache_lookup(const char *path, int path_len, time_t t);
                                                                                          ^ /root/php7-ffmpeg/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
    /root/php7-ffmpeg/ffmpeg-php.c:108:5: warning: implicit declaration of
    function ‘avcodec_init’ [-Wimplicit-function-declaration]
         avcodec_init();
         ^ /root/php7-ffmpeg/ffmpeg-php.c:111:5: warning: ‘av_register_all’ is deprecated [-Wdeprecated-declarations]
         av_register_all();
         ^ In file included from /root/php7-ffmpeg/ffmpeg-php.c:43:0: /usr/local/include/libavformat/avformat.h:2025:6: note: declared here 
    void av_register_all(void);</p>
  
  <pre><code>  ^ Makefile:194: recipe for target 'ffmpeg-php.lo' failed make: *** [ffmpeg-php.lo] Error 1
  </code></pre>
  </blockquote>
  
  <p>Can someone give me a light? I do not know what else to do!</p>