PHP Warning: include(): realpath failed to canonicalize

Warning

I was getting the following warnings when I was running Magento shell scripts from the command line using PHP CLI (PHP Command Line Interface).


PHP Warning:  include(): realpath failed to canonicalize Mage/Core/Model/App.php - bailing in /var/www/magentoproject/lib/Varien/Autoload.php on line 93

PHP Warning:  include(): realpath failed to canonicalize Varien/Event/Collection.php - bailing in /var/www/magentoproject/lib/Varien/Autoload.php on line 93

PHP Warning:  include(): realpath failed to canonicalize Varien/Event/Observer/Collection.php - bailing in /var/www/magentoproject/lib/Varien/Autoload.php on line 93

To remove this warning I started debugging Magento code but no success. Then I googled and came across various posts/forums saying that it was possibly due to APC.

Continue reading »

How to include a file in a bash shell script

Linux

I had written few shell scripts for a project. All these scripts were using some common configuration parameters so I decided to put them in a common file and include it in the scripts file so that when I move the script files from the development to the production environment, I have to change the values in only one file.

My configuration file “config.conf” contained variables like:

DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=testuser
DB_PASS=test123

Continue reading »

How to enable binary logging in MySql?

MySql

To enable binary logging open the MySql configuration file my.cnf /my.ini and add the following line to the end of [mysqld] section and restart the server:

log_bin=base_name

Lets say base_name is given as ‘mysql-bin’.

This will write the binary log files in the MySql data directory. Mysql appends a numeric extension to the binary log basename to generate binary log file names. The number increases each time the server creates a new log file, thus creating an ordered series of files.

Continue reading »

How to reset Magento admin password?

Password

In case you have forgot your Magento admin password and need to reset it then you can use the forgot password link provided in the login screen or you can directly reset it in the database.

On the “Forgot your password” screen enter admin user email address and click “Retrieve Password” button, an email will be sent with link to reset your password.

Continue reading »

How to remove index.php from url in magento?

http

Magento uses the Front Controller pattern, all of its page request go through a single entry point index.php. If you prefer to hide the “index.php” part in the URLs you need to enable web server rewrites in Magento admin.

A URL like “http://www.testmagento.com/electronics/cell-phones.html” is much more user friendly than “http://www.testmagento.com/index.php/electronics/cell-phones.html”, it also hides the fact that the page displayed is a PHP page so hiding “index.php” in URLs is good for security purpose. Hiding “index.php” does not affect website performance in any way neither it affects search engine rankings.

Continue reading »

How to enable “Magento Profiler” and use it to identify Magento Performance bottlenecks

Optimize Performance

Magneto comes with a very useful debugging tool for developers called “Profiler”. It can be used to identify issues in your code making the website slow. The Magento “Profiler” reports the time taken by block of code under test to execute, the number of times the block of code executed and the memory used by it while rendering a Magento web page.

By default Magento Profiler is disabled, let see how to enable it.

How to enable “Profiler” in Magento?

To enable “Profiler” in Magento, you have to go through 2 parts:

Part A

1) Go to Admin >> System >> Configuration.

2) Under the “Advanced” tab, click the “Developer” link to open the developer section.

3) Now expand the “Debug” block and select “Yes” in the Profiler dropdown.

4) If you are debugging in a live environment then its better to restrict the profiler output display to the developers only so that customers browsing your website do not see any differences on the frontend. To do so expand the “Developer Client Restrictions” block and add the developer IPs comma separated in the text box provided.

5) Save the configuration.

Continue reading »

13 Linux wget command usage examples

Download using wget

Wget is a computer software package for retrieving content from web servers using HTTP, HTTPS and FTP protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc. Its features include recursive download, conversion of links for offline viewing of local HTML, and support for proxies.

Lets have a look at some examples of using wget:

1. Download a webpage


$ wget http://www.examplewebsite.com/

2. Download a file from ftp server


$ wget ftp://ftp.examplewebsite.com/source-code.tar.gz

If you specify a directory, Wget will retrieve the directory listing, parse it and convert it to html


$ wget ftp://ftp.examplewebsite.com/

Continue reading »

Magento Admin – “This account is locked.”, how to unlock it?

Magento Admin Locked

In Magento Enterprise Edition a security feature has been implemented which allows you to set the number of failed login attempts after which your account will get locked.

To make these security setting go to  Admin >> System > Configuration, click the Admin tab in the left column, and select the Security section.

Continue reading »

Magento: After “Use Web Server Rewrite” is set to yes, home page loads but other pages give 404 error.

404 Error

To remove index.php from the Urls in Magento, I enabled web server rewrites from Magento admin. I cleared the Magento cache and refreshed the home page. The home page loaded well and index.php was removed from all the links on home page but when I clicked link on any home page it gave me 404 error.  If I added index.php to the page URL in browser manually it loaded well. I had Apache running on Ubuntu.

Continue reading »

How to disable modules in Magento?

Magento

It is advised to disable unused modules in Magento for website optimization. Also while troubleshooting issues we can temporarily disable module(s) to see which module(s) is/are causing the issues.

Let see how we can disable the modules in Magento:

1. Login to Magento admin and go to Admin >> System >> Configuration. On the left hand side click on the Advanced section under Advanced tab.

Continue reading »

Back to top