Skip to content

Tag: php

Invoking a PHP script from a MySQL trigger

Is there any way how to invoke a PHP page / function when a record is inserted to a MySQL database table? We don’t have control over the record insertion procedure. Is there a trigger mechanism which can call a PHP script back? Answer The trigger is executed on the MySQL server, not on the PHP one (even…

secure and resume support file downloading with php

I want to give permission to some of my website users to download a specific file. the download needs to be resume support just for user convenience. For that reason it came to my mind to secure the file with this piece of code: the problem is that not only it’s not resume support also it’s gonno …

Mcrypt installed but doesn’t show up on PHPINFO

I think I managed to install mcrypt lib. The files are in place, but it looks like the library doesn’t run at all. Tried to add: to PHP.INI; no good. Any help? Answer Have you tried restarting Apache? It won’t recognise the new installed module until you do so AFAIK. Also, you’ve written you…

How to define an empty object in PHP

with a new array I do this: Is there a similar syntax for an object Answer A comment in the manual sums it up best: stdClass is the default PHP object. stdClass has no properties, methods or parent. It does not support magic methods, and implements no interfaces. When you cast a scalar or array as Object, you…

.htaccess 301 redirect of single page

After a site redesign, I’ve got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form: /contact.php is now: /contact-us.php Using the .htaccess file, I’ve added this line, which is …