- The added line is THIS COLOR.
- The deleted line is THIS COLOR.
- Go to HowToUse/PHP/5.3.
#contents
*Prerequisite [#s8220bb5]
-Cent OS installation (You can refer [[Overall/CentOS/]])
-Cent OS 6.5 installation (You can refer [[HowToUse/CentOS/6.5]])
*Install&Setup [#ed386da0]
:Step.1|
Check if the Apache Web Server is installed.
# yum list installed | grep httpd
If it is not installed, execute the following command.
# yum install httpd
:Step.2|
Check if PHP is installed.
# yum list installed | grep php
If it is not installed, execute the following command.
# yum install php-*5.3*
:Step.3|
Open PHP configuration.
# vi /etc/php.ini
If you can't find php.ini in etc directory, you can search with the following command.
# php -i
:Step.4|
Edit as below.
default=path = "UTF-8"
mbstring.language = English
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = pass
mbstring.encoding_translation = off
:Step.5|
Restart Web server.
# /etc/rc.d/init.d/httpd restart
:Step.6|
Create the following file to get information about installed php.
# vi /var/www/html/phpinfo.php
<?php
phpinfo();
?>
You can refer sample code from [[sample code - phpinfo.php:https://github.com/osssv/osssv-helloworld/blob/master/php/5.3/phpinfo.php]]
:Step.7|
Access to http://localhost/phpinfo.php and check the information of installed php.
#ref(install_fig1.png,,500x375,)
*HowToUse [#c3cb9a8c]
:Step.1|
xxx
Prepare sample code as below.
$ cd /var/www/html
$ vi request.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
</head>
<body>
<form method="POST" action="response.php">
<div id="container">
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
</div>
<input type="submit" value="Send" />
</form>
</body>
</html>
You can refer sample code from [[sample code - request.php:https://github.com/osssv/osssv-helloworld/blob/master/php/5.3/request.php]]
$ vi response.php
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
Hi <?php print htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8'); ?>!
</body>
</html>
You can refer sample code from [[sample code - phpinfo.php:https://github.com/osssv/osssv-helloworld/blob/master/php/5.3/response.php]]
:Step.2|
Access response.php, enter "Name" and click "Send", then you will see the following window.
#ref(CreateCode_fig1.png,,500x266,)
#ref(CreateCode_fig2.png,,500x266,)
*Author [#b6ad4b5a]
S.Yatsuzuka