Changing Primary Domain Document Root in Cpanel

Standard
  1. Login to ssh.
  2. sudo and edit this file:
    /var/cpanel/userdata/user/domain

    If you have SSL:

    /var/cpanel/userdata/user/domain_SSL

    user is your cpanel username and domain is your domain, _SSL capital leter.

  3. Change these 2 line to your new document root:
    documentroot: /home/USER/public_html

    and

    path: /home/USER/public_html/cgi-bin
  4. Run sudo:
    sudo /scripts/rebuildhttpdconf
    sudo service httpd restart
  5. Done.

[Solved] Composer SSL Certificate Failed

Standard

got this error when running composer on Windows with PHP 5.6

 [Composer\Downloader\TransportException]
 The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
 error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
 Failed to enable crypto
 failed to open stream: operation failed

Run this in console:

php -r "print_r(openssl_get_cert_locations());"

Mine got something like this:

Array
(
    [default_cert_file] => f:\repo\winlibs_openssl_vc11_x86/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => f:\repo\winlibs_openssl_vc11_x86/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => f:\repo\winlibs_openssl_vc11_x86/private
    [default_default_cert_area] => f:\repo\winlibs_openssl_vc11_x86
    [ini_cafile] =>
    [ini_capath] =>
)

but I have no “f:\repo” directory so it was pointing to wrong location.

To fix this, add this line to PHP.ini

openssl.cafile="\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem"

Or download cacert.pem from http://curl.haxx.se/ca/cacert.pem
and add this line to PHP.ini

openssl.cafile="\your\cacert\pem\path\cacert.pem"