FINE TUNE PHP_MYSQL_APACHE

This time I will configure and assume some things about PHP, MySQL

and Apache.

Assumptions:

A #1: You have installed PHP, MySQL and Apache, all of them

prepared (but no configured) in order to work with each other.

So, let’s configure ‘em.

C#1: Check out if php is loaded in Apache:

LoadModule php5_module  $PATH_TO/PHP/php5apache.dll

C#2: Check in php.ini, what should you check?, the existence
of the line above: 

mysql.default_socket = /var/mysql/mysql.sock

WARNING! Here I'd some troubles, because of the location of my
mysql.sock, almost for anybody, mysql.sock must be in /tmp.
But, don't obey every time everybody, because it didn't work
for us. So, type "mysqladmin version", then you will obtain
an echo where you'll see where is mysql.sock, in that way you
will put the correct path in php.ini

At the end, you can test: (example from w3c School)

<?php
 $con = mysql_connect("localhost","peter","abc123");
 if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

 if (mysql_query("CREATE DATABASE my_db",$con))
 {
 echo "Database created";
 }
 else
 {
 echo "Error creating database: " . mysql_error();
 }

 mysql_close($con);
 ?>
Advertisement

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.