Look whether the version you like is available. For a producion server you may not want to install the very latest.
Here I have gone for php56 i.e. php-5.6 as I needed it for the latest mediawiki I was looking to install for my documentation.
1
2
3
4
| sudo service php-fpm stop
sudo yum remove php-*
sudo yum install php56
yum list installed | grep php
|
You may want the following extenstions
1
| sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd
|
You may like to install the mysql server
1
| sudo yum install php56-mysqlnd
|
(NOTE: it is apparently not php56-mysql )
1
| sudo vim /etc/php-fpm-5.6.d/www.conf
|
change the user and group to nginx. Then edit or create your nginx configuration file
1
| sudo vim /etc/nginx/conf.d/yourserver.conf
|
This is mine.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| server {
listen 80;
server_name your_domain_name;
root /srv/sites/your_domain_name;
index index.php index.html;
client_max_body_size 5m;
client_body_timeout 60;
location ~ \.php$ {
try_files $uri :404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri /index.php;
expires max;
log_not_found off;
}
location : /_.gif {
expires max;
empty_gif;
}
location ^~ /cache/ {
deny all;
}
location /dumps {
root /srv/sites/Alfred Tuinman.odyssey.co.in;
autoindex on;
}
}
|
You need to verify permissions and ownership of the document root. It is best to create a small phpinfo.php page in your root for testing
1
2
3
| <?php
phpinfo();
?>
|
and then you can start testing
1
2
3
| sudo service php-fpm-5.6 start
sudo service nginx restart
php -v
|
This highlighted again for me how great it would be if I would improve my knowledge of Chef, the DevOps tool, as I am certain I overlooked some steps that I would like to have recorded. After all a five minite job took me now 2 hours. In short, I have to do it again on a fresh server.