Manually install PHP on Linux and Unix OS
- 25-07-2022
- Toanngo92
- 0 Comments
PHP can be installed on UNIX or Linux variants. It requires the following conditions:
- PHP for version 8 http://www.php.net/downloads.php
- Latest Apache Web Server
- Database, if required (such as MySQL, Oracle, etc.)
- Make utility – download at http://www.gnu.org/software/make
Steps to install Apache and PHP 8 on a Linux or Unix machine:
Step 1: unzip and export the downloaded apache tar file
Step 2: Configure Apache Server as follows
cd apache_2.4.x -/configure --prefix=/usr/local/apache --enable-so make make install
Step 3: unzip and export the downloaded php tar file
Step 4: If using MySQL database, configure php to work with MySQL as follows
-/configure --with-apxs=/usr/sbin/apxs --with-mysql=/usr/bin/mysql make install
Step 5: The php.ini file must be installed and edited according to the configuration
cd php.ini /usr/local/lib/php.ini
Step 6: Edit httpd.conf to tell Apache where to serve and the extension of php files
Step 7: User can add at least one PHP extension directive, followed by a second handler to parse all HTML files into PHP
AddType application/x-httpd-php .php AddType application/x-httpd-php .html
Step 8: restart Server when user changes HTTP or php.ini configuration, server needs to be restarted to load new configuration
Step 9: Create and a php file to test the environment