Category Archives: Best practices

nginx index inside conditional location

Description: On a server that delivers multiple sites, I need to set up the location of a request depending on the host. For example I need to serve different text depending on the site language. Solution: The only problem here … Continue reading

Posted in Best practices, nginx, System | Tagged , | Leave a comment

Change button text value on HTML input type file

Description: Browsers render by default “Choose file” (or similar, depending on browsers and locale settings) when an input of type “file” is detected. Solution: Unfortunately there is no easy solution.  <input type=”file” name=”inputFile” id=”inputFile” /> This is pretty much all … Continue reading

Posted in Best practices | Tagged , , | Leave a comment

Run PHP Compatibility checks for upgrading version

Description: In order to bring the PHP version up to date, we need to run compatibility test on our projects. Solution: The CodeSniffer tool that can be installed on each system gives us the most precise results. Follow the guide … Continue reading

Posted in Best practices, Linux, PhP | Tagged , , , , , | Leave a comment

substr() cuts in the middle of & symbol

Description: In “Read more” segments, you often need to cut the text to a length and add ‘…’ at the end. This can be a bit tricky when the limit falls on a special character. Solution: We can use mb_substr() … Continue reading

Posted in Best practices, PhP | Tagged , , , , | Leave a comment

Load different config files in in WordPress single implementation

Description: Having multiple databases on the same implementation of WordPress, you need to select the proper config file before running a selected script from command line Solution: Just add a parameter that describes the correct config you need, for example … Continue reading

Posted in Best practices, Script, Wordpress | Tagged , , | Leave a comment

Remove the so called Police Virus, or uCash scheme

Description: The “Police Virus” is a trojan or a ransomware that installs on the computer unknowingly, and on the computer power-on it blocks the computer with a rather realistic message, translated in the local language with legal items of the local country/state … Continue reading

Posted in Best practices | Tagged , , , , , , , | Leave a comment

Add line break in PDF generated from HTML without fix width

Description: By creating a PDF from HTML if you use tables and you want the table cells to flow easily not depending on the width of a specific cell, a long text is not broken into multiple lines, but the … Continue reading

Posted in Best practices, PhP | Tagged , , , , , | Leave a comment