How to add classic ads (banners) manually

Sometimes a restrictive ‘mod_security’ configuration prevents you from creating banners in PHP Melody.

That’s when you need to roll up your sleeves and add banners the old fashion way (or change hosting providers).

Let’s start by adding banners in the already defined ad zones (e.g. header, floating ads, video page, etc.).

Here are all the template files which already have defined ‘ad zones’.


In any of these files you will find one or more instances of the following code snippet (where X is a number):


To add your banners, replace all instances of {$ad_X} with your own HTML code.

To get a complete list of existing ‘ad zones’ log into your PHP Melody back-end and browse to the following page, as illustrated below:

screenshot-demo phpmelody com 2014-11-25 12-23-28

If you still need help with this, you can always get in touch with our customer support.

Can’t add any ‘classic ads’. Internal Error 500.

If creating or saving ads in PHP Melody returns an ‘Internal Error 500’ message, your hosting provider has a restrictive ‘mod_security’ configuration.

There are several things which you can do to fix circumvent this problem.

Option 1

Call or live chat with your hosting provider and ask them to disable ‘mod_security’ for your hosting account. GoDaddy is known not to help in this case and simply play dumb. You’ll be wasting your time with them on this issue. Other hosting providers are more helpful and cooperative.

Option 2

Try disabling ‘mod_security’ yourself via .htaccess.

Open .htaccess and add these lines at the end of the file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

Or in some cases this might also work:

<IfModule mod_env.c>

Note: this method will not work with mod_security2 or on GoDaddy accounts.

Option 3

If you have your own server you can edit your ‘mod_security’ config file and white-list some PHP Melody files.

Locate and open your mod_security config file. In this case, the config file was found at: /usr/local/apache/conf/modsec2/whitelist.conf

Add the following lines:

<LocationMatch "/admin/ad_manager.php">
SecRuleRemoveById 300015 300016 300017
<LocationMatch "/admin/admin-ajax.php">
SecRuleRemoveById 300015 300016 300017
<LocationMatch "/admin/prerollstatic_ad_manager.php">
SecRuleRemoveById 300015 300016 300017

Option 4

If everything fails, you can quickly insert the ads code via phpMyAdmin. Browse to your PHP Melody database, select the ‘pm_ads’ table and in the ‘code’ field of your desired ad zone add the HTML code provided by your ad partner.

You can also add banners manually by editing your theme files.

Good luck!