Category Archives: cPanel

getcomposer – memory-limit-errors

 

[email protected] [/home/domain.tld/www]# php ./bin/magento module:enable Infortis_Cgen Infortis_Dataporter Infortis_Infortis Infortis_Ultimo Infortis_UltraMegamenu Infor

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
[email protected] [/home/domain.tld/www]#

To check the current memory_limit try

[email protected] [/home/domain.tlm/www]# php -r "echo ini_get('memory_limit').PHP_EOL;"

On WHM

Let’s increase it to 2G, for example.

 

Apache / PHP – End of script output before headers

 

[Thu May 12 03:14:41.562083 2016] [core:error] [pid 25726] [client 68.71.XXX.XXX:44611] End of script output before headers: manage.php
[Thu May 12 03:14:41.697026 2016] [:error] [pid 26855] [client 84.91.XXX.XXX:60222] SoftException in Application.cpp:256: File “/home/rocker/public_html/system/manage.php” is writeable by group

I had to set the file to 755.

As seen on http://stackoverflow.com/questions/17583341/error-500-premature-end-of-script-headers

cPanel – folder&files structure

Apache – /usr/local/apache

  • bin- apache binaries are stored here: httpd, apachectl, apxs
  • conf – configuration files – httpd.conf: php.conf
  • cgi-bin
  • domlogs – domain access and stat log files for all domains is stored here
  • htdocs – default apache DocumentRoot location
  • include – header files
  • libexec – shared object (.so) files are stored here:  libphp4.so,mod_rewrite.so
  • logs – apache logs: access_log, error_log, suexec_log
  • man – apache manual pages
  • icons – icon/jpg/gif images
  • modules – shared object (.so) files are store here: Apache-2.x+
  • Init Script :/etc/rc.d/init.d/httpd or /usr/local/apache/bin/apachectl: apache start script
  • cPanel script to restart apache – /scripts/restartsrv_httpd
  • /opt – Apache modules built here

Exim

  • Conf : /etc/exim.conf – exim main configuration file: Do not manually edit
  • /etc/localdomains – list of domains allowed to relay/receive mail
  • Log : /var/log/exim_mainlog – incoming/outgoing mail logs
  • Log : /var/log/exim_rejectlog – exim rejected mails are reported here
  • Log : /var/log/exim_paniclog – exim errors are logged here
  • Mail queue: /var/spool/exim/input
  • Cpanel script to restart exim – /scripts/restartsrv_exim
  • Email forwarders and catchall address file – /etc/valiases/domainname.com
  • Email filters file – /etc/vfilters/domainname.com
  • POP user authentication file – /home/username/etc/domainname/passwd
  • Catchall inbox – /home/username/mail/new
  • POP user inbox – /home/username/mail/domainname/popusername/new
  • POP user spambox – /home/username/mail/domainname/popusername/spam• Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
  • Init Script: /etc/rc.d/init.d/exim : /scripts/restartsrv_exim : service exim restart
  • Check queue: exim -bpc

ProFTPD

  • Program :/usr/sbin/proftpd
  • Init Script :/etc/rc.d/init.d/proftpd : /scripts/restartsrv_ftpserver
  • Conf: /etc/proftpd.conf
  • Log: /var/log/messages, /var/log/xferlog
  • Accounts file – /etc/proftpd/$username (all ftp accounts are stored here)

Pure-FTPD

  • Program : /usr/sbin/pure-ftpd
  • Init Script :/etc/rc.d/init.d/pure-ftpd : /scripts/restartsrv_ftpserver
  • Conf: /etc/pure-ftpd.conf
  • Accounts file: /etc/proftpd/$username (all ftp accounts are stored here)
  • Anonymous ftp document root – /etc/pure-ftpd/ip-address

Frontpage Extensions

  • Program – (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe
  • Uninstall and then install for re-installations
  • FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html
  • /scripts/setupfp5 domain.com

Mysql

  • Program : /usr/sbin/mysqld :/usr/bin/mysqld_safe
  • Init Script : /etc/rc.d/init.d/mysql : service mysql start/stop : /scripts/restartsrv_mysql
  • Conf : /etc/my.cnf, /root/.my.cnf
  • Data directory – /var/lib/mysql (location for all database storage)
  • Database naming convention- username_dbname (eg: john_sales)(DBMapping)
  • Log: Startup errors – /var/lib/mysql/hostname.tld.err
  • Socket file – /var/lib/mysql/mysql.sock, /tmp/mysql.sock

PostgreSQL

  • Program:
  • Init Script:
  • Conf: /var/lib/pgsql/data/postgresql.conf & pg_hba.conf
  • Data Directory: /var/lib/pgsql/data
  • Log: /var/lib/pgsql/

SSHD

  • Program :/usr/local/sbin/sshd
  • Init Script :/etc/rc.d/init.d/sshd – /scripts/restartsrv_sshd – service sshd restart
  • Conf: /etc/ssh/sshd_config
  • Log: /var/log/messages

Perl

  • Program :/usr/bin/perl or /usr/local/bin/perl (one should symlink to the other)
  • Directory :/usr/lib/perl5/5.8.x/ or /usr/local/lib/perl5
  • Version: perl -v
  • Check: /scripts/checkperlmodules : /scripts/perlmods -s
  • Installer: /scripts/perlinstaller : perl -MCPAN -e shell
  • Build: /home/.cpan :/home/.cpcpan

System PHP

  • Program :/usr/local/bin/php, /usr/bin/php, /usr/local/php4/bin/php
  • ini file: /usr/local/lib/php.ini – apache must be restarted after any change to this file
  • PHP can be recompiled using /scripts/easyapache : /scripts/phpup using /var/cpanel/easy/apache/profile/
  • Also in WHM you can go to Main » Software » EasyApache (Apache Update) to recompile.

Internal PHP

  • Program : /usr/local/cpanel/3rdparty/bin/php : /var/cpanel/3rdparty/bin/php
  • ini file: /usr/local/cpanel/3rdparty/etc/php.ini
  • internal PHP can be recompiled using-  /scripts/makecpphp using /var/cpanel/easy/apache/profile/makecpphp.profile.yaml
  • /var/cpanel/3rdparty

Named(BIND)

  • Program: /usr/sbin/named
  • Init Script: /etc/rc.d/init.d/named
  • Config: /etc/named.conf
  • Zone files:/var/named/
  • Log: /var/log/messages: /var/named/data/named.run

NSD (Alternate DNS option)(limited to 500 domains and 50 IPʼs)

  • Program: /usr/sbin/nsd
  • Init Script : /etc/rc.d/init.d/nsd • db records : /var/named
  • Config: /etc/nsd/nsd.conf
  • Log: /var/log/messages

Courier

  • Program: /usr/lib/courier-imap/libexec/couriertcpd
  • Init Script: /etc/init.d/courier : /scripts/restartsrv_courier
  • Config: /usr/local/libexec/courier-imap
  • Log: /var/log/maillog

Dovecot

  • Program: /usr/sbin/dovecot
  • Init Script: /etc/init.
  • Config: /etc/dovecot.conf
  • Log: /var/log/maillog

DBMapping

  • Unordered List Item• Directory: /var/cpanel/databases
  • Scripts:
  • /usr/local/cpanel/bin/dbindex
  • /usr/local/cpanel/bin/dbmaptool
  • /usr/local/cpanel/bin/dbstoregrants
  • /usr/local/cpanel/bin/setupdbmap

Tomcat

  • Directory: /usr/local/jakarta/tomcat
  • Conf: /usr/local/jakarta/tomcat/conf/server.xml
  • Log:
  • /usr/local/jakarta/tomcat/logs/catalina.out
  • /usr/local/jakarta/tomcat/logs/catalina.err
  • /usr/local/apache/logs/mod_jk.log
  • Scripts:
  • /scripts/addservlets –domain=
  • /scripts/remservlets

Ruby

  • Directory:
  • /home/username/rails_apps
  • /home/username/.gem/ruby
  • Scripts: /scripts/installruby

Spamd

  • Directory: /etc/mail/spamassassin
  • Program: /usr/bin/spamd & /usr/bin/spamc & /usr/bin/spamassassin
  • Scripts: /scripts/installspam

Clamd

  • Conf: /etc/clamd.conf
  • Scripts:
  • clamscan
  • freshclam

EasyApache

  • /var/cpanel/easy/apache
  • /var/cpanel/userdata
  • /usr/local/apache/conf/
  • /var/cpanel/templates/apache2
  • /usr/local/cpanel/src/templates/apache2
  • /home/cpeasyapache
  • /opt
  • /usr/local/cpanel/logs/easy/apache

cPanel installation directory structure – /usr/local/cpanel

  • 3rdparty/ – tools like fantastico, mailman files are located here
  • addons/ – AdvancedGuestBook, phpBB, etc.
  • base/ – phpmyadmin, squirrelmail, skins, webmail, etc.
  • bin/ – cpanel binaries
  • cgi-sys/ – cgi files such as cgiemail, formmail.cgi, formmail.pl, etc.
  • logs/ – cpanel access_log, error_log, license_log, stats_log
  • whostmgr/ – whm related files
  • base/frontend – cPanel related files – themes+ perl/ – internal Perl modules for compiled binaries
  • etc/init – init files for cPanel services

WHM related files – /var/cpanel – whm files

  • bandwidth/ – rrd files of domains
  • username.accts – reseller accounts are listed in this files
  • packages – list of hosting packages
  • root.accts – list of root owned domains
  • suspended – list of suspended accounts
  • users/ – cpanel user file: theme, bwlimit, addon, parked, sub-domains all are listed in this files
  • zonetemplates/ – dns zone template files are taken from here

Common CPanel scripts – /scripts/

  • addns – add a dns zone
  • addfpmail2 -Adds frontpage mail extensions to all domains
  • addpop – add a pop account
  • addservlets – Add JSP support to a domain (requires tomcat)
  • adduser – Add a user to the system
  • apachelimits – calculates memory limits for apache processes then adds result to httpd.conf
  • bandminup – Updates Bandmin Application
  • biglogcheck – looks for logs nearing 2 gigabytes in size
  • bsdcryptoinstall – Installs crypto on FreeBSD
  • bsdldconfig – Configures the proper lib directories in FreeBSD
  • bsdpkgpingtest – Tests the connection speed for downloading FreeBSD packages
  • buildbsdexpect – Install expect on FreeBSD
  • buildeximconf – Rebuilds exim.conf
  • build_maxemails_config – Sets limit on amount of emails one can send from domains.
  • buildpostgrebsd-dev – Installs postgresql on FreeBSD.
  • chpass – change cpanel passwords (does not change all passwords)
  • checkperlmodules – Contains a list of standard CPAN modules to install on cPanel
  • check_users_my_cnf – Check user accounts for ~/.my.cnf files that do not work and disable them. This script only returns output when it detects a bad .my.cnf.
  • chcpass – For internal use only, do not use.
  • chkmydns – Performs a simple configuration check of MyDNS
  • cleandns – removes domains from named.conf that do not have a Zone.
  • comparecdb $file1 $file2 – Compare the content of 2 CDB files.
  • convert_roundcube_mysql2sqlite — Converts the Roundcube database from MySQL to SQLite
  • courierup – used to update/reinstall courier
  • cpaddonsup – Update cPanel’s addon.
  • cpbackup – to backup accounts (if backups enabled) (–force)
  • delpop – Removes POP account
  • dnscluster – used to synchronize DNS zones with clustered servers (–help)
  • dovecotup – Updates dovecot mail server
  • dumpcdb – Displays the contents of a CDB file
  • dumpstor – displays contents of .datastore storable files
  • dumpgdbm – displays contents of .gdbm locale files
  • easyapache – recompile/upgrade apache and/or php
  • editquota – used to manually set a users quota limit
  • ensure_vhost_includes – ensures users includes are added in httpd.conf
  • eximup – used to update exim to latest version (overwrites any manual changes)
  • export mydnsdbb – Exports zones from MyDNS for use with BIND and NSD
  • fixcommonproblems – fixes mailbox permissions, mailman, cgi scripts, ndc and quotas
  • fixfrontpageperm – fixes permission issues with Front Page
  • fixmailinglistperms — Repairs permissions for all mailing list files and directories
  • fixmailman – fixes common mailman issues fixndc – fixes rndc errors with named
  • fixquotas – fixes quota problems
  • fullhordereset – resets horde database to a fresh one (previous user data is lost)
  • ftpup – used to update/install FTP server (pureftpd or proftpd) to latest version
  • gather-update-logs — Sends update logs to cPanel for analysis
  • generatemaildirsize – generates new maildirsize for any or all users *(–help)
  • hook — Executes any hooks that would be called normally in the specified context
  • imapup – Updates IMAP email server
  • importmydnsdb — Imports zone information from BIND and NSD into MyDNS
  • initquotas – initializes quotas
  • installzendopt – installs zend optimizer – thru phpextensionmgr
  • installruby — Installs Ruby
  • installpostgres — Installs PostgreSQL
  • killacct – terminate an account  (backup account before termination)
  • killdns – removes a DNS Zone
  • killpkg – removes a package
  • mailperm – fixes permission problems with mail directories
  • makecpphp – rebuilds internal PHP from /var/cpanel/easy/apache/profile/makecpphp.profile.yaml
  • mydnsup — Installs and updates MyDNS packages
  • mysqlup – updates mysql to latest version specified in /var/cpanel/cpanel.config
  • nsdup – Updates BIND services for name servers
  • park – to park a domain (only adds DNS)
  • pkgacct – used to create an account backup
  • pre* –  creates pre service scripts that run before a service is updated
  • post* – creates post service scripts that run after a service is updated
  • portsup – Updates Ports(FreeBSD systems only)
  • phpup – used to update PHP only
  • phpextensionmgr – Installs IonCube, Zend Optimizer, SuHosin & eAccelerator
  • realchpass – Similar to chpass, changes cPanel password only (not FTP or MySQL)
  • realperlinstaller – Automates the installation of Perl CPAN modules
  • realrawchpass – For internal use only, do not use.
  • rebuildcpusers – chowns /var/cpanel/users files
  • rebuildnamedconf – rebuilds /etc/named.conf with zones from /var/named/*.db
  • rebuildparkeddomains
  • restartsrv_$servicename – restart script for services
  • restartsrv_mydns — Restarts script from MyDNS
  • restorepkg – restores an account from a backup file (pkgacct file)(must be in /home)
  • runlogsnow – update logs of all users
  • runstatsonce – Updates statistics for a user
  • runweblogs – update stats for a particular user
  • securetmp – secures /tmp partition with options nosuexec and nosuid
  • setupftpserver – sets the FTP server to install (pureftpd or proftpd)
  • setupmailserver – sets the mail service to install (courier or dovecot)
  • setupnameserver – sets the DNS service to install (Bind or NSD)
  • slurp_exim_mainlog — Imports exim mainlog data into the eximstats database
  • suphpup – Updates SuPHP tool
  • suspendacct – suspends an account
  • try-later – Executes a user-defined check command at a specified interval
  • unsuspendacct – unsuspends an account
  • upcp – updates cpanel to the latest version (–force)
  • upcp-running – Specifies whether a upcp command is running
  • updatenow – updates the cpanel scripts
  • updateuserdomains – updates /etc/userdomains entries from /var/cpanel/users
  • update_php_timezonedb — Updates the timezone database used by PHP
  • xfer_horde_sid_resolver.pl — Resolves key collision errors before importing Horde data during an account transfer
  • wwwacct – to create new accounts (wwwacct domain.com user password)

Important cPanel/WHM files (& Config files)

  • /usr/local/apache/conf/httpd.conf – apache configuration file
  • /etc/exim.conf – mail server configuration file
  • /etc/named.conf – name server (named) configuration file
  • /etc/proftpd.conf – proftpd server configuration file
  • /etc/pure-ftpd.conf – pure-ftpd server configuration fileetc/valiases/domainname (catchall and forwarders are set here)
  • /etc/vfilters/domainname – email filters are set here
  • /etc/userdomains – all domains are listed here addon, parked, subdomains, and the usernames
  • /etc/localdomains – exim related file all domains should be listed here to be able to send/receive emails
  • /etc/cpbackup-userskip.conf
  • /etc/sysconfig/network – Networking Setup
  • /etc/hosts
  • /etc/resolv.conf – Networking Setup–> Resolver Configuration
  • /etc/nameserverips – Networking Setup–> Nameserver IPs ( for resellers to give their nameservers )
  • /var/cpanel/resellers – For addpkg, etc permissions for resellers.
  • /etc/chkserv.d – Main » Service Configuration » Service Manager
  • /etc/ipaddrpool – free IP addresses
  • /etc/ips.dnsmaster – nameserver IP’s
  • /etc/domainips –  dedicate IPʼs set for specific domains
  • /etc/wwwacct.conf – account creation defaults file in WHM (Basic cPanel/WHM Setup)
  • /etc/cpupdate.conf – Update Config file
  • /etc/cpbackup.conf – Configure Backup
  • /etc/clamav.conf – clamav (antivirus configuration file )
  • /etc/my.cnf – mysql configuration file
  • /usr/local/lib/php.ini – php configuration file
  • /etc/ips – IP addresses on the server (excluding shared IP’s) (IP Functions–>Show IP Address Usage )
  • /var/run/chkservd – Main » Server Status » Service Status
  • /var/log/dcpumon – top log process
  • /root/cpanel3-skel – skeleton directory. Eg: public_ftp, public_html. (Account Functions)
  • /var/spool/exim/input – Mail queue
  • /var/spool/exim/msglog – email message logs
  • /var/spool/cron – cronjobs are stored here for all users
  • /var/cpanel/users – cpanel user file that defines account settings
  • /var/cpanel/users.cache – user cache files that are read by cPanel
  • /var/cpanel/cpanel.config – cpanel configuration file ( Tweak Settings )
  • /var/cpanel/Counters – To get the counter of each users.
  • /var/cpanel/bandwidth – To get bandwith usage of domains
  • /var/cpanel/userdata – Defines parked, addon, subdomains as well as VirtualHost
  • /var/cpanel/logs – transfer logs
  • /var/cpanel/easy/apache – easyapache build files/profile
  • /var/cpanel/userhomes – session home for cPanel, Horde, Roundcube, phpmyadmin
  • /var/cpanel/serviceauth – chkservd service user/pass data
  • /var/cpanel/updatelogs – upcp daily logs
  • /var/cpanel/horde – version file, backups and logs stored here
  • /var/cpanel/roundcube – version file, backups and logs stored here
  • /var/cpanel/squirrelmail – version file stored here
  • /var/cpanel/packages – default and custom packages created herevar/cpanel/databases – dbmapping files
  • /var/cpanel/cpanelsync – DNS Clustering files

 

Sources:

Weird 404 and .htaccess not working properly – cpanel

Took a HUGE time to figure out why my .htaccess rules weren’t working on a CPanel environment.

Like I said on the previous post, CPanel requires the right file permissions on folders and files.

[Tue Jan 06 12:19:40 2015] [crit] [client 84.XX.XX.XXX] (13)Permission denied: /home/asiandee/subdomains/www.domain.com/folder/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

folder has to be with 755
and .htaccess has to be with 644

 

More readings

 

 

 

PHP – 500 internal server error – cPanel

I’v been struggling for hours to solve a weird problem with PHP in a cPanel environment.

This is how my log (/usr/local/apache/logs/error_log) looks like

[Tue Dec 30 21:13:09 2014] [error] [client 88.94.5.xxx] SoftException in Application.cpp:601: Directory "/home/dee/subdomains/www2.domain.com/members" is writeable by group
[Tue Dec 30 21:13:09 2014] [error] [client 88.94.5.XXX] Premature end of script headers: index.php
[Tue Dec 30 21:13:09 2014] [error] [client 88.94.5.XXX] File does not exist: /home/dee/subdomains/www2.domain.com/500.shtml

I thought that was some bad configuration on .htaccess … but that was wrong!
On some environments we need to have the right file/directory permissions so it work…

  • files: 644
  • directories: 755

Continue reading PHP – 500 internal server error – cPanel

Install FFMPEG on Centos / CPanel FFmpeg Static Builds

Download the latest FFmpeg Static Builds from http://johnvansickle.com/ffmpeg/.

How to know if we need to download the 32 or 64 bits?
Lets run:

cat /etc/*release*
CentOS release 6.6 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Or using uname (more reliable)

uname -m

I’v download it do a specific folder

wget http://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz

And the run the following command to uncompress it:

tar xf ffmpeg-git-64bit-static.tar.xz

To run ffmpeg or ffprobe we need to give the full path to them!

It worked!

With the lastest versions!
FFMPEG & FFPROBE

ROCK!

SOME PROBLEMS ON OLD MACHINES

-bash-3.2$ tar -xf ffmpeg-git-64bit-static.tar.xz 
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
tar: Read 5668 bytes from ffmpeg-git-64bit-static.tar.xz
tar: Error exit delayed from previous errors

tar version (fuckz!)

tar (GNU tar) 1.15.1

Well, this machine, where I got this error, is a managed server…
I didn’t bored to ask support to upgrade TAR or install XZ… but if you want, you can install XZ and then…

xz -d archive.tar.xz
tar xvf archive.tar

It might work! 🙂
Btw! On old machines kernel might not be compatible