I've created a PHP app on heroku, and I installed the sendgrid-php submodule. However, when I try to push it, this occurs:
$ git push heroku
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
-----> Git submodules detected, installing
Submodule 'sendgrid-php' (https://github.com/sendgrid/sendgrid-php) registered for path 'sendgrid-php'
warning: templates not found /app/vendor/share/git-core/templates
Initialized empty Git repository in /tmp/build_wfcgkfb0p50x/sendgrid-php/.git/
fatal: reference is not a tree: 3f145137608a98b09eb01d447ff9d31d161ef2a2
Unable to checkout '3f145137608a98b09eb01d447ff9d31d161ef2a2' in submodule path 'sendgrid-php'
! Heroku push rejected, Submodule install failed with exit code 1
To git#heroku.com:gausschain.git
! [remote rejected] master -> master (pre-receive hook declined)
I've also configured the SendGrid addon for Heroku. Any ideas as to how I can resolve this?
That means in actual submodule
SHA1 - 3f145137608a98b09eb01d447ff9d31d161ef2a2
has not been pushed yet. but in .gitmodules file this SHA is recorded on that specific branch
It sounds to me like you're actually doing something wrong. The recommended way to install the SendGrid PHP library is using composer. You should have a look at the README for details on doing that.
There is a PHP Heroku Buildpack that has composer support. Here is a tutorial to get you started:
http://cloud.dzone.com/articles/using-composer-manage
Related
I'm trying to run the vc_build.bat file.
But I always get the following:
Build Type: DEBUG
Clean Build: 1
Target Architecture: 64
Test Configuration: 0
Visual Studio: 2015
C/C++ Driver
Use Boost Atomic: 0
PHP Executable
PHP Version: php-5.6.22
ZTS: 1
Cleaning build directory ... done.
Cloning Library Dependencies
Update cpp-driver submodule ... done.
Cloning MPIR 2.7.2 ... done.
Cloning PHP php-5.6.22 ... done.
Building Library Dependencies
The system cannot find the path specified.
Building and installing cpp-driver ... FAILED
See ...php-driver-master\ext\\build\log\cpp-driver.log for more details
If I look in that file then I find the following error:
The process cannot access the file because it is being used by another process.
Update cpp-driver submodule ... The process cannot access the file because it is being used by another process.
I just clone the https://github.com/datastax/php-driver at my D:somefolder on windows 10 pc. After that it's working fine for me.
I've created my own site on my local computer and it works wonderfully. I'm having tons of fun developing with it. But when it came time to move it to my server and test I ran into issue.
I'm using the FOSUserBundle. Obviously being a Git of it's own, when I did a git commit and push, git ignored everything in vendor/friendsofsymfony/user-bundle. So when I cloned to my server, the folder came empty, and of course now my site doesn't work.
I want to do this the right way. So if it means destroying the git repo and doing it a different way, I'm ok with that.
So far I've tried.
Following the original install instructions for FOSUserBundle
Running the following:
composer update friendsofsymfony/user-bundle
composer install friendsofsymfony/user-bundle
Both return "nothing to update/install"
I've also tried clearing composer's cache between each command attempt.
rm -rf ~/.composer/cache
Answer is in the comments. Ignore vendor/ use composer to install the appropriate files.
also this Symfony project cloned with git vendors not installed
What it sounds like your trying to do is create a mywebsite parent repo within which you have a third party child repo that has the FOSUserBundle code. This uses git submodules and requires related submodule commands like git submodule init.
The ... directory is there, but empty. You must run two commands: git submodule init to initialize your local configuration file, and git submodule update to fetch all the data from that project and check out the appropriate commit listed in your superproject...
I don't know anything about composer. Here is how you could do it with git.
cd mywebsite
git init
git submodule add <url-to-FOSUserBundle-repo>
You should now have a directory structure like this:
mywebsite
.git
.gitmodules
FOSUserBunder
.git
See also http://git-scm.com/book/en/v2/Git-Tools-Submodules
I've added a MySQL cartridge to a install and can see the environment variables when running php through the CLI interface..
php -r 'echo $_SERVER["OPENSHIFT_MYSQL_DB_HOST"];'
// 127.2.234.2
However when calling the same variable through the web interface the variable is not set. I've restarted both apache and the entire app through rhc app restart
Related:
https://stackoverflow.com/questions/24434922/apache-on-openshift-undefine-environment-variables
You have been told not to hard code the IP Address as it will change.
eg https://developers.openshift.com/en/managing-environment-variables.html
But when you run your script on your website the IP Address is missing.
<?php
print(getenv('PHPRC'));
print('<p>');
print(getenv('OPENSHIFT_MYSQL_DB_HOST'));
?>
You get this. The IP Address is Missing.
/var/lib/openshift/xxf1b5b94382ec898b00xxxx/php/configuration/etc/php.ini
Instead of
/var/lib/openshift/xxf1b5b94382ec898b00xxxx/php/configuration/etc/php.ini
127.5.nnn.nnn
This may be because you have not used Git to push files onto your server.
You may have been like me (a luddite?) and preferred sftp for my simple website.
Steps needed - if you are not familiar with git
Look on your OpenShift website, the Applications tab, Source Code
ssh://xxf1b5b94382ec898b00xxxx#xxxx-xxxxx.rhcloud.com/~/git/php.git/
This assumes you have git installed locally.
This takes a copy of your OpenShift git repository off the server and puts it on your local machine.
git clone ssh://xxf1b5b94382ec898b00xxxx#pappname.rhcloud.com/~/git/php.git/
Cloning into 'php'...
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 19 (delta 2), reused 19 (delta 2)
Receiving objects: 100% (19/19), 18.17 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2/2), done.
Checking connectivity... done.
copy a few files into php subfolder it has created on your local machine
$ git add .
$ git commit -m "A change to my application"]
$ git push
This will restart your application and mysql.
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 2.80 KiB | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Stopping PHP 5.4 cartridge (Apache+mod_php)
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Stopping MySQL 5.5 cartridge
remote: Stopping PHPMyAdmin cartridge
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Building git ref 'master', commit 092cd25
remote: Checking .openshift/pear.txt for PEAR dependency...
remote: Preparing build for deployment
remote: Deployment id is e7791836
remote: Activating deployment
remote: Starting MySQL 5.5 cartridge
remote: Starting PHPMyAdmin cartridge
remote: Starting PHP 5.4 cartridge (Apache+mod_php)
remote: Application directory "/" selected as DocumentRoot
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
Now your environment variable will work correctly.
Yes, sftp is probably quicker.
The problem
I'm trying to build my application in Jenkins, and it is on a private repo on Github, also there's a private submodule.
I can clone the private repository in Jenkins by setting up it's credentials, but Jenkins can't clone the submodule, here's the output of a failed build:
Started by an SCM change
Building in workspace /var/lib/jenkins/jobs/Project/workspace
Fetching changes from the remote Git repository
Fetching upstream changes from git#github.com:user/repogit
using GIT_SSH to set credentials
Checking out Revision 9cc99b67cc676d0ea8ccd489a8327f5c6dbb8d7f (origin/branch)
[workspace] $ /bin/sh -xe /tmp/hudson2710403018107019432.sh
+ git submodule update --init --recursive
Initialized empty Git repository in /var/lib/jenkins/jobs/repository/submodule/.git/
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Clone of 'git#github.com:user/submodule.git' into submodule path 'repository/submodule/' failed
Build step 'Execute shell' marked build as failure
Discard old builds...
#156 is removed because status FAILURE is not to be kept
Publishing Clover coverage report...
No Clover report will be published due to a Build Failure
Sending e-mails to:
Finished: FAILURE
Here's what I've tried to do in Jenkins
Tried to set the Additional behavior "Advanced sub-module behavior", with no success.
Tried to set up a new step before running the tests with phpunit:
git submodule update --init --recursive
Tried to set a git repository on the project of my submodule too, not just the main repository that is being tested, no luck too.
All of them causes the error that says that Jenkins can't find the repository of the submodule.
Any ideas of how can I solve this?
(The username, paths and repositories are correct, I've just changed them to post here)
Solved. In my credential I was using a direct SSH key (option "Enter directly"), instead of putting into a file.
I've just put the keys (public and private) in ~/.ssh, and changed my credentials to the option "From the Jenkins master ~/.ssh".
The problem was that the submodule wasn't using the credential that I've specified to the main repository, it was trying to use the default ssh key (.ssh/id_rsa).
Another solution is to pass -i my_key to the git submodule step (only need this if your key isn't in the default path (~/.ssh/id_rsa) )
Also don't forget to give the correct permissions to your keys, in my case I had to:
chown apache ~/.ssh/id_rsa*
chmod 700 ~/.ssh/id_rsa*
I am trying to push my php app to Heroku and get the below error.
Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected.
I have read through all the previous posts which said that the PHP app should have a index.php in the root folder...which i do. When i do a "git ls-files" i get the index.php listed (with the name in lowercase).
steps i have performed so far are.
1. i have an application created on Heroku - stack:Cedar
2. git add the relevant files
3. git commit with a comment
4. git push heroku master -- this guy gives me the error.
git ls-files lists a file "index.php".
What am i missing this time?
I'm just starting out with Heroku and was encountering the same problem. Below is a description of what I did wrong.
Procfile
Make sure that the following statement is included in your Procfile:
web: vendor/bin/heroku-php-apache2 path/to/web/
Where path/to/web/ is the relative path to the directory that you want to publicly expose on the web. Make sure that the public directory contains an index.php file (e.g. path/to/web/index.php).
composer.json
In your composer.json directory (which should be in the base directory of the repository) make sure to include the Heroku PHP buildpack.
{
"require": {
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
If this statement was missing, then run composer update (./composer.phar update for me, because I downloaded composer and placed it in the base directory of my repository) so that Composer will fetch the package and install it into your vendor directory.
the issue was with an incorrect/incomplete .git directory. Deleting the old one and recreating it (git init) solved the problem.
try to run this on you heroku toolbelt
> heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
> git add .
> git git commit -am "add composer.json for PHP app detection"
> git push / git push heroku master