Skip to main content

Posts

Does storing large sessions slow down response time and server

I am in the process of creating a Facebook App for my website which includes functionality that requires the users friends list. Retrieving the friends is no problem, what I am struggling to decide, is how to store them. Option 1 - Store the users in my MySQL database, I have opted not to go for this as my database will become very heavy, very quickly. In addition, I will need to create a table for each individual Facebook user! Option 2 - Store the Facebook friends array in a session which is updated every half an hour to ensure new friends are included. Ignore the fact that the session updates every half an hour, is it a bad idea to store, what can be a very large array, within a session? The website is likely to be receiving high volumes of traffic, and will therefore be storing a lot of these sessions. Although I am an experienced developer, I am not overly experienced with sessions in these circumstances. I would simply like to know whether or not this i

what this error is due to session_start

My hosting sent me email saying I have set the session.save_path = /home/users/web/b1475/moo.youraccount/cgi-bin/tmp for your account then i found my website is giving me this error Warning: session_start() [function.session-start]: open(/home/users/web/b1475/moo.youraccount/cgi-bin/tmp/sess_718a8cd346244df6916f016eb315f19f, O_RDWR) failed: No such file or directory (2) in /hermes/waloraweb006/b1475/moo.youraccount/db.php on line 4 and the db.php code is (it is database connection file) <?PHP $conn = mysql_connect($host, $user, $pass); if ($conn) mysql_select_db($db, $conn); session_start(); ?> what can i do then to fix this error :(

process PHP on hitting URL & configuring PHP

For my website, I want one of my PHP script to be executed on entering on URL before loading the page(before entering into my site, on hitting enter first this has to be executed), could you suggest me how. Secondly, I've configured PHP ini in localhost in order to include URL & fopen but how can I do changes on the server, am using filezilla on windows.

PHP cURL timeout is not working

I'm having a server issue. I'm running a local server (for developing) and I've changed my local server from MAMP to XAMPP. However, on XAMPP, the cURL option CURLOPT_TIMEOUT_MS or CURLOPT_CONNECTTIMEOUT_MS gives me the next error: Warning: curl_setopt() expects parameter 2 to be long, string given Is this because of the PHP or cURL version? Maybe a configuration setting? curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT_MS, 2500); Additional information: OSX 10.6.8 PHP 5.3.1 cURL 7.19.7 Thanks in advance. Edit: There seems to be some confusion about the error and the variable to set. The error states that parameter 2 is invalid. Not parameter 3 . So the CURLOPT_CONNECTTIMEOUT_MS seems to be the issue. curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT_MS, 2500); ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ parameter: #1 #2 #3 Fun fact: var_dump(CURLOPT_CONNECTTIMEOUT_MS); displays string(25) &

Backup MySql Database?

I have asked this question before but I haven't got an answer, so I'm rephrasing it. I want to back up a db using either: system("mysqldump -h DB_HOST -u DB_USER -p DB_PASS logindb > $location/$backup"); or: sql="BACKUP my_db TO DISK my_backup_folder WITH FORMAT #"; if ($stmt = $this->connect->prepare($sql)) { $stmt->execute(); $stmt->close(); } else { $error = true; $message['error'] = true; $message['message'] = CANNOT_PREPARE_DATABASE_CONNECTION_MESSAGE; return json_encode($message); } But the first gives me an empty sql file and the second gives me nothing. Why is that, and if there is a way to find out what error occurred how would I do it ? Also which method is better ?

Multi-Dimensional array count in PHP

I have a multi-dimentional array set up as follows array() { ["type1"] => array() { ["ticket1"] => array(9) { // ticket details here } ["ticket2"] => array(10) { // ticket details here } ["ticket3"] => array(9) { // ticket details here } } ["type2"] => array() { ["ticket1"] => array(9) { // ticket details here } ["ticket2"] => array(10) { // ticket details here } ["ticket3"] => array(9) { // ticket details here } } } etc. I am trying to get a count of the total number of tickets in the array (number of second level items), but the number of types is variable as are the number of fields that each ticket has, so I cannot use COUNT_RECURSIVE and maths

YAML internationalization

I'm working in a big project.I'm thinking of a new idea to create the best way of internacianalization to many languages. Solutions: 1.Store data as arrays - tree file system.. It's not a good way because i need to modify files "on air". 2.I18n table.All translations have a common table or relative tables.(Queries to database + database cache) 3.YAML(it's new for me) I am reading about YAMl documentation and I like this structure..I suggest the 3rd solution. I would like to hear your opinions/suggestions. Thank you in advance.