This is short Note for Laravel framework get goal with this configuration – Xdebug by EC2 instance on AWS with Load Balancer – Linux Server Ubuntu with Apache and Git
You should do settings only one server before Amazon Load Balancer and open and redirect any queries from local machine to EC2 server IP address.
- Redirect any queries your domain name from your local PC to IP – ONE EC2 instance with installed xdebug (USE SSH and your hosts file in local OS)
- Install xdebug on your server and configuration it in config file and .htaccess file do separate settings individual specific domain
- PHPStorm must have true settings with remote to this remote server use ssh tunnel with folders mapping your local machine
- Don’t forgot about your Git on local PC must be same as your remote server every time! It’s well strategy for debugging without exception on Laravel and watch your backend scope!!!
Mini notes for this short instruction:
$ php -v
Console command does show info about your operation system, php version and xdubug module on your server if you don’t have xdebug than
$ apt-get install blah-blah or yum and etc (I mean xdebug)
Standard install xdebug module
You need configuration xdebug server in files for ubuntu by path /etc/php/7.2/mods-available/xdebug.ini You should remember only one line – We are disable remote mode for any domains – xdebug.remote_enable = 0 and comment ;xdebug.remote_connect_back = 1 or mast have 0
Another lines you do any want
Example:
zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_enable = 0
;xdebug.remote_connect_back = 1
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
;xdebug.remote_handler = dbgp
;xdebug.remote_mode = req
;xdebug.profiler_enable=0
;xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log=”/var/log/xdebug/xdebug.log”
.htaccess main directory for your domain where you need debug must add option with enable remote mode. I mean must have – php_flag xdebug.remote_enable on
## Enable .htaccess!!!
php_flag xdebug.remote_enable on
#php_value xdebug.remote_host “your_ip_without_quotes”
#php_value xdebug.remote_port 9000
#php_value xdebug.idekey PHPSTORM
php_flag xdebug.remote_autostart on
AND YOU MUST TURN your local xdebug port 9000 to remote server xdebug port 9000 from local console
I use MacOS then I had done this command:
ssh -R 9000:localhost:9000 j@t-jo.com
or if you use ssh key
ssh -R 9000:localhost:9000 -vv -i ~/.ssh/id_rsa_myssh my-login@my-domain.com
PHPStorm good video instruction with setting remote ssh and mapping folders