Apache & PHP
Apache and PHP
Articles
How to Fix 403 forbidden error After Changing the Root Directory in NGINX
When accessed PHP files through a browser, may see "NGINX 403 forbidden error".
Here's the error message from NGINX error log /var/log/nginx/error.log.
[error]...
How to Hide the Apache Version Number?
Hiding Apache's version number on error pages and in the Server response header is a good security practice: broadcasting the exact software version helps an attacker...
How to Host a Website on Localhost (PHP Built-in Server, Docker or XAMPP)
“Hosting on localhost” means running a website on your own computer, reachable at http://localhost, to build and test it before it goes online. Other...
How to Install Apache Cassandra 5 on Ubuntu, Debian, AlmaLinux and Rocky Linux
Apache Cassandra is a distributed NoSQL database with no single point of failure. The current version is 5.0 (4.1 is also still supported). These steps are for Ubuntu...
How to Install Apache Cassandra 5 on a Single Server
Ubuntu 17.04 and CentOS 7 are end of life. Apache Cassandra is a distributed NoSQL database for large amounts of data across many servers. The current version is 5.0;...
How to Install DSO With mod_ruid2 Using EasyApache 4?
DSO stands for Dynamic Shared Object. If you want to increase your website or web app's speed, you need to use DSO. It is one of the many modules available in Apache...
How to Install the PHP GeoIP Extension?
The old PHP geoip extension and the legacy GeoIP databases it read are discontinued: MaxMind stopped updating those databases in 2019. Use the GeoIP2 / GeoLite2...
How to Send Email from PHP with SMTP (PHPMailer)
PHP’s built-in mail() function sends without logging in, so the mail often lands in spam or isn’t sent at all. Sending through an SMTP account with a login...
How to Set Up a Permanent (301) Redirect in Apache: Redirect, RedirectPermanent, RedirectMatch and RewriteRule
To make a permanent (301) redirect in Apache, add one line to the site’s virtual host or .htaccess file: Redirect permanent "/old-page.html"...
How to Stop Google Indexing Pages and Files with .htaccess (X-Robots-Tag noindex)
A noindex rule tells search engines not to show a page or file in their results. For HTML pages you can put it in a meta tag, but PDFs, images and whole folders have...
How to Use Apache as a Reverse Proxy (mod_proxy)
A reverse proxy receives visitors’ requests on ports 80 and 443 and passes them to an application running on another port, such as a Node.js, Python or Java app...
How to Use Your Own php.ini File in a Cron Job
To make a cron job use your own php.ini, call PHP with the -c option followed by the path to that file, then the script:
/usr/bin/php -c...
How to do URL redirection
URL redirection, or URL forwarding, is a process followed on the web to direct users and search engines from one URL (the source URL) to a different URL (the target...
How to enable ODBC on EasyApache 4?
1. First, install the PHP PDO_ODBC module in EA4.
2. Then we have to install Microsoft SQL Server ODBC Driver for Linux, download available at...
How to fix Apache Too many connections issue?
The reasons are the following:
- Unoptimized Apache settings
The default settings of Apache can induce a heavy load on memory if the sites are content rich dynamic...
How to increase PHP memory limit
PHP's memory_limit sets how much memory one PHP script may use. Raise it when you see "Allowed memory size of ... bytes exhausted".
In cPanel
Log in to cPanel (for...
How to increase the size of uploaded files in PHP
Two PHP settings limit uploads: upload_max_filesize (the largest single file) and post_max_size (the whole form submission, which must be at least as large).
In...
How to install Magento from Softaculous
Softaculous in cPanel lists Magento among its one-click apps. Before you install it, check the requirements: current Magento (Adobe Commerce open source 2.4) needs a...
How to restore PHP Selector options after restore or migration?
On CloudLinux servers, each user's PHP Selector choices (PHP version, extensions and options) are stored in their account. After restoring or migrating an account,...
How to use Apache mod_rewrite
Apache's mod_rewrite changes or redirects URLs with rules in your .htaccess file. It is enabled on our servers; start your rules with RewriteEngine On.
Common...
Importing Databases and Tables with phpMyAdmin
Import an SQL file to restore a backup or load a database from another server.
Steps
Open phpMyAdmin (in cPanel: Databases › phpMyAdmin) and click the database in the...
Inserting Fields into Database Tables with phpMyAdmin
Adding a column (field) to a table lets it store new information.
Steps
Open phpMyAdmin (in cPanel: Databases › phpMyAdmin) and click the database in the left...
Internal Server Error or Error 500
The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact your web hosting provider and inform them of the...
Managing Resources with Apache mod_alias
In many cases, all of the resources served by an Apache host are located in that host’s DocumentRoot. The DocumentRoot is a directory specified in the...
Modifying Fields in Database Tables with phpMyAdmin
You can change a column's name, type, length or default value in phpMyAdmin.
Steps
Export the table first.Open phpMyAdmin (in cPanel: Databases › phpMyAdmin) and click...