Archive for the “PHP” Category

This is just one of the many articles I’ve had on the back burner for months and I simply forgot about it. But a question today made me remember about it, so here it is. This is simply a test script for mysql, that will allow you to verify several things; Available open connections for Mysql or to verify if Mysql is simply down. All you have to do is create a test page with the following;

<?php
$link = mysql_connect(‘<server>’, ‘<username>’, ‘<password>’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
echo ‘Connected successfully’;
mysql_select_db(<database>);
?>

Make sure you replace the server, username, password and database variables with your own. Save it and make it web access via  a URL. The script will either give you a blank screen if there is no available connections or if there are available connections it will state “Connected Sucessfully”. You can change that to whatever you wish to if the default “good” message is to bland, to say “All Go” or something more hip, I guess.

Its useful if you want to monitor your mysql remotely or if you have a monitoring service that checks for the text to show. If it sees the text missing, the monitor will error out and then we know there is a problem Houston.

That’s it.

Tags: ,

Comments No Comments »

EasyApache is a pre configured script that allows you to easily update Apache Web server through WHM or SSH.
In this tutorial we will show you how to update apache using SSH /scripts/easyapache.

Requirements:
Root SSH access to your server

Login as root through SSH.
1) Login to your server and su - to root.

Run EasyApache
2) /scripts/easyapache
3) Now once you are logged in and have ran the script, you will be presented with an option to choose a profile. Seeing that this is your first time (or not) you will want to choose “Start customizing based on profile” and hit enter. You move by using the arrow keys and using the space bar or mouse to choose and option if you need to fill one out (later in the tutorial).

easyapache11

4) Your next screen will to choose what version of apache you wish to run. Depending on what version of cpanel you are running, your options will be different. In my instance, I am using 11.24, so I have the option for Apache 1.3, 2.0 or 2.2. Your choose will depend on if you need certain features of that version of Apache. However when in doubt, google it my friends. I’ll choose 2.0 for this instance.

easyapache2

5) The next step will to choose what version of php you wish to use. Keep in might that Apache is constantly upgraded, so it’s usually best to go with the newest version.

easyapache3

6) After you choose your php version, you will be presented with what revision you want. Once again, rule of thumb is the newest should be the one you choose, unless your program requires a specific version of php.

easyapache4

7) Now we get to choose several options for apache / php. Assuming that you don’t need frontpage for example, or you do want mod perl or Zend, you would choose what options you need. These are not the final options for apache / php however, this will be done on the next screen. Unlike the other screens where you selected next step to move on, here you can either finish the build by choosing save and build (which will use previous settings) or you can choose exhaustive options list, where you can customize apache /php. Choose the later to continue.

easyapache5

8) Finally, we can choose what options are available for apache / php. This can be several screens long, so make sure you scroll up and down to view all the options. Once you have selected what you need, hit the next step.

easyapache6

9) Now, after choosing all your options, you have the ability to either save the build but not running it or save the build and running it. Once you decide to save and build, this process takes 15-30 minutes to complete. Once it does complete, httpd will restart and the new settings will take place.

easyapache7

That’s it. Take note that you can also run Apache from inside of WHM/CP, but it uses more memory due to the GUI, so t’s recommended to do this via SSH, esspecially if you are on a VPS with less than 512MB of memory or a heavily trafficed server.

Tags: , , ,

Comments 1 Comment »

New Page 1

To install Zend onto a Linux server, its not as complex as it may seem and

its actually pretty easy. To do so, you will first need to SSH onto the linux

server. Once you do this, simply type the following to access the root

directory;

cd /root

Now that you are in the root directly, if you type the following, it will

pull the Zend files over to the servers. This is an install hosted on this blog;

wget

http://keithdmitchell.com/downloads/zend/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

Now that you have this, you are ready to install Zend.

Since the file is in the root directly, you will need to type the following

to start;

tar xvfx ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

Once that is done, you will need to goto the directly that the files are now

located, so type;

cd  ZendOptimizer-3.3.3-linux-glibc23-i386

Once you have changed directory, Make sure the install.sh file has been

created. To do this type this command:

ls -la

If you see the files, you are now ready to follow-up on the install. To start

the install process, type  the following;

./install.sh

This will start the install process and prompt you using a setup wizard. Make

you sure read and accept the license agreement (otherwise you will not be able

to install zend).

By default, zend will install to /usr/local/zend or

/usr/local/zend/etc. When it asks you if you are using a webserver,

enter yes, as you are using apache web server.

It will ask for your location of the php.ini file on your server. Depending
on

your OS and if you are running a control panel, it will end up being a different

location.

.

If you aren’t sure, then quit the install and type;

locate php.ini

This will attempt to locate the php.ini file for you. Zend will

attempt to locate it on the install process, but if it can’t, then you will need

to find the file.

Next it will ask if you are using Apache web server. Answer yes

as you are.

It will then ask for the apache control utility directory, Zend will locate
this for you.

Zend will then install, verify the install and then ask to restart the
webserver,

which you will need it to do.

Once this is done, the Zend optimizer is installed.

Congrats! You have now installed  Zend Optimizer v3.3.3.  If

you have a php test page, this will also now show;

Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

Tags: , ,

Comments No Comments »

I recently ran into an issue where I would update the Cpanel instance using the:

/scripts/upcp –force

To update Cpanel, as I normally do. However I noticed that when I did it this time, It did not update MySQL. Thinking that’s fine, I’ll just check the MySQL 5.0 button in Main >> Server Configuration >> Tweak Settings. However the option to update to version 5.0 was not there…. This was puzzling indeed.

I then ran /scripts/mysqlup –force . That didn’t help either, version 4 was still there and no sign of version 5. I then tried to see what rpm’s where in place;

rpm -qa | grep My

Nothing but MySQL 4……. Still at a complete loss.

Then I finally looked at the config file for cpanel;

/var/cpanel/cpanel.config

Look at that:

maxemailsperhour=0
maxmem=128
myname=cpaneld
mysql-version=5.1
mysqldebug=0
nativessl=1
nobodyspam=0
nouserbackupwarn=0

MySQL 5.1????????? Changing this to 5.0 and then running the /scripts/mysqlup --force
command fixed this issue. I now can select MySQL 5.0 by going to  Main >> Server Configuration >>
Tweak Settings.

Looks like the new update of Cpanel has borked the MySQL install.

Tags: ,

Comments 1 Comment »

If you already have Yum (if you don’t, you can do so by following this link – http://www.keithdmitchell.com/archives/43)  installed on your linux server (dedicated or VPS) you can install Ion-Cube by doing the following;

Log into the server via SSH.

Once prompted, type the following: ” yum install php-ioncube-loader”

This will then start the installation process. Once this has completed, you will need to restart apache for it to take affect. Now you can review the changes by viewing the php info page. If you don’t have one, you can make one by going to a web accessible directory and creating the file with the following text;

“<? phpinfo(); ?>

IonCube should show up as an additional module now.

Comments 1 Comment »