LINUX How to Install PHP to use it

1 Install PHP to use it.
[root@www ~]#yum -y install php php-mbstring php-pear
[root@www ~]#vi /etc/httpd/conf/httpd.conf
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.html index.php
[root@www ~]#vi /etc/php.ini
# line 946: set your timezone
date.timezone ="Asia/Tokyo"
[root@www ~]#/etc/rc.d/init.d/httpd restart
Stopping httpd:[ OK ]
Starting httpd:[ OK ]
2 Create a PHP test page and access to it with web browser. It's OK if following page is shown
[root@www ~]#vi /var/www/html/index.php
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
<?php
   print Date("Y/m/d");
?>
</div>
</body>
</html>
 Open browser with address http://my-server.com/index.php

Comments

Popular posts from this blog

LINUX Move and copy files using SSH

PHP Predefined Variables

Java : Variables Declaring