In this article I discuss how I got around the PHP issues that resulted from the upgrade to Joomla 4.
After upgrading, I received the following warnings:
Step 1
I checked the system information and the PHP information of my Joomla installation
The system tells me where the PHP ini file is supposed to be but also says that none was loaded? S I need to "shell" into my Joomla install and check the location.
Go to Container station on the NAS and shell into the joomla container ">_"
For Joomla V4: Looking at the php production file in /usr/local/etc/php
Right away - I see the issue, There is no php.ini file there. So the first order of business is to update the php files (eventually to become a php.ini file)
Now we that we know we will need a php.ini being loaded we can move onto the second issue - changing the fields to allow for large file uploads....
Step 2
Look for these value in the php.ini files:
- file_uploads
- upload_max_filesize
- max_input_time
- memory_limit
- max_execution_time (Make sure to up to 512M)!!
- post_max_size
The first one is obvious if you set this off, uploading is disabled for your installation. We will cover the rest of the configuration settings in detail below.
upload_max_filesize and post_max_size
Files are usually POSTed to the webserver in a format known as 'multipart/form-data'. The post_max_size sets the upper limit on the amount of data that a script can accept in this manner. Ideally this value should be larger than the value that you set for upload_max_filesize.
There is no recommended settings for these two directives because it really depends on what you want to allow your users to submit, but it's important to realize that upload_max_filesize is the sum of the sizes of all the files that you are uploading. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include. Since these fields are typically small you can often approximate the upload max size to the post max size.
If you do not have access to php.ini add the below to your .htaccess file in your Joomla root directory and change the values according to your needs:
- php_value upload_max_filesize 10M
- php_value post_max_size 20M
memory_limit
When the PHP engine is handling an incoming POST it needs to keep some of the incoming data in memory. This directive has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.
Important: Make sure to up this to 512M in order to load larger video files...
max_execution_time and max_input_time
These settings define the maximum life time of the script and the time that the script should spend in accepting input. If several mega bytes of data are being transfered max_input_time should be reasonably high.
No VI Editor
Make a copy of the original production php file and edit it. Unfortunately, the Linux for Joomla no longer includes VI editor in /usr/bin ??. So I install a package with a VI Editor.
# apt-get update
# apt-get install vim
Then copy the php.ini-production to create a php.ini file.
Stop and restart the container App
Looking at the System Information and the PHP Settings, you can see that they have now changed
Important: When trying to update files to Joomla - there is a "feature" whereby if you attempted to upload a file and it failed, the system will not allow you to upload the file by the same name. You can either change the filename or clear the cache...
Step 3
To get rid of the tmp directory warning, simply add an entry in the php.ini file to a tmp directory. I created a /home/tmp directory and made it writeable (chmod 777) and entered thi sin the php.ini file (upload_tmp_dir '/home/tmp').
Comments powered by CComment