PHP Uploads: Difference between revisions

1,179 bytes added ,  10:13, 8 March 2023
no edit summary
No edit summary
Line 1: Line 1:
== What is it? ==
== What is it? ==


In February 2023 for Cumulus MX version 3.24.0 a new PHP upload mechanism was introduced as an alternative to using FTP, FTPS, or SFTP (FTP over SSH).
In March 2023 for Cumulus MX version 3.24.0 a new PHP upload mechanism was introduced as an alternative to using FTP, FTPS, or SFTP (FTP over SSH).


It uses the HTTPS or HTTP protocol for transferring file data. It requires that you have a PHP enabled web server (most are), and that you upload a small PHP file to the root folder of your web site.
It uses the HTTPS or HTTP protocol for transferring file data. It requires that you have a PHP enabled web server (most are), and that you upload a small PHP file to the root folder of your web site.
Line 69: Line 69:
Changing this to ''false'' means the script will be allowed to create files anywhere in server file system that the PHP process has write permissions.
Changing this to ''false'' means the script will be allowed to create files anywhere in server file system that the PHP process has write permissions.


This option should only be used if you are certain you need it, and ideally can restrict the PHP process file system permissions to the areas you want data written.
This option should only be used if you are certain, you need it, and ideally you can restrict the PHP process file system permissions to the areas you want data written.


== Cumulus.ini ==
== Cumulus.ini ==
Line 80: Line 80:
<pre>PHP-URL=<URL>
<pre>PHP-URL=<URL>
PHP-Secret=<key as configured in CMX></pre>
PHP-Secret=<key as configured in CMX></pre>
== Potential Issues - Technical! ==
=== File Permissions ===
On my Linux self-hosting server, I found I had not given the PHP process write permissions on the folders holding my web site. What I did is (and this may not be the best or only method)...
:1. Create a new user group - webwriters - and add my existing user 'pi' and 'www-data' (the user PHP and the web server run under) to that group:
<pre>
> sudo addgroup webwriters
> sudo usermod -a -G webwriters www-data
> sudo usermod -a -G webwriters pi
</pre>
:2. Restart the web server and PHP-FPM to pick up the new group membership
<pre>
> sudo service nginx restart
> sudo service phpN.N-fpm restart
</pre>
:3. Then changed the group associated with the web folder(s)
<pre> > sudo chown -R :webwriters /var/www/mywebsite</pre>
:4. Finally change the permissions for webwriters group on the folder
<pre>
> sudo chmod -R g+rwx /var/www/mywebsite
> sudo chmod -R o-wx,o+r /var/www/mywebsite
</pre>
You can check what user PHP is running under with a simple script...
<code><?php echo `whoami`; ?></code>
Or, you can use the "top" or "htop" command, and look for the service there - check your web server too!




[[Category:CumulusUtils]] [[Category:Cumulus_MX]]
[[Category:CumulusUtils]] [[Category:Cumulus_MX]]