I myself used webhook quite often.
The path you use to access the .php file is incorrect. This path should apply to your DocumentRoot apache (e.g. / var / www / html)
say your DocumentRoot is / var / www / html, and then put the bitbucket-hook.php file in this path (e.g. / var / www / html / bitbucket-hook.php) and use the URL as http: // ip .ip.ip.ip / bitbucket-hook.php
Alternatively, you can make a virtual host that points to / (root) and use http: //ip.ip.ip.ip/home/ {username} /application/deployment/BitBucket-hook.php
NOTE. You also need to add your .ssh folder with the private key to / var / www, since when you start the web cache then apache will find the key in its home folder ie / var / www.
Here is the part of my bash that I wrote for autodeploy
`
echo "implenting the web hook for auto deployment..." if ! [[ -d /var/www/.ssh ]]; then sudo cp -R ~/.ssh /var/www/ if [[ \$? == 0 ]];then echo -e 'copied ~/.ssh to document root to apache [/var/www]\n' else echo -e 'something went wrong while copying ~/.ssh to /var/www\n' fi else echo "Already a folder name .ssh in /var/www" fi sudo chown -R apache. /var/www/.ssh 2>&1 if [[ \$? == 0 ]];then echo -e 'ownership of /var/www/.ssh has changed to apache \n' else echo -e 'something went wrong while changing ownership of /var/www/.ssh\n' fi pushd /var/www/html touch auto_pull.php sudo chown apache. auto_pull.php echo -e "<?php content to write in php file ?>">>auto_pull.php popd
`
Hope this helps :)
source share