Turn Text into an Image using the PHP GD Library

While developing a site for a client, I needed to figure out a way to convert certain text elements into images. I had no clue how to do this but after doing a bit of research, I discovered a nifty library of functions already available through PHP. The GD library offers tons of cools way to dynamically create PNG, JPEG or GIF files and output them directly to your browser, but you need to make sure that your server has the library enabled.

You can check to see if the GD library available on your server by placing the code: Continue reading

By dbglory Posted in PHP

Virtual Hosts for MAMP

Running a Web server on your desktop computer is a great way to speed up Web site development. By previewing your Web pages directly through a Web server on your own computer you can test out server-side programming like server-side include files, form processing scripts, or database-driven Web pages. However, there’s one problem associated with running a server on your own computer: by default, you only have a single “domain”–http://localhost/–so if you work on more than one Web site you put them all under “localhost” in different directories. This isn’t very real world and can cause problems when using server-side includes and root-relative links. Fortunately there’s a better way.

For information on setting up MAMP, visit the MAMP instructions page.

Continue reading

By dbglory Posted in PHP

CentOS / Redhat Apache mod_ssl Configuration

The mod_ssl module provides strong cryptography for the Apache Web server via the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols. How do I install and configure mod_ssl under CentOS / Fedora / Redhat Enterprise Linux?

mod_ssl is the SSL/TLS module for the Apache HTTP server. You can use self signed certificate or 3rd party SSL certificate. This module provides SSL v2/v3 and TLS v1 support for the Apache HTTP Server. It was contributed by Ralf S. Engeschall based on his mod_ssl project and originally derived from work by Ben Laurie. This module relies on OpenSSL to provide the cryptography engine.

Step #1: Install mod_ssl

Type the following command as the root user to install mod_ssl, enter:
# yum install mod ssl Continue reading

How to Create a SSL Certificate on Apache for Ubuntu 12.04

What the Red Means

The lines that the user needs to enter or customize will be in red in this tutorial!

The rest should mostly be copy-and-pastable.

About SSL Certificates

A SSL certificate is a way to encrypt a site’s information and create a more secure connection. Additionally, the certificate can show the virtual private server’s identification information to site visitors. Certificate Authorities can issue SSL certificates that verify the server’s details while a self-signed certificate has no 3rd party corroboration. Continue reading

How To Upgrade To PHP 5.4 on Ubuntu

I am pretty sure I’ve mentioned  that among my various other duties at work, I manage the network security program as well. One of the things we have to do on a regular basis, which I think all companies should do, is perform frequent penetration tests on our public web servers. It is good to find your holes, and plug them up before the bad guys do. I mean, you hear about it all the time where companies report security breaches where millions of their users credit cards are stolen. If they were performing regular scans, they may have been able to prevent that. Continue reading

Question: Why can I not access phpMyAdmin via my browser? (After installing phpMyAdmin)

  1. Check you directory permissions.
  2. Check /var/log/audit/audit.log for any denials.
  3. Make sure in “/etc/httpd/conf.d/phpmyadmin.conf” you have commented out the following two line and appended “Allow from”

#Order Allow,Deny
#Deny from all 
Allow from

and then restart httpd.

service httpd restart

Source: http://wtuto.com/redhat/phpmyadmin-rc5.html
By dbglory Posted in PHP

How to Install and Secure phpMyAdmin on Ubuntu 12.04

About phpMyAdmin

phpMyAdmin is an free web software to work with MySQL on the web—it provides a convenient visual front end to the MySQL capabilities.


The steps in this tutorial require the user to have root privileges on your virtual private server. You can see how to set that up here in steps 3 and 4.

Before working with phpMyAdmin you need to have LAMP installed on your server. If you don’t have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up hereContinue reading

By dbglory Posted in PHP

Simple Single Sign-On for PHP (Ajax compatible)

Associated websites often share user information, so a visitor only has to register once and can use that username and password for all sites. A good example for this is Google. You can use you google account for GMail, Blogger, iGoogle, google code, etc. This is nice, but it would be even nicer if logging in for GMail would mean I’m also logged in for the other websites. For that you need to implement single sign-on (SSO). Continue reading

By dbglory Posted in PHP

CORS on Apache

Apache can be configured to expose this header using mod_headers, this is enabled by default in Apache however you may want to ensure it’s enabled by running the following command:

a2enmod headers

To expose the header, you simply add the following line inside either the <Directory>, <Location>, <Files> or <VirtualHost> sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file:

Header set Access-Control-Allow-Origin "*" Continue reading 
By dbglory Posted in PHP

Configure Apache To Accept Cross-Site XMLHttpRequests on Ubuntu

Update: check out this for more up-to-date instructions: http://enable-cors.org/server_apache.html

1. Make sure you have the mod_headers Apache module installed. to do this check out /etc/apache2/mods-enabled/ and see if there’s a ‘headers.load’ in there. If there isn’t then just sudo ln -s /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load Continue reading

By dbglory Posted in PHP