php

How do I displaying details of a PHP internal server error?

I have installed a PHP application onto a shared hosting web server. I am getting a 500 Internal Server Error. I don't seem to have access to any log files so I would like the error page to temporarily give details of the error. I know how to do this in ASP.Net but I am not that familiar with PHP. ...

Kohana Auth module can't login

For those familiar with the Auth module in Kohana, I can't login a user. I can create a user fine, but apparently the hashes aren't matching. I've used the provide MySql schema to create the db and I'm using the the modules models. Here's my create a user code: public function user_create() { $user = ORM::factory('user'); $us...

php riddle - interesting result

I have the following code: <?php $cups = array(); for($i=0; $i<500; $i++){ $cups[$i] = 0; } for($x=1; $x<500; $x++){ for($y=$x; $y<500; $y+=$x){ $cups[$y] = !$cups[$y]; } } foreach($cups as $key => $value){ if($value == 1){ echo "{$key}, "; } } ?> As you can see, I fill up an array with 500 zeroes, lo...

PHP Command-line scripts are ignoring php.ini and ini_set('memory_limit',...) directives.

Hello, I am facing the common "Fatal error: Out of memory (allocated 30408704) (tried to allocate 24 bytes)..." PHP Fatal error. Pages served via Apache are not exhibiting this behavior. I've tried the following: Increasing the memory_limit in php.ini to a much larger value. Increasing memory_limit within the script itself via calls t...

percentage-based string comparison in php

Hi, I'm looking for a library in PHP that will allow me to compare two strings, and determine if they similar. For example: apple apple 100% apple aple 80% and so forth. any ideas? ...

phpMyAdmin for SQLite 3

Is there a good PHP client for SQLite 3 databases? I'm looking for something like phpMyAdmin of SQLBuddy that allows me to manage SQLite 3 databases, preferably one that uses the PDO (pdo_sqlite) driver. ...

How to mimic Dabble Color Schemes?

How would you develop something similar to what is described in this DabbleDB blog post? ...

some quick help with this small piece of code...

How come when I echo $p, the variable which Im trying to fetch using this loop doesnt get displayed in the path. $name_image2="picture.jpg"; for ($i=2; $i<=$nr_of_pics; $i++){ $img='name_image'.$i; echo $$img; gives me this: 'picture.jpg' which is correct. but when echoing $p like this: $p="/SV/main/temp_images/$$img"; echo $...

Access of Non-Static Function of a Class in PHP

Why is this legal in PHP? <?php class Foo { public function test() { echo "hello\n"; } } Foo::test(); ?> test() is a non-static function but I can access it without an instance. ...

Magento Debugging Environment

I looked for ideas on setting up a Magento development environment when we first started using it for our site last year. I didn't find anything that work really well, so I stayed with var_dump'ing using the log files. Now that Magento has another year under its belt and several hundred more developers I was wondering if anyone has fou...

Is there a javascript equivalent of php's urldecode or html_entity_decode()?

I've got an associative array in php that I want to stick into a hidden form input so that I can later get the values in javascript. Because of quoting issues, I need to urlencode the json, or htmlentity it. Once I have the object in javascript, though, what's the easiest way to get it back to plain ol' json? OR is there a better way to...

PHP script unable to find a file when called by a flash program

I'm working on a program right now that calls the script mail.php located in /var/www/vhosts/company/httpdocs. mail.php is trying to execute require_once dirname(__FILE__).'/../pear/Mail.php' to do an smtp send and the require_once is failing. My PEAR directory's located in /var/www/vhosts/company/pear. I then tried to add /var/www/vhost...

How to use sha256 in php5.3.0

Hello, I'm using sha256 to encrypt the password. I can save the sha256 encrypted password in mysql. But i can't login with the same clause. Insert code: <?php error_reporting(E_ALL ^ E_NOTICE); $username = $_POST['uusername']; $passcode = $_POST['ppasscode']; $userflag = $_POST['uuserflag']; //$passcodeen = hash('sha256',$passcode); $...

Authenticating and tracking users in a JSON webservice

Hi All, I have contact management / CRM application used in-house by our company, It is a web based app and thus uses a lot of Ajax. Most of the data is JSON, and the backend server uses PHP with MySQL as the database... I would like to build a mini Adobe Air version of that, mostly because I can use Drag and Drop file uploads, client...

Why is my page still executing?

I have a form that posts to a processing script which checks for errors in the post. Depending on the processing it header redirects to another location. This appeared to work but I have just noticed that is still executing stuff after the header. What is going on? ...

(Probably) Simple SQL Server cursor question

I need to call two stored procedures in sequence via ODBC in PHP: #run stored procedure 1 $query = "Shipped_Not_Shipped_Rep ".$_GET['rep_id']; $result = odbc_exec($dbh, $query); odbc_result_all($result); #run stored procedure 2 $query = "Shipped_Not_Shipped_Account ".$_GET['account_id']; $result = odbc_exec($dbh, $query); odbc_result_a...

Fallback route with Zend Framwork

Hello! I'm having some difficulties while trying to understand the whole zend routing concept. My scenario is to have a fallback controller for my small cms app. I've already implemented my own route class for this. What it does is, similar to module route, to try to check if the module from the given path does exists, if not my cms cont...

How to handle "order" of a list of items in DB (php)

I would like my client to be able to order items in the backend. I figured the easiest way to do it is to have the database table for an item have a field called "order" which gets a value. This is a value the client puts in. Then I can just run SQL queries ordering by the "order" field. Right now I have it very simple.. there is no ...

What are the caveats with increasing max_post_size and upload_max_filesize?

I want to increase max_post_size and upload_max_filesize on my server so that my application will handle larger files (as large as 2gb). But before I do that, what are the caveats? Obviously there was a reason the PHP developers set the size to be low. Will I need a certain amount of RAM for the operation? Any insight would be helpfu...

Caching large number of pages on php site

I'm involved in a project that will end up creating around 10 million new pages on an existing site. The site, and the new project, are built with CodeIgniter and connecting to MySQL. I've never dealt with a site of this size before, and I'm concerned about how we should handle caching. Has anyone dealt with caching on a PHP site of thi...