Category: Uncategorized

  • Change PHP version for a site in Plesk Command line

    Change PHP version for a site in Plesk Command line

    To change PHP version for a site, first find available PHP handlers, this can be done with command

    /usr/local/psa/admin/bin/php_handlers_control --list
    

    Plesk Change PHP version

    You need to find the id for the PHP handler. For PHP 5.6 fpm, it is “plesk-php56-fpm”.

    To change a sites PHP version to PHP 5.6, run

    plesk bin domain -u DOMAIN_NAME_HERE -php_handler_id plesk-php56-fpm
    

    Example

    Plesk change PHP handler

  • error: ‘x264_bit_depth’ undeclared (first use in this function)

    When installing ffmpeg, i get error

    CC	libavcodec/libvorbisenc.o
    CC	libavcodec/libx264.o
    libavcodec/libx264.c: In function ‘X264_frame’:
    libavcodec/libx264.c:282:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
         if (x264_bit_depth > 8)
             ^
    libavcodec/libx264.c:282:9: note: each undeclared identifier is reported only once for each function it appears in
    libavcodec/libx264.c: In function ‘X264_init_static’:
    libavcodec/libx264.c:892:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
         if (x264_bit_depth == 8)
             ^
    make: *** [libavcodec/libx264.o] Error 1
    

    This is due to incompatability with ffmpeg and x264.

    What you can do is try another version of x264. You will be able to download older version of x264 from

    ftp://ftp.videolan.org/pub/x264/snapshots

    On 2018-08-14, it failed with latest stable snapshot. So i tried 14 days old stable snapshot

    cd /usr/local/src/
    wget ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20180730-2245-stable.tar.bz2
    tar xvf x264-snapshot-20180730-2245-stable.tar.bz2
    cd /usr/local/src/x264-snapshot-20180730-2245-stable
    make clean && make distclean
    ./configure --prefix=/usr --enable-shared
    make && make install
    ldconfig
    

    This worked with ffmpeg.

    Solution here is to try latet version first, if it did not work, try older version, say try 1 month old version, if that did not work, go back 2 months, see if that works.

    Now install ffmpeg with

    cd /usr/local/src/
    wget https://github.com/FFmpeg/FFmpeg/archive/n3.3.5.tar.gz
    tar zxf n3.3.5.tar.gz
    cd /usr/local/src/FFmpeg-n3.3.5/
    ldconfig
    make clean && make distclean
    ./configure --prefix=/usr --enable-shared --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-gpl --enable-libfdk-aac --enable-nonfree --enable-libx264 --enable-libfreetype
    make && make install && ldconfig
    
  • Enable Zend OPcache in PHP

    Enable Zend OPcache in PHP

    To enable Zend OPCache in PHP, edit php.ini add following to end of the file

    zend_extension=opcache.so
    

    Now you may need to adjust some settings, in php.ini uncomment following, change values as needed.

    opcache.enable=1
    opcache.enable_cli=1
    opcache.memory_consumption=128
    opcache.max_accelerated_files=10000
    opcache.validate_timestamps=1
    opcache.revalidate_freq=10
    

    Verify it with

    [root@vps154294 php]# php -m | grep  Zend
    Zend OPcache
    [Zend Modules]
    Zend OPcache
    [root@vps154294 php]# 
    

    Restart web server. If you using php-fpm or fcgi, you need to restart the process.

    phpinfo() will show

    Zend OPcache in phpinfo

  • Install Redis PHP Module from source

    To install Redis PHP module from source, run

    cd /usr/local/src
    git clone https://github.com/phpredis/phpredis.git
    cd /usr/local/src/phpredis
    /usr/serverok/php-7.1.12/bin/phpize
    ./configure --with-php-config=/usr/serverok/php-7.1.12/bin/php-config
    make && make install
    

    Once installed, edit your php.ini file, add following below extension_dir line

    extension=redis.so
    

    Verify redis is installed with php -m

    [root@vps154294 ~]# /usr/serverok/php-7.1.12/bin/php -m | grep redis
    redis
    [root@vps154294 ~]# 
    

    Now restart web server

    service httpd restart
    

    phpinfo() will show following

    phpinfo redis

  • Reset osticket admin password

    Reset password for admin, can be used for any user, replace admin with username.

    UPDATE `ost_staff` SET `passwd` = MD5( 'newpassword' ) WHERE `username` = 'admin';
    

    See osticket