Linux Tutorials

install PHP CentOS 7 / RHEL 7

main_image_php

1) Install PHP.

yum -y install php php-mbstring php-pear

guess_linux_install_php1 guess_linux_install_php2

modify some configuration file

vi /etc/php.ini

line 878: uncomment and add your timezone

date.timezone = "Asia/Kolkata"

guess_linux_install_php3

Restart Apache

systemctl restart httpd

guess_linux_install_php4

2) Testing

Create a PHP test page and access to it from client PC with web browser.

vi /var/www/html/index.php

guess_linux_install_php5

Pest the following code and save it

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
<?php
echo date("Y/m/d");
?>
</div>
</body>
</html>

guess_linux_install_php6

guess_linux_install_php7

6 Comments

Leave a Comment