configure_certain_settings_in_php_ini_ubuntu_22_04_nextcloud_27_0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
configure_certain_settings_in_php_ini_ubuntu_22_04_nextcloud_27_0 [2023/06/21 03:20] – removed - external edit (Unknown date) 127.0.0.1configure_certain_settings_in_php_ini_ubuntu_22_04_nextcloud_27_0 [2023/06/21 18:39] (current) wikiadmin
Line 1: Line 1:
 +====== Configure Certain Settings in php.ini on Ubuntu Server 22.04 for NextCloud 27.0.0 ======
  
 +We need to locate the php.ini file on the Ubuntu Server and then switch to that directory.
 +
 +<code>
 +:~$ cd /etc/php/8.1/apache2/
 +:~$ /etc/php/8.1/apache2/$
 +:~$ /etc/php/8.1/apache2/$ ls
 +:~$ /etc/php/8.1/apache2/$ php.ini
 +</code>
 +
 +Edit php.ini using vim or nano.
 +
 +<code>
 +:~$ vim php.ini 
 +</code> 
 +
 +Within the php.ini file, locate and modify the following settings to read as follows, and enable date.timezone by deleting the leading semicolon ';date.timezone ='
 +
 +<code>
 +memory_limit = 512M
 +upload_max_filesize = 500M
 +post_max_size = 500M
 +max_execution_time = 300
 +date.timezone = America/New_York
 +</code>
 +
 +Here is another author's similar list for making changes.  For the basic nextcloud deployment, change the default options using the following configuration.
 +
 +<code>
 +file_uploads = On
 +allow_url_fopen = On
 +memory_limit = 512M
 +upload_max_filesize = 500M
 +post_max_size = 600M 
 +max_execution_time = 300
 +display_errors = Off
 +date.timezone = Europe/Amsterdam
 +output_buffering = Off
 +</code>
 +
 +Save and close the php.ini file when you are finished. Then, start the Apache and MySql service and enable them to start after system reboot with the following commands:
 +
 +<code>
 +sudo systemctl reload apache2
 +sudo systemctl start apache2
 +sudo systemctl start mysql
 +sudo systemctl enable apache2
 +sudo systemctl enable mysql
 +</code>
 +
 +These commands will run like the following.
 +
 +<code>
 +:~$ sudo systemctl reload apache2
 +[sudo] password for user:
 +        OR
 +:~$ sudo systemctl start apache2
 +
 +:~$ sudo systemctl start mysql
 +:~$ sudo systemctl enable apache2
 +Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
 +Executing: /lib/systemd/systemd-sysv-install enable apache2
 +:~$ sudo systemctl enable mysql
 +Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
 +Executing: /lib/systemd/systemd-sysv-install enable mysql
 +:~$
 +</code>
 +
 +Use Vim to open php.ini again to enable opcache extension and configure its options and behavior.
 +
 +<code>
 +cd /etc/php/8.1/apache2/
 +vim php.ini
 +</code>
 +
 +First, uncomment the 'zend_extension=opcache' option to load the opcache extension. Uncomment means to remove the leading semi-colon ";" at the front of the line containing ';zend_extension=opcache' which will enable this extension in php.
 +
 +<code>
 +Before
 +;zend_extension=opcache
 +
 +After (uncommented)
 +zend_extension=opcache
 +</code>
 +
 +Now, move down to the '[opcache]' section of the php.ini file and add the following configuration.  Basically, just find the appropriate line and uncomment the line by removing the leading ';' semi-colon. You can safely ignore the . . . lines in the code box below.
 +
 +<code>
 +[opcache]
 +...
 +....
 +.....
 +opcache.enable = 1
 +opcache.interned_strings_buffer = 8
 +opcache.max_accelerated_files = 10000
 +opcache.memory_consumption = 128
 +opcache.save_comments = 1
 +opcache.revalidate_freq = 1
 +</code>
 +
 +Press ESC button to exit the INS mode of Vim and save the configuration by entering :w [enter], then exit by entering :q!
 +
 +Now restart the apache service to apply new changes using the command below.
 +
 +<code>
 +sudo systemctl restart apache2
 +</code>