Board index   FAQ   Search  
Register  Login
Board index PHP PHP Installation

[1] configuring PHP and MySQL in a WWW webserver

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

[1] configuring PHP and MySQL in a WWW webserver

Postby d.shankar » Mon Nov 07, 2005 8:01 am

Thanks for visiting my topic.

I have to configure PHP and MySQL in my site.

PHP scripts are working just fine but i want to establish a connection with the MySQL database but i can't find the php.ini file..

can someone help me ? please
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby ruturajv » Mon Nov 07, 2005 8:11 pm

why do you need php.ini ?
directly try to establish connection using mysql_connect
and keep error_reporting(E_ALL)
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby d.shankar » Mon Nov 07, 2005 9:25 pm

no not like that...

i have to set the session.savepath location to my webfolder location also.. some configurations are to be done in php.ini file ..

can u help me again
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby gesf » Mon Nov 07, 2005 11:09 pm

I bet you don't have access to the php.ini.
Use PHP's ini_set() function.
Ex.:
Code: Select all
<?php

ini_set('session.name', 'sid');
ini_set('session.cache_expire', 0);
ini_set('session.save_handler', 'user');
ini_set('session.save_path', 'sessions_table');

?>
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby d.shankar » Tue Nov 08, 2005 5:28 am

Thankyou Mr.Mod for replying to my query.

But where should i add these snippet.

I have a lot of PHP files more than 40.. also i am unable to proceed anything further because of this criteria.

My website control panel is very tricky to understand.I don't know where to add the files..

however,PHP scripts are workin fine but i don't know how to configure it with MySQL.

In my home system.. I use easyPHP and I have Mysql DB

this is my connect.php file

<?php
$db_host="localhost";
$db_user="root";
$db_pass="admin";
$connect=mysql_connect($db_host, $db_user, $db_pass) or
die("Couldn't establish connection.....");
?>

I will run my file as..

http://127.0.0.1/connect.php

it just works fine.. but in this real-time WWW server i am unable to link it


Please reply sir....
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby gesf » Tue Nov 08, 2005 5:40 am

Like having your connect.php, you can have some config.php which you'll include in every file... at first in the code.
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby d.shankar » Tue Nov 08, 2005 6:32 am

Thanks for mentioning it.

My website name is http://www.2xceed.net/

now what i have to add the host,username,password in the connect.php file.

Any idea ??
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby ruturajv » Thu Nov 10, 2005 8:00 pm

the ini_set params which gesf gave you , need to be put before you do session_start
so if you have a common session-init.php, put it in that file before you do session_start.
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby gesf » Fri Nov 11, 2005 3:03 am

That's it! Thanks ruturajv... i forgot to mention that!
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby d.shankar » Sat Nov 12, 2005 2:08 pm

Thanks guys .

Also i need a small clarification..

I have used sessions for user and how to expire a session (automatically) when the user closes the browser window without logging out.

Please help me again.
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby gesf » Sat Nov 12, 2005 4:18 pm

By default a session ends when the user closes the browser.
That is given to you by session.cookie_lifetime (defaults to 0).
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby ruturajv » Sun Nov 13, 2005 8:07 pm

there is also a session garbage collection probability, check that out

http://in.php.net/manual/en/ref.session.php

--------------------------------------------------------------------------
session.gc_probability integer
session.gc_probability in conjunction with session.gc_divisor is used to manage probability that the gc (garbage collection) routine is started. Defaults to 1. See session.gc_divisor for details.

session.gc_divisor integer
session.gc_divisor coupled with session.gc_probability defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request. session.gc_divisor defaults to 100.

session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and cleaned up.

Note: If different scripts have different values of session.gc_maxlifetime but shares the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path.

Note: If you are using the default file-based session handler, your filesystem must keep track of access times (atime). Windows FAT does not so you will have to come up with another way to handle garbage collecting your session if you are stuck with a FAT filesystem or any other filesystem where atime tracking is not available. Since PHP 4.2.3 it has used mtime (modified date) instead of atime. So, you won't have problems with filesystems where atime tracking is not available.
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby d.shankar » Sun Nov 13, 2005 11:35 pm

thank you guys i will check this out and come back again.
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby d.shankar » Mon Nov 14, 2005 1:48 am

My mailfunction is not working this is the code any problem in it please reply...

<?php
$mailTo="xxx@xxx.net";
$subject="Testing Mail() From PHP";
$contents="zzzzzzzz";
$mailFrom="yyy@yyy.net";
mail($mailTo,$subject,$contents,$mailFrom);
?>
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am


Return to PHP Installation

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.