The bash shell is awesome and scripting using a combination of PHP and Bash is a favourite technique of mine.
I want to be able to do it all in Netbeans but if you have the PHP flavour of Netbeans then its missing shell scripting support as standard. To get it to work easily, simply install the C/C++ plugin by going to Tools-Plugins-Available Plugins and ticking the C/C++ box.
It would be great if Netbeans would include bash scripting in with the PHP module so we can keep Netbeans as trim as possible, however this solution gives the desired result so I’m happy enough
Bash scripts are often used to work on files and the current working directory is of paramount importance.
However, you may have scripts that are running in a development environment and also a live environment with different folder setups.
To help with portability and remove the requirement to hard code paths, you can use this little snippet
DIR="$( cd "$( dirname "$0" )" && pwd )"
For example, I have a system all running from a folder with one subfolder called processes (where my scripts are located) and another folder called launcher which actually handles the application.
The processes scripts generally launch a sequence of actions in one go.
Here is how I am using the above snippet
#!/bin/bash DIR="$( cd "$( dirname "$0" )" && pwd )" cd $DIR cd ../launcher pwd ./shellLauncher.php Scraper importCsvFile ./shellLauncher.php Scraper scrapeNewProducts
This script cd’s to the script location first (the processes sub folder) then goes back up the folder structure and into the launcher folder before launching the individual actions that make up this process.
One of the first stumbling blocks newcomers to Magento might find is that when things go wrong, they don’t know how to find out what it is that’s actually going wrong.
This is because Magento does an excellent job of keeping all of the error information away from people browsing the site. This is without a doubt a very good thing. Error messages can often contain information that would help an attacker compromise your system.
What Magento does instead (if you have it enabled) is to log all error information to log files which you can then access via FTP etc to view the error information. This is in much the same way as a well configured web server will not display error information generated by PHP itself but will instead display the “white screen of death” and log the error information to a file.
Magento exceptions can range from minor notices to major issues but not fatal errors. If PHP has a fatal error then this will be handled by PHP itself.
Magento Exception Logging
If you are experiencing errors with Magento, the first thing you need to do is to make sure exception logging is enabled.
In the admin go to:
System-Configuration Developer Log Settings Enabled = Yes
You can also set custom locations for your error log files, though the defaults are normally fine. Make sure the folder is writeable.
Now if you are having errors, you can look in var/log at the exception.log and/or system.log files that have been generated.
Magento Developer Mode
If you are developing locally and you would like to make Magento dump error information to screen instead of logging to a file, this is very easy to do. You simply need to set the site to run in Developer Mode.
The most secure way to do this (in the sense that you won’t accidently set your live store in Developer Mode) is to edit your local apache configuration and add this line:
SetEnv MAGE_IS_DEVELOPER_MODE "true"
You need to set this up in the directory you are running Magento, for example:
<Directory "/opt/lampp/htdocs"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks # XAMPP Options Indexes FollowSymLinks ExecCGI Includes SetEnv MAGE_IS_DEVELOPER_MODE "true"
Now any Magento site you run from within that folder (or any sub folder) will be running in Developer Mode when you are working locally, but will still be in the much more secure normal mode on the live server, without you having to edit any files within Magento itself.
If you prefer, you can add this line to your .htaccess file, or you can edit the index.php file to force Developer Mode however with either of these approaches there is always the risk you will accidently upload this file and set your live store into Developer Mode.
If your site has suddenly gone down and you are tearing your hair out because the people you usually call for server support aren’t answering the phone then fear not – we can help you out.
Along with our core business of building, customising and extending e-commerce web sites, we are also pretty handy at fixing problems when the pressure is on and you need results quickly.
If you are running a PHP/MySQL based web site on a Linux server and its stopped working with Fatal Error or even an empty white screen then get in touch with us.
We appreciate that your e-commerce web site is your business and when the site is down your doors are closed and you are losing money. We can help you to get your doors back open again as quickly as possible.
Get in touch with us on 0844 357 0201 and drop us a contact form
We will support you in your server emergency.
Errors that you might encounter include:
Headers Already Sent
There has been an error processing your request
Error log record number
Its an old battle on forums all over the web – which is better, a hosted solution or hosting your own solution on your own server, based on a platform such as Magento.
Well a recent new development from Magento indicates that this distinction is about to get a lot more blurry.
Magento’s Project Stratus is the next evolution in eCommerce; an on-demand platform more powerful and flexible than any other.
Here is the Full FAQ:
Project Stratus FAQs
What is Magento project Stratus?
Project Stratus is Magento’s next-generation on-demand eCommerce platform. At its core, Stratus is an online version of our award-winning eCommerce platform. Everything you already know and love about the Magento platform is available with this hosted service. Stratus creates more choice for merchants to select the product and platform that best fits their needs. Stratus will empower merchants and developers to customize, modify, extend and integrate a hosted store as if it were their own code running on their own servers … an unprecedented capability in the market today
I did not receive a registration key, how can I request one?
Click on the request an invite key link and complete the request form.
What happens after I apply to join the beta?
The Magento team will review your application. Once you are accepted, you will receive an email with a unique link to complete your registration and activate your account.
How long will the beta program run?
The beta will run into early 2011.
What happens at the end of the beta program?
At the conclusion of the beta program, the service will convert to a generally available, paid-service. Your account/store will automatically convert into a production account.
How is this different from other Magento versions?
This service will provide the same core eCommerce functionality as on-premise versions. However, rather than downloading the software and running it on your own hardware, Magento provides the software to you as a service. You’ll simply log in to your web-based control panel to manage your account and your store.
How much will the service cost once the beta is complete?
Magento is still determining the pricing for the service.
What type of support and SLA do you offer during the beta?
During the Beta period merchants can expect that there will be periods when the site might not be available as we work to improve the offering based upon your feedback. Magento will strive to make sure any outages occur at off-hours and will notify our merchants in case of an expected outage. During the Beta period, merchants will be provided email and phone based support at no additional cost. Once the platform becomes generally available, support will be available on a tiered basis depending upon the needs of our merchants.
Is the Beta PCI compliant
Yes, the beta service is PCI compliant.
If you dig a little deeper into Magento you will notice that there is a fully featured caching system lurking in there. However, as standard, it is quite under utilized.
I’m sure that the primary reason for this is that caching dynamic systems can cause admin user confusion and generally make things trickier. However all the tools are there waiting to be used if you want to push things a bit further.
Pretty much any Magento block can be cached – its great for things like a “best sellers” block or anything else that requires some processing and doesn’t really need to be up to the minute accurate for every page request.
To use block caching for a particular block, you just need to set three properties or methods. Note Magento’s use of Magic methods allows us to mix and match properties and methods easily!
Check this out:
We get asked a lot about optimising Magento performance and the first bit of advice is always to upgrade to the latest version. After that there are all kinds of things that can be done and implementing block caching like this is just one of them.
If you want to discuss optimising your Magento store for more speed and performance without necessarily having to upgrade your hosting environment, get in touch with Edmonds Commerce today!