This is the official writeup for the biteme room on TryHackMe, it is the first challenge I created and also my first writeup, feedback is appreciated.
When I started Tweet the Tube it was a small PHP application triggered by a cron job.
This had been fine for years, until I decided to ditch my hosting provider as it was costing me $20 per month.
I knew that I wanted to move into AWS, but running a nano EC2 instance would still cost me $5 per month. Not a lot of money but still more than I wanted to pay for such a small application.
Then I found out that AWS Lambda had a free tier. Better yet it meant no servers to manage. Seemed like a win-win to me!
I am delighted to announce version 2.0 of Flintstone has now been released.
unload methods and the
replace method is no longer public
getFile method has been removed
When building an API it is common for people to just grab stuff from the database and pass it to
json_encode(). The problem with this approach is that it can quickly lead to inconsistent output - for example when a database table schema changes.
A data transformer acts as the middle-man between the data fetched and what is output to ensure consistency. Think of it as a view layer for your data. Below is a transformer class and example that you can extend to write your own transformers.
A colleague recently came to me with this issue that worked fine in their browser, but not on the command line:
Warning: include(../config.php): failed to open stream: No such file or directory
This warning appeared because of the current working directory.
When accessing this script via the browser, Apache found the correct path to the file and so '../' was relative to it's own directory.
However by running it from a command line...
The current working directory was actually wherever the user is in the file system of the server.
In which case they could do:
Better yet, they could use the
__DIR__ magic constant in PHP which returns the directory of the file itself.
If you ever need to figure out the current working directory, you can use the nifty function getcwd().