Praj Basnet

Sometimes when you are committing changes in git you’ll find that a number of files have been deleted.

You could manually set these files to delete by individually issuing the command:

git rm filename

However, there is a shortcut. If you issue the command:

git ls-files --deleted

It will return…

--

--

The following command can be used to find and checkout (undo) all files with modifications:

git checkout $(git ls-files -m)

This is effectively an “undo” of all modifications in the given branch (but it doesn’t impact added or deleted files).

--

--

Here’s a list of things you can check if you aren’t getting anything written to the PHP error log on your server:

  • In php.ini, do you have error_reporting set to E_ALL ?
  • In php.ini, do you have log_errors enabled?
  • In php.ini, do you have track_errors enabled?
  • Have you specified a valid file / location for error_log
  • Does the user that starts PHP (e.g apache) have relevant permissions and ownership to write to the PHP error_log file ?
  • Does your application have an override set in .htaccess or php.ini for any of the above?
  • Have you restarted PHP/Apache after making changes for these things to take effect?
  • What does php -i | grep error tell you regarding these settings?

--

--

To see what storage engine is used by the server by default you can use the following command in the MySQL/MariaDB shell:

show variables like '%storage_engine';

You can view a list of supported engines using:

show engines\G;

To find out what storage engine your tables are using by schema use…

--

--

By default on Apache web servers, PHP code will not execute in a file that does not have a .php (or similar) extension. So even though you can embed PHP into a HTML file, it won’t execute when the file extension is .html, .htm etc.

To change this, you can add a .htaccess file to allow PHP execution.

Here are some examples depending on your system:

AddType application/x-httpd-php .html .htm

For certain hosting providers you may need to do this (adjust for PHP version too).

Addhandler application/x-httpd-php5 .html .php

Put this in a file called .htaccess in the same folder as your HTML files.

--

--

For example, on a Mac, you’ll often find .DS_Store files. To find and remove these you can run the following command to search for and remove every instance:

$ find . -type f -name ".DS_Store" -exec rm {} ;

This will find all files (-type f) called .DS_Store and execute the rm (remove) command on that set {}.

Run from the top directory and it will recurse its way into all sub directories and remove the files. This can be a dangerous command so use with caution.

You can also adapt the command to execute something else (e.g. a mv to another location for example.

--

--

--

--