Skip to content

Tag: php

php Setting background image randomly from folder

I am trying to randomly set the background image of a webpage from a folder via PHP. I have the following code: Note: the printing of the files is just to ensure I reach that point in code and to see what the files are called. I found a similar question here: Random Background Image PHP but when I used

PHP load json data, output is empty

I try to load data from my JSON file into php see my code below JSON: PHP: If I run this code my output is empty. Who can help me in the right direction? Answer Your JSON input is NOT valid according to RFC 4627 (JSON specification). So the correct json string must be: so your code would work: Or

php7 fpm sock file ownership on service restart

I have just installed PHP7 https://github.com/kasparsd/php-7-debian Everything works except each time I do service php7-fpm restart I need manually to set ownership on file /run/php7-fpm.sock to www-data After setting the permissions everything works.. But how to avoid this on every restart? The ownership is …

Datetime to Timestamp in milliseconds in PHP

I would like to create a timestamp in milliseconds from the input ‘2016-03-22 14:30’. Also the timezone specified should be Australia/Sydney. I’ve tried different approaches but none seem to be working. Can anyone help me please? I’m really struggling with that. Answer Pretty self expl…