Question

I am trying to use Openshift for the first time to host a php site(PHP 5.4 cartridge) I am working on for a school project. I followed the directions here to push my existing repo to my gear, and can see that the code is on the gear by ssh-ing into the gear. What do I have to do now to host the website? I initially thought that I would just be able to see the index.php in my repo, but when I go to the provided url it is just a blank page. I think I may need to use the deploy action hook to cp the git repo somewhere, but not sure where. Any help would be appreciated.

Was it helpful?

Solution 2

I did not read the documentation clearly enough. The root for the app is yourApp/php. So your repository has to have a php subdirectory inside of it, and that will be the app root. There is no need to copy your code from the repository to the root. As you have the correct structure, when you push your code the website will be live.

OTHER TIPS

With the PHP 5.4 cartridge the application root is the root of your application directory. Let me try and explain a bit further. If you create an application named "myphpapp" with the following command:

$> rhc app create myphpapp php-5.4

After the application is created, the git repository will be cloned to the directory you ran the create command. Change to that directory:

$> cd myphpapp

This is your application www root directory and is where you need to place files. For example, create a new test.php file like this:

$> echo "some php code" >> test.php

Add the file to your local git repository and then commit and push to your openshift server:

$> git add test.php $> git commit -am "Adding a new file" $> git push

When you run the git push command, the changes will be pushed to the remote git repository on the openshift server. Once the code is pushed, a hook on the server will see that a new file has been added to the repo and then deploy it to the www root on the openshift server. Once the deploy has finished, you can access the file by pointing to:

http://yourApp-yourDomain.rhcloud.com/test.php

Hope that helps.

-- gs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top