best way to debug CI |
Hi,
I am starting out in CI and wondering what is the best way to debug CI ?
@admin0,
You just asked an open ended question (You will receive many different answers). There are many ways to debug CI (it is a PHP framework after all). It depends on the developer and what they are comfortable with. I prefer a combination of Xdebug and Firefox Developer Tools (netbeans as my IDE). I also have a development and production copy of the software as well. This helps me to recreate the issue and solve it in DEV before pushing it to PROD. P.S. CI also has built in features to assist in debugging as well. A Profiler and Logging just to name a few.
Use echo exit
Use CodeIgniter's Profiler Use XDEBUG Use break points on and on and on... What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
sorry .. should have been specific...
so i developed code in my mac using MAMP. 3.1.9 with HMVC plugin .. works fine, everything runs as usual. mamp env: apache + php (osx) Then i wanted to shift my work to the server to test. env: nginx + php (fedora, no selinux) i copy the whole code and database. db connection is fine... no errors anywhere .. the /welcome runs fine however, all my hmvc modules ( applicaiton/modules/x) -- they give a 404 so localhost/test1/ localhost/test1/hello etc -- none of these work .. i just get a 404 with nothing in the error logs. I bumped up the error level in the config to 4. this is in my nginx conf location ~ \.php$ { try_files $uri $uri/ /index.php?/$request_uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/home/site/private/php7-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTP_PROXY ""; fastcgi_index index.php; include fastcgi_params; } I aleady have this: //$config['base_url'] = ''; if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){$ssl_set = "s";} else{$ssl_set = "";} $config['base_url'] = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST']; so it is not due to URL. what i did was to put this inside my applicaiton/modules/test1/controllers/test1.php echo "break"; exit; did not got executed .. then i went in to the do the same in applicaiton/thirdparty/MX/Loader.php in the line just after <?php it also does not got caught.. This leads me to believe that the hmvc plugin that worked plug and play is not even loading in the server. so my question would be .. is there a way to know/figure out what files get loaded in what order, and why in my specific case, the plugin is not being loaded. Thanks
i also did this in the config: ( which was not needeed in local mamp)
$config['modules_locations'] = array(APPPATH.'modules/' => '../modules/'); no luck
i tested on windows and mac -- both case insensitive.
server = case sensitive .. going line by line echo "<pre>"; print_r($var) ; echo "<pre>"; echo "here" ; exit; it helped figure out the issue. filename was not caps
This .htaccess file is from FuelPHP but it solves a lot of server problems, so give it a try.
Code: <IfModule mod_rewrite.c> Enjoy What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I use the FirePHP extension in Firefox. Super convenient, and shows arrays as arrays, objects as objects, etc. I do prefer Firefox 48 for development, because Firebug still works, and Firebug is better than Firefox's developer console logging.
I am using Codelobster IDE for it - http://www.codelobster.com/codeigniter.html
I use phpStorm and xdebug and they work great together. I am debugging in a docker container too, just to make it a little more complex . A few years ago someone up on this forum recommended phpStorm, and I'd say it was one of the best decisions I have ever made. I am an IDE centric guy from way back.
proof that an old dog can learn new tricks
|
Welcome Guest, Not a member yet? Register Sign In |