Can spaces run PHP scripts?

Posted December 20, 2020 874 views
ApachePHPDigitalOcean Spaces

I intend to use spaces as CDN. But I need it also to run a PHP script which would generate minimized js and css files on fly (if they do not exist yet).
How can I achieve this?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi there @webxtor01,

I don’t think that this is possible. Spaces and other Object Storage solutions are meant to store static files like Images, Videos, CSS/HTML files and etc.

You can use Spaces with your PHP application and store your user uploads there for example, but you would still need an actual web server where you would run your PHP logic.

For more information make sure to check out this article here:

Hope that this helps!

by Brian Boucheron
Flexible and scalable data storage is a baseline requirement for most applications and services being developed today. With today's complex deployments, containers, and ephemeral infrastructure, the days of simply saving files to disk on a single server are gone. Cloud providers have developed services to fill the storage needs of modern application deployments, and they mostly fit into two categories: object storage, and block storage.

PHP is generally white space insensitive, meaning that you can space out your code however you want to make your scripts more legible.