Bluemix + PHP Buildpack errors pushing a Laravel Application

304 views
Skip to first unread message

brian...@gmail.com

unread,
Apr 7, 2015, 10:34:03 AM4/7/15
to vcap...@cloudfoundry.org
Hello,

I am not sure if this is quite where I should be posting this issue but wondering if anyone can help me. I am trying to create an application using the Laravel framework and push it to IBM's development platform, Bluemix. I have found some useful stuff from the links below:

I am using the cloud foundry buildpack https://github.com/cloudfoundry/php-buildpack which is the same one used in both the CodeIgniter and Laravel demo's. My issue is that when I try to push my application (following the exact steps from the Laravel Demo Walkthrough) I end up with an error stating (full printout will be listed below):

2015-04-07T15:25:26.66+0100 [STG/0]      ERR   Could not scan for classes inside
 "database" which does not appear to be a file nor a folder

Whereas there is quite clearly a folder there (see bottom of post).

I have put a question on the developer forum on bluemix https://developer.ibm.com/answers/questions/184161/problem-pushing-laravel-framework-php-onto-bluemix/?smartspace=bluemix but I am wondering whether this is simply that the buildpack isn't designed to work for Laravel? And if not, will it be?

Daniel Mikusa

unread,
Apr 7, 2015, 11:54:37 AM4/7/15
to vcap...@cloudfoundry.org
On Tue, Apr 7, 2015 at 10:34 AM, <brian...@gmail.com> wrote:
Hello,

I am not sure if this is quite where I should be posting this issue but wondering if anyone can help me. I am trying to create an application using the Laravel framework and push it to IBM's development platform, Bluemix. I have found some useful stuff from the links below:

I am using the cloud foundry buildpack https://github.com/cloudfoundry/php-buildpack which is the same one used in both the CodeIgniter and Laravel demo's.

The demo walkthrough seems to reference https://github.com/pivotal-cf-experimental/cf-buildpack-php.git which redirects to the legacy PHP build pack.  The two build packs are sufficiently different that this could cause problems. See my next comment.

My issue is that when I try to push my application (following the exact steps from the Laravel Demo Walkthrough) I end up with an error stating (full printout will be listed below):

2015-04-07T15:25:26.66+0100 [STG/0]      ERR   Could not scan for classes inside
 "database" which does not appear to be a file nor a folder

The new PHP build pack has a slightly different file layout than the legacy build pack.  This could be what is causing the scan to fail (i.e. it's not looking in the right place).  I'd suggest running `cf files` to look at the file structure on the server to determine the proper path to scan.

Also, be careful if you're using relative paths.  The current working directory is generally /home/vcap/app, but I can't guarantee it will always be that path.  If possible, set full paths or use the "$HOME" environment variable which will always point to /home/vcap/app.


Whereas there is quite clearly a folder there (see bottom of post).

Look at the folder structure on the server with `cf files`.  It may be different.  The build pack reserves the right to move files around so that they are in the correct location for use by the the server software (PHP/HHVM & HTTPD/Nginx).

As a side note, you can prevent the build pack from needing to move files around by including an "htdocs" folder or by setting the WEBDIR option in `.bp-config/options.json` to the name of an existing folder (i.e. "public" or "html").
 

I have put a question on the developer forum on bluemix https://developer.ibm.com/answers/questions/184161/problem-pushing-laravel-framework-php-onto-bluemix/?smartspace=bluemix but I am wondering whether this is simply that the buildpack isn't designed to work for Laravel? And if not, will it be?

It should work fine with Laravel.  I recall talking to someone who uses that and he had it working OK.

Dan

 

--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/583b4802-b4f6-4232-9f9f-7f068ac544cc%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Brian Say

unread,
Apr 7, 2015, 2:56:41 PM4/7/15
to vcap...@cloudfoundry.org
Hi Dan,

Thanks for the quick reply. I'd have a few follow up questions if I can pick your brain a little as I'm afraid I'm new to the whole cloud world with buildpacks etc.

You mention to try cf files, however I'm not sure that will work until I am able to deploy an application onto Bluemix and that won't work yet? So not sure this is something I can do - unless I'm missing something?

I'm equally new to Laravel so not sure what you mean by using relative paths and a home working directory etc. You say to set the full paths to $HOME but I'm not sure where you are saying to reference that?

Not sure if you know whether I'd set in the options.json file to public with Laravel (I believe  that's correct).

This is definitely stretching your time far from the original question so no problem if you can't reply to these, your response has been very useful so hopefully I can use that to fix my issues.

Thanks for the quick reply again, I really appreciate it. You've just helped a noob-hopeful-developer-to-be.

Brian Say

Placement Year Address:
6 Blandford Road
Leamington Spa
Warwickshire
CV32 6BH
Work Email
: bria...@uk.ibm.com
Mobile: 07769557199

--
You received this message because you are subscribed to a topic in the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/CAAqVxAzBLWEEahoDre5qHxSo8LJ89hsxaG3yCRyJ34375%3DMHCQ%40mail.gmail.com.

Daniel Mikusa

unread,
Apr 7, 2015, 3:47:45 PM4/7/15
to vcap...@cloudfoundry.org
On Tue, Apr 7, 2015 at 2:56 PM, Brian Say <brian...@gmail.com> wrote:
Hi Dan,

Thanks for the quick reply. I'd have a few follow up questions if I can pick your brain a little as I'm afraid I'm new to the whole cloud world with buildpacks etc.

You mention to try cf files, however I'm not sure that will work until I am able to deploy an application onto Bluemix and that won't work yet? So not sure this is something I can do - unless I'm missing something?

You're correct.  You can't run `cf files` on an app that's not running because there's no container with files to examine.  You'd need to modify your project so that whatever step which is failing, probably some post install task run by Composer, does not run.  With that Composer should succeed and so your app should start.  You can then checkout the files.  You probably won't have a working app, assuming the failing command is important, but it'll let you poke around and see where the files are located.
 
I'm equally new to Laravel so not sure what you mean by using relative paths and a home working directory etc. You say to set the full paths to $HOME but I'm not sure where you are saying to reference that?

This was more of a general reference.  Let's say that you need to run a  command like `run-db-migrations path/to/migration/files`, my comment was just to say that you should run something like `run-db-migrations /home/vcap/app/path/to/migrations` or `run-db-migrations $HOME/path/to/migrations`, assuming $HOME will be replaced correctly.

I'm not a Laravel user either, so I can't say exactly how this would affect the demo.
 

Not sure if you know whether I'd set in the options.json file to public with Laravel (I believe  that's correct).

From your screen shot in the original email, that looks to be correct.  Again, I'm not familiar with Laravel so I can't say for sure.  It should generally point to the root of your static files and likely where the entry point to the app (perhaps an index.php file?) is located.
 
Dan

Reply all
Reply to author
Forward
0 new messages