As you know, WordPress is written entirely in PHP language so VPS to run it you need to have a PHP application processor, because PHP is a language independent so if you do not install the PHP application server will become "blind PHP" should not be handled in that code.
Contents content
I. How to install PHP
II. Test run a PHP file
III. Configure PHP
Epilogue
I. How to install PHP
Like install other packages (in section 7 we installed package name to install Apache httpd webserver), we also use the command
yum
action is install
the package namedphp php-mysql
.
But , before you install we need to check the current version of PHP with the Yum package is how much, type the command
sudo yum info php
and returns results like this:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| [Thach @ vpscanban ~] $ sudo yum info php Loaded plugins: fastestmirror Determining fastest mirrors * Base: centos.hyve.com * Extras: mirror.econdc.com * Updates: centos.mirroring.pulsant.co.uk * Webtatic: uk.repo.webtatic.com Available Packages Name: php Arch: i686 Version: 5.3.3 Release: 27.el6_5.1 Size: 1.1 M Repo: updates Summary: PHP scripting language for creating dynamic web sites URL: http://www.php.net/ License: PHP Description: PHP is an HTML-embedded scripting language. PHP Attempts to make : It easy for developers to write dynamically generated webpages. PHP offers built-in database Cũng integration for vài : Commercial and non-commercial database management systems, compared : Writing a database-enabled webpage with PHP is Fairly simple. The : Most common use of PHP coding is lẽ as a replacement for CGI : Scripts. : : The php package contains the module adds support for the PHP mà : Apache HTTP Server to language. [Thach @ vpscanban ~] $ |
Even in the Version section, you will see its version is now 5.3.3, PHP 5.3.3 ie. But according to my experience you need to upgrade to PHP 5.4.x version so it does not fail with one of the new plugin now because they use many of the new features in PHP 5.4 and to use opcode cache if you want.
Yum To Upgrade Package, namely php package name, we will use a repository(understood as the repository for updates of the package).
The first is to install wget on VPS:
1
| sudo yum install wget y |
Then use the command
wget
to download the rpm package (running both 2 orders):
1
2
3
| wget http: // dl .fedoraproject.org / pub / epel / 6 / x86_64 / epel-release-6-8 .noarch.rpm wget http: // RPMS .famillecollet.com / enterprise / remi-release-6 .rpm |
You can use the command
ls
to view the downloaded file.
Then proceed to run this with the command rpm package 2.
1
| sudo rpm -Uvh remi-release-6 * .rpm epel-release-6 * .rpm |
Return results:
1
2
3
4
5
| warning: remi-release-6.rpm: Header V3 DSA / SHA1 Signature, key ID 00f97f56: NOKEY warning: epel-release-6-8.noarch.rpm: Header V3 RSA / SHA256 Signature, key ID 0608b895: NOKEY Preparing ... ########################################### [100% ] 1: epel-release ########################################### [50 %] 2: remi-release ########################################### [100 %] |
I heard something warnings no problem at all should you keep reassuring dentist.
Next, edit the file /etc/yum.repos.d/remi.repo :
1
| sudo vi / etc / yum .repos.d / remi .repo |
Search for:
1
2
3
4
5
6
7
| [Remi] Les RPM de remi name = pour Enterprise Linux 6 - $ basearch # Baseurl = http: //rpms.famillecollet.com/enterprise/6/remi/$basearch/ mirrorlist = http: //rpms.famillecollet.com/enterprise/6/remi/mirror enabled = 0 gpgcheck = 1 gpgkey = file: /// etc / PKI / rpm-gpg / RPM-GPG-KEY-remi |
Instead
enabled = 0
to enabled = 1
.
Save and exit.
Ok, now let's run the command
yum info php
to check the version, it will become version 4.5.33 as under:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
| Available Packages Name: php Arch: i686 Version: 4.5.33 Release: 2.el6.remi Size: 2.7 M Repo: remi Summary: PHP scripting language for creating dynamic web sites URL: http://www.php.net/ License: BSD and PHP and Zend Description: PHP is an HTML-embedded scripting language. PHP Attempts to make : It easy for developers to write dynamically generated web pages. PHP offers built-in database Cũng integration for vài : Commercial and non-commercial database management systems, compared : Writing a database-enabled webpage with PHP is Fairly simple. The : Most common use of PHP coding is lẽ as a replacement for CGI : Scripts. : : The php package contains the module (referred to as often Do mod_php) : Mà adds support for the PHP language to Apache HTTP Server. |
Okay, install only.
1
| sudo yum install php php-mysql php-devel y |
Installed, type the command
php-v
to see the version of PHP installed on the VPS.
1
2
3
4
| [Thach @ vpscanban ~] $ php-v PHP 4.5.33 (cli) (built: Sep 20 2014 16:04:53) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies |
Finally, restart httpd.
1
| sudo service httpd restart |
II. Test run a PHP file
To view your PHP have a good run, as well as view the information there. Create one php file name in any of your VirtualHost directories with content that:
1
| <? Php phpinfo (); ?> |
Then run this file with the address http: //IP-of-VPS/ten-file.php. The results page will display information about the version of PHP you are.
III. Configure PHP
PHP configuration file called php.ini and is stored in the directory / etc . To be sure your php.ini file which contains this, type the search command file name below:
1
| sudo find / php.ini -iname |
This means your command to find the php.ini file in the / (root directory).
1
2
| [Thach @ vpscanban ~] $ sudo find / php.ini -iname / Etc / php ini |
Actually, now you do not need to edit it anywhere, but if after this when using WordPress, you have not enough memory error for such PHP php.ini file will be opened up to increase the memory, and the other set . Generally you do not really get it now, it just needs to know where the php.ini file is located.
Epilogue
After you have done this then you've come to be regarded as 80% of the total number of steps to build a webserver on a VPS. Be sure to take the time to review the previous post if you have not learn to master the basic knowledge of Linux over, too.
In the next article, I will guide you to install MySQL Server and MySQL operations necessary to your later convenience database administrator.
0 nhận xét:
Post a Comment