atineoSE
atineoSE

Reputation: 4117

Deploy simple PHP website to Swisscom Application Cloud: how to configure the server?

I am trying to deploy a simple PHP website to the Swisscom Application Cloud, based on cloud foundry.

My website is working fine locally, served by Apache.

I have followed the tutorial, but I am not clear on some aspects.

In the tutorial, the way to check if the app is working normally is to run it in the built-in web server in php through php -S. This doesn't work for me because my website has html extensions for php files and these are not interpreted correctly by the built-in server. In Apache, I can configure that just fine in the httpd.conf file, but here I don't know how to configure such a behaviour.

That's fine by me, because I can still check the website locally serving via Apache. The problem is that it looks that in the cloud this is the way to run the app as well, although I couldn't find more info in the documentation.

I'd be surprised that this is how the app is run in production because the php documentation states the following about the built-in server:

"It is not intended to be a full-featured web server. It should not be used on a public network."

Are the web apps being run on Apache in the Swisscom Application Cloud? If yes, how do I get access to configure the httpd.conf and php.ini files? If no, how can I configure the special behavior I need for my app?

UPDATE:

Here is a sample php app which summarizes what I am trying to achieve: deploy it in cloud foundry interpreting html files as php files.

https://github.com/atineoSE/sample-php-app-cloudfoundry

Following @daniel-mikusa 's links to documentation I added special config related to the mime types under .bp-config/httpd/extra/httpd-mime.conf. This doesn't work as expected, though. Accessing from firefox, I am prompted to download the file. It works fine when I serve it locally via Apache with the same directive in the httpd.conf file.

Upvotes: 1

Views: 173

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

The PHP build pack does not use php -s. I suppose that you could, but it's not the default. The default setup is to use PHP-FPM & Apache HTTPD, or ou can optionally use PHP-FPM w/Nginx.

For the most part, the PHP build pack should just run your app. There are occasionally things you need to adjust, and they are easily configurable by adding .bp-config/options.json to the root of your app.

I don't know anything about your app though, so I can't really say. If you can't get what you need with options.json you can customize the configuration for HTTPD, Nginx or PHP too. Check out the docs here for instructions to do that.

http://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html#engine-configurations

Hope that helps!

Upvotes: 5

Related Questions