LoginSignup
1
0

More than 5 years have passed since last update.

How to Install ThinkPHP5.1 in LEMP?

Last updated at Posted at 2018-08-16

OS : Ubuntu Server 16.04.5 LTS
MySQL : How to Install MySQL 8 and phpMyAdmin via Docker?
ThinkPHP: It's a China made PHP framework.

Install php nginx

$ sudo apt install php7.0 php7.0-mysql nginx

Error 1

Call to undefined function Think\imagecreate()

Solution 1

$ sudo apt install php7.0-gd

Error 2

call not undefined function Think\simplexml_load_string() 

Solution 2

$ sudo apt install php7.0-xml

Error 3

Call to undefined function mb_strimwidth()

Solution 3

$ sudo apt install php7.0-mbstring

Modified nginx configuration

$ vim /etc/nginx/sites-available/default
-- index index.html index.htm index.nginx-debian.html;
++ index index.html index.htm index.php;

location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
++      if (!-e $request_filename) {
++              rewrite ^(.*)$ /index.php?s=/$1 last;
++              break;
++      }

        try_files $uri $uri/ =404;
}

-- # fastcgi_pass unix:/run/php/php7.0-fpm.sock;
++ fastcgi_pass unix:/run/php/php7.0-fpm.sock;

-- # location ~ /\.ht {
-- #         deny all;
-- # }
++ location ~ /\.ht {
++        deny all;
++ }

Restart Nginx & php7.0-fpm

$ sudo systemctl restart nginx
$ sudo systemctl restart php7.0-fpm

Put php file in /var/www/html/

$ vim /var/www/html/index.php
index.php
<?php phpinfo(); ?>

Git clone ThinkPHP5.1 files in /var/www/html/

$ cd /var/www/html/
$ git clone https://github.com/top-think/think tp5
$ cd /var/www/html/tp5
$ git clone https://github.com/top-think/framework thinkphp
$ git checkout 5.1

https://www.kancloud.cn/manual/thinkphp5_1/353948
https://websiteforstudents.com/install-nginx-mariadb-and-php-7-1-lemp-with-ubuntu-16-04-lts-server/
https://gist.github.com/GhazanfarMir/03bd1f1f770a3834d47274586d46ea62

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0