
Ryan Cole - 2016-04-10 18:58:02 -
In reply to message 1 from Richard Williams
Excellent question. There is a clear performance disadvantage of using SQL as a filesystem, so we should have good reason to use it. Here are a few common reasons to consider using SQLEFS over your native file system.
1. A compelling reason is permission issues. If you are not the server admin, it may be difficult to impossible to setup the ability to write files in PHP created subdirectories. Even if you are the admin, you may not want to do so for security reasons.
2. Security. Writing user submitted files on the native file system introduces a number of security related issues. These can be mitigated, but its not the realm of amateurs. On the other hand, maintaining security and privacy in SQLEFS is very straight forward.
3. Less coding. While SQLEFS does have a CLI, it was largely designed as an application layer interface. SQLEFS allows you to carry out a number of operations in a single line of code that would be several lines of code in using PHP's native file system commands.
4. You use Windows. It's a bad habit, don't do it. That said, SQLEFS will free you from having to migrate your PHP application's file system operations to a Linux file system.
5. Remote management. SQLEFS allows you to connect to any host. So you can easily have a local PHP application manage files generated by a remote servers PHP application. Considering the other ways I know of doing this, I believe it is a huge simplification.
There are also other features planned for SQLEFS that close the performance gap and make it a more powerful. But that is later.
In summary, if your application deals with something like a file manager, I believe SQLEFS is an excellent solution. If you are working with user submitted files, and not very knowledgeable about permissions and security, SQLEFS is the safer/easier path. If you run Windows its worth being familiar with it. If you are creating a network of PHP servers that have some type of file management functions, its may save you a lot of time. However, if your files are pre-populated, such as your website's images, use native files.