From http://myprojects.advchaweb.com/index.php/2018/06/25/symfony-4-blog-app/
I NEED TO CHECK MY PHP VERSION. CLI ALREADY 7.2.
|
|
teddy@teddy:~/Documents/works/symfony4/blog$ php -v PHP 7.2.7-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 22 2018 08:44:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.7-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethan |
BUT THE SERVER STILL 7.0 (http://localhost/phpinfo.php).
IF NOT, CHANGE THE PHP-CLI FROM PHP7.0 (FOR EXAMPLE) TO PHP7.2:
|
|
teddy@teddy:~$ sudo ln -sfn /usr/bin/php7.2 /etc/alternatives/php teddy@teddy:~$ php -v |
I ALREADY HAS 7.2 BUT SOME EXTENSIONS ARE MISSING. SO INSTALL THEM
|
|
sudo apt-get install php7.2-mysql php7.2-curl php7.2-cgi php7.2-mbstring php-mcrypt php7.2-zip php7.2-fpm php7.2-xml php7.2-xmlrpc php-xdebug php7.2-intl |
TO ENABLE PHP 7.2 ON APACHE2 SERVER, PLS DO (MAKE SURE NGINX IS STOPPED IF IT’S RUNNING AND START APACHE2):
|
|
sudo a2dismod php7.0 sudo a2dismod php7.1 sudo a2enmod php7.2 sudo systemctl restart apache2 |
TEST: http://localhost/phpinfo.php
IF NEEDED TO CHANGE THE PHP SETTING, PLS EDIT:
|
|
sudo gedit /etc/php/7.2/apache2/php.ini |
|
|
upload_max_filesize = 2000M -> (default 2M) max_file_uploads = 2000 -> (default 20) post_max_size = 2000M -> (default 8M) max_execution_time = 600 -> (default 30) in second max_input_time = 600 -> (default 60) in second memory_limit = 2560M -> (default 128M) |
TO ENABLE PHP 7.2 ON NGINX SERVER, PLS DO (MAKE SURE APACHE2 IS STOPPED IF IT’S RUNNING AND START NGINX):
THE NGINX MAIN CONFIG IN /etc/nginx/nginx.conf
THE DEFAULT VIRTUALHOST IN /etc/nginx/sites-available/default
EDIT IT TO ENABLE PARSING PHP FILE:
|
|
sudo gedit /etc/nginx/sites-available/default |
CHANGE THE CONTENT TO ENABLE PHP 7.2 FPM:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
... server { ... # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # # # With php7.0-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.2-fpm.sock; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } } ... |
THEN CHANGE PHP7.2-FPM SETTING:
|
|
sudo gedit /etc/php/7.2/fpm/php.ini |
CHANGE THE CONTENT:
|
|
cgi.fix_pathinfo=0 upload_max_filesize = 2000M -> (default 2M) max_file_uploads = 2000 -> (default 20) post_max_size = 2000M -> (default 8M) max_execution_time = 6000 -> (default 30) in second max_input_time = 600 -> (default 60) in second memory_limit = 2560M -> (default 128M) |
THEN RESTART PHP7.2-FPM SERVICE:
|
|
sudo systemctl restart php7.2-fpm |
CHECK NGINX SYNTAX: sudo nginx -t
RESTART NGINX: sudo systemctl restart nginx
OPEN IT: http://localhost/phpinfo.php (NEED TO CLEAR THE BROWSER CACHE FIRST)