sudo service nginx restart
sudo service php-fpm restart
sudo service php-fpm restart
if (count($array) == count($array, COUNT_RECURSIVE))
{
echo 'array is not multidimensional';
}
else
{
echo 'array is multidimensional';
}
$(document).keyup(function(e) { if (e.keyCode == 27) { some_code_here } // esc });
http://api.jquery.com/event.preventdefault/$( "a" ).click(function( event ) {
event.preventDefault();});
window.parent.location.href= "http://www.google.com";
order deny,allow
deny from all
allow from 111.222.333.444
find /path/to/folder -type d -exec chmod 755 {} \;
find
/path/to/folder
-type f -exec chmod 644 {} \;
find /path/to/base/dir -type d -exec chmod 755 {} +
find /path/to/base/dir -type f -exec chmod 644 {} +
chmod -R u+rwX,go+rX,go-w /path
The important thing to note here is that X acts differently to x - the man page says The execute/search bits if the file is a directory or any of the execute/search bits are set in the original (unmodified) mode. In other words, chmod u+X on a file won't set the execute bit; and g+X will only set it if it's already set for the user. <Directory /usr/local/httpd/htdocs>
FileETag MTime Size
</Directory>"
var sum = 0;
var arr = [ 1, 2, 3, 4, 5 ];
$.each( arr, function( index, value ){
sum += value;
});
arr={'key1': 'value1','key2':'value2'};
the_value = array['key2']
arr['key3']='value3';
$.each( arr, function( index, value ){
sum += value;
});
**
* You first need to create a formatting function to pad numbers to two digits…
**/
function twoDigits(d) {
if(0 <= d && d < 10) return "0" + d.toString();
if(-10 < d && d < 0) return "-0" + (-1*d).toString();
return d.toString();
}
/**
* …and then create the method to output the date string as desired.
* Some people hate using prototypes this way, but if you are going
* to apply this to more than one Date object, having it as a prototype
* makes sense.
**/
Date.prototype.toMysqlFormat = function() {
return this.getUTCFullYear() + "-" + twoDigits(1 + this.getUTCMonth()) + "-" + twoDigits(this.getUTCDate()) + " " + twoDigits(this.getUTCHours()) + ":" + twoDigits(this.getUTCMinutes()) + ":" + twoDigits(this.getUTCSeconds());
};
add_action( 'init', 'stop_heartbeat', 1 ); function stop_heartbeat() { global $pagenow; if ( $pagenow != 'post.php' && $pagenow != 'post-new.php' ) wp_deregister_script('heartbeat'); }
server {
listen 80;
server_name www.foo.bar;
location / {
allow my.public.ip.here;
deny all;
}
}
You can have multiple "allow" lines.
http://stackoverflow.com/questions/8438867/how-can-i-allow-access-to-a-single-ip-address-via-nginx-conf
The following php commands will do a 301 redirect when using PHP FPM
header('Status: 301 Moved Permanently', true);
header('Location: ' . $url); // or header('Location: ' . $url, true, 301);
http://stackoverflow.com/questions/5268454/php-301-redirect-impossible
server {
server_name example.com www.example.com;
rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last;
In the same file, in the php section:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
Putting the same rewrite rule in the location /moodle section does not work.
If you are using the cpXstack plugin for cPanel, make sure you follow this:
For any domain that has nginX+PHP-FPM enabled, additional nginX configuration can be added by the root user at
Changes made any where else may not be preserved during server shut down.