php

PHP-MySQLi connection randomly fails with "Cannot assign requested address"

Since about 2 weeks I'm dealing with one of the weirdest problems in LAMP stack. Long story short randomly connection to MySQL server is failing with error message: Warning: mysqli::real_connect(): (HY000/2002): Cannot assign requested address in .. The MySQL is on different "box", hosted at Rackspace Cloud Today we downgraded it's v...

How to get a message in a variable if the page contains an error?

Hi While we run an web application some page may contain error and some page maynot contain error, I want to get a notification if the page contains some error ,If there is an error we can see the error in the page, but can we set any value to a variable if the page contains error.. such that we can get the notification that there i...

how to check port 1129 is enabled or not ?

hi I am using the fistdata global api, i got the sample code in php. when i run taht code i got an error message Failure could not connect I want to know is port 1129 is enable or not in my site. How this possible? Please help me.. Thanks in advance ...

Element '{http://www...}ResponseDetails': The type definition is abstract

Got following error when validating xml response against the xsd. What does this excactly means? ...

PHP, Apache & Oracle setup

Hi, We are planning to develop a web application on PHP & Oracle (11gR2) on Apache and the OS is RedHat AS5 update 3 (AS5.3) Linux. I would like to know the recommended versions of PHP and Apache to be used for such a setup. I have come to know that PHP and Oracle offer the best performance when Apache is running in prefork mode. In ...

Convert large JSON file to MySQL

I have a ~1MB JSON file that needs to be converted to MySQL. The file has close to 400 records. What is the best way to do this using PHP ? If i try to add 400 records in a single pass, I either get the memory or execution time error. Whats the best way around this ? ...

PHP constants with local scope.

In PHP is it possible to have constants with local scope? Is yes please provide a small example. ...

Why to have "build/" folder with PHP project and phing

What is a benefit of having "build/" folder where all the sources will be placed and "built"? Maybe it's a silly question, but I'm trying to understand Continuous Integration with PHP. Any example of build.xml for phing uses such build/ folder, but what's a sense in that for PHP where a checked out project doesn't require a compilation,...

number increment with customized style

Hi all, I've tried to do a number(decimal) increment which looks like 001 002 003...123,124 in a loop and couldn't find a simple solution.What I've thought now is to check out whether the number is long enough ,if not prefix it some "0".But it seems not good.Any better ideas? Thanks. ...

problem image uploading in new created website in magento

i have created a new website in magento name sunilrawat(folder).now when i am trying to upload any image for any product description the image uploaded defaultly in the media folder in magento root.uploaded image by me unable to search that path...it show the path.localhost//magento/sunilrawat/media//.thumbs/a.jpg but the actual image ge...

php query is not running??

$query="select * from fsb_profile where fsb_profile.profile_id=('select fsb_friendlist.friendlist_friendid from fsb_friendlist where friendlist_memberid='".$id."'')"; $sql=mysql_query($query); while ($t = mysql_fetch_assoc($sql)) { echo "hai"; echo $t["profile_name"]; } this code in not running why? error:- Warning: mysql...

PHP: Timer for formular input

I am coding a web based exam application in PHP. The examinee has to choose a set of modules with the according questions. A module is represented as one-single-formular. For each module he got for example 30 minutes. I will achive that if the 30 minutes are over, the state of the form (answered and unanswered questions will be store...

PHP Sessions - User not stored after login.

I am building a basic password protected area on my website and I have a login form. <!-- login.php --> <?php session_start(); ?> <?php if(!empty($_SESSION['user'])) { ?> <form> <input type="text" name="username" /> <input type = "password" name = "password" /> <input type="submit" value = "login" /> <input type="hidden"...

Converting an array with 50,000+ entries into a mysql database.

Ok, so I am helping someone with their site. Their original coder thought it would be a great idea to put their entire database in an array. I am looping through each piece of data in the array and inserting it into a new mysql table I created, the rows are getting inserted just fine but the problem is that php wont let my script execut...

Sessions getting mixed up PHP

Hi we have been operating a system for about 500 users online on one centralized dedicated server. Our application is coded in PHP. Recently when we have a reasonable load of about 100 -150 users sessions start getting mixed up. For instance if a user logins as A after a while his session switches to User B who is also logged in. The sys...

PHP regex query

Consider the snippet: var_dump(preg_split("/./", "A.B.C")); // split on anything as the dot has not been escaped which produces the output: array(6) { [0]=> string(0) "" [1]=> string(0) "" [2]=> string(0) "" [3]=> string(0) "" [4]=> string(0) "" [5]=> string(0) "" } Can anyone please explain how it works? Al...

How to install php 5.3.2 on debian from the command line?

Hi, i want to upgrade my php version on debian from the command line. Anyone knows how to do it? ...

Session is getting overwritten in php

Hi, I am facing a problem that my session is getting overwritten by other logged-in user in php. when we have a reasonable load of about 50 -100 users sessions start getting mixed up. For instance if a user logins as A after a while his session switches to User B who is also logged in. The system has been in operation for over a year a...

Can't insert to database in wordpress

I tried to insert values to database table in wordpress, but it is showing some errors as below [type] => 2048 [message] => is_a(): Deprecated. Please use the instanceof operator [file] => /var/www/html/workbench/Shinod/wordpress/wp-includes/classes.php [line] => 724 Can anyone help me? ...

PHP & do/while loop memory leaking

I have a do/while loop that goes over database rows. Because it runs many days at the time processing 100000s of rows, memory consumption is important to keep in check or it will crash. Right now every iteration adds about 4kb to script's memory usage. I'm using memory_get_usage() to monitor the usage. I unset every variable used in the...