How to install Apache and PHP in cpanel server via easyapache, The perfect cpanel setup
- Category : Linux Helpline (Easy Guide)
- Posted on : Jan 02, 2019
- Views : 2,359
- By : Icarus M.
Cpanel easyapache is a simple and easy software, that bundled with the industry leader hosting control panel software, Cpanel. It have an easy interface to do apache and php installation. You can chose any of the favourite apache modules and php module. This is a standard documentation, that will help you to setup a perfect cpanel server without worrying about it.
Cpanel support multiple php versions and php handlers. The php handlers are the handlers connected to the apache web server, so that you can run php scripts in your server using the apache web server. There are different type of handlers available in cpanel. Some of them are cgi, fcgi, suphp, DSO, Lsapi , etc,. To know more about handlers please read it from the cpanel documentation
This article is to setup apache with php as SUPHP handler. So to run suphp, the maximum allowed file permissions are 644 and directory permissions are 755. So if you any the php scripts have 777 permission , you will surely see a 500 internal server error.
Before proceeding with apache and php installation or upgrade in production server with websites, please note the following. If you are a tech and working on help desk, you may need to run the following commands and add a proper note. This will help you to trouble shoot, if any error happen.
- 1) Find the default php version
You can go to WHM >> Software >> MultiPHP Manager and see which is the system default php version. Or simply run the following command and add it as note.
[root@server ~]# php -v PHP 7.0.33 (cli) (built: May 30 2019 20:54:26) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd. with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
Here this server is running php 7.0. So after completing easyapache, the default php version must be 7.0
- 2) What are the php versions currently installed and what are the handlers.
As I said cpanel support multiple php versions. So check all the php versions and handlers using the following command and make a note for it.
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current DEFAULT PHP: ea-php70 ea-php56 SAPI: suphp ea-php70 SAPI: suphp ea-php71 SAPI: suphp ea-php72 SAPI: suphp
This server have php56, php70 , php71 and php72 . All are using suphp as handlers. So we need to make sure after the installation this configuration must stay. Also don’t remove any of the php versions from the above list. In future if you need to add php73 , then simply add it without removing the existing versions.
- 3) Update cpanel before easyapache.
It is always better to do an upcp before doing easyapache in whm. So that you will get the latest packages. To update the cpanel simply run the following script.
[root@server ~]# /usr/local/cpanel/scripts/upcp
- 4) Start Easyapache 4 from whm
Now login to the whm via port 2087 as root user and go to Software >> EasyApache 4 . There you can see different profiles. It is always better to chose “Currently Installed Packages” and proceed to “Customize”.
- 5) Apache MPM Choice
This is the next step. Select the apache MPM. It is always good to select the mod_mpm_worker It works well with suphp . So we select that and click next.
- 6) Apache Modules
This is an important step. You should chose the following apache modules. We are going to setup suphp as suexec server.
mod_bw mod_bwlimited mod_cgid mod_cpanel mod_deflate mod_expires mod_fcgid mod_headers mod_http2 mod_mpm_worker mod_proxy mod_proxy_fcgi mod_proxy_http mod_security2 mod_ssl mod_suexec mod_suphp
- After selecting the above modules, go to next step
- 7) PHP versions
In this section, you can select all the php versions you need. Please remember to enable all the previously enabled php versions. In this server we have php56, php70, php71 and php72. We select all this version. Then we are going to add one more version that is php73 . Select the versions and click next ./p>
- 8) PHP Extensions
This step is a big long list of php modules. You need to enable the following modules in all of the php versions for a better working. I am using 73 as a php version string here . You need to chose all these modules from php56,php70,etc,.
php73-build php73-libc-client php73-pear php73-php-bcmath php73-php-bz2 php73-php-calendar php73-php-cli php73-php-common php73-php-curl php73-php-devel php73-php-enchant php73-php-exif php73-php-fileinfo php73-php-fpm php73-php-ftp php73-php-gd php73-php-gettext php73-php-iconv php73-php-imap php73-php-intl php73-php-ioncube10 , Chose the latest available ioncube encoder. php73-php-litespeed php73-php-mbstring php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-posix php73-php-pspell php73-php-soap php73-php-sockets php73-php-tidy php73-php-xml php73-php-xmlrpc php73-php-zip php73-runtime
So you can see I selected a lot of php modules, why ? If you chose these modules, 99% of your php CMS or frameworks works fine in a shared cpanel server without any issues. As the modules are dynamically compiled extensions, this doesn’t increase any php resources usages. So scripts like wordpress, joomla, majento , yii2 frameworks, Larawel etc,. works fine without any issues. So after selecting the options go to next.
- 9) Ruby Via Passenger
This is ruby on rails module installation with mod_passenger. We really don’t need to enable any of this options. You only enable this , if you have any clients using ROR in you cpanel server. So simply go to next step without selecting any options from this menu.
- 10) Additional Packages
This is the tomcat and NodeJS package selection in cpanel. We really don’t need to enable this options, unless you have a special client with custom requirements. Normally in shared hosting server. these features won’t be required. So we don’t enable any options in this menu, go to next.
- 11) Review
This is a final review section. You can see all of your selected packages. So smply verify it and click provision.
It will take some time to do the provision. After finishing it check the server php configuration using the following command.
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current DEFAULT PHP: ea-php70 ea-php56 SAPI: suphp ea-php70 SAPI: suphp ea-php71 SAPI: suphp ea-php72 SAPI: suphp ea-php73 SAPI: suphp
You now see , we have php73 enabled as suphp in the server. With default php as php70.
You may also need to monitor the apache error logs to see if there any issues with any domains.
[root@server ~]# tailf /var/log/apache2/error_log
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu