Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP app breaks when deployed with Git, works fine if deployed via sftp
    text
    copied!<p>I have a simple PHP app that I developed locally in MAMP. I did use a few Composer packages. It works perfectly on my local machine. When I deploy the website using Beanstalk App (not AWS Beanstalk, I'm referring to Beanstalk the Git hosting and deployment service) it throws an error once the first class name is referenced in the code. </p> <pre><code>Fatal error: Class 'User' not found in /srv/www/example.com/public_html/utilities/authenticate.php on line 8 </code></pre> <p>This class is specific to an ActiveRecord Model class for accessing the database. In the code it looks like this:</p> <pre><code>$user_row = User::find_by_email($theuser); </code></pre> <p>Very simple and works in my local development environment. ActiveRecord is autoloaded by Composer.</p> <p>I then tried deploying the app via sftp to my Centos VPS and to my surprise the error went away and the app works as expected. My best guess was that Beanstalk was somehow corrupting the app during deployment. So to test that theory, I setup a bare Git repo on the server and used a post-receive hook to checkout the repo into the public Apache folder. This resulted in the same error I experienced with Beanstalk. It seems the problem is associated with git deployment. I checked that the files had the standard 644 permissions and that folders are set to 755. Apache owns the public folder so ownership isn't the problem either. I'm truly at a loss for why this is occurring. Any wisdom on the matter is greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload