PHP $_SERVER[‘HTTP_HOST’] vs. $_SERVER[‘SERVER_NAME’], am I understanding the man pages correctly?

I did a lot of searching and also read the PHP $_SERVER docs. Do I have this right regarding which to use for my PHP scripts for simple link definitions used throughout my site? $_SERVER[‘SERVER_NAME’] is based on your web server’s config file (Apache2 in my case), and varies depending on a few directives: (1) … Read more

What are the disadvantages of using persistent connection in PDO

In PDO, a connection can be made persistent using the PDO::ATTR_PERSISTENT attribute. According to the php manual – Persistent connections are not closed at the end of the script, but are cached and re-used when another script requests a connection using the same credentials. The persistent connection cache allows you to avoid the overhead of … Read more

Unicode character in PHP string

This question looks embarrassingly simple, but I haven’t been able to find an answer. What is the PHP equivalent to the following C# line of code? string str = “\u1000″; This sample creates a string with a single Unicode character whose “Unicode numeric value” is 1000 in hexadecimal (4096 in decimal). That is, in PHP, … Read more

Nginx serves .php files as downloads, instead of executing them

I am installing a website in a droplet (Digital Ocean). I have a issue for install NGINX with PHP properly. I did a tutorial but when I try to run some .php file it’s just downloading it… for example… it’s working but… If I go to the main it’s downloading my index.php … Read more