php

PHP Mail() function failing

Hi all, Im trying to send an email to multiple addresses, so I wrote function that pulls the emails from the database, and separates each one with a comma, but the mailing part keeps failing. However a similar function as getmails() is working on another page, so I am really lost as to what I am doing wrong. Here is my code, any help wi...

Zend_Search_Lucene crashes during indexing

I wanted to create search engine for my webpage, but during indexing on server it crashes with errors : Warning: opendir(/admin/lucene/) [function.opendir]: failed to open dir: Too many open files in /admin/includes/Zend/Search/Lucene/Storage/Directory/Filesystem.php on line 159 Warning: readdir(): supplied argument is not a valid...

Connect to SQL Server 2008 with PDO

I am trying to connect to SQL Server 2008 (not express) with PHP 5.2.9-2 on Windows XP sp2. I can connect to the remote SQL Server fine from SQL Server Management Studio from the same machine. My first attempt was this: $conn = new PDO("mssql:host={$host};dbname={$db}", $user, $pass); Which gives this error: PHP Fatal error: Unc...

Customizing the style and location of $session->flash's output in CakePHP 1.2

I'm writing a simple web application using CakePHP version 1.2 (the latest) and am having an issue with displaying the flash message from the Session helper. In my layout, there exists the following code: <?php echo $this->renderElement('flash'); ?> Which renders the following element: <?php if($session->check('Message.flash')): ?> ...

PHP DOMDocument : loadHTMLFile choking on a mysterious character: RS

Using php's DOMDocument->LoadHTMLFile('test.html'); keeps on returning an error to me, reporting for an error in the content at line 36. Deleting character after character, it turns out it's an apparently empty space that was the culprit. Copying/pasting that sentence in another editor (Editra), showed a strange RS character. What is i...

What on earth could cause this PHP error? Bug in PHP?

I received the following error: [27-Apr-2009 10:26:06] PHP Fatal error: Cannot redeclare alphanumeric() (previously declared in /home/iddoc/public_html/lib/common.php:6) in /home/iddoc/public_html/lib/common.php on line 8 Notice this: /home/iddoc/public_html/lib/common.php:6) in /home/iddoc/public_html/lib/common.php on line 8 He...

MySQL/PHP connection error, possible user fabrication

I'm in charge of maintaining a learning management system and this is an issue that I've been dealing with on and off over the past few months. A single student (among thousands) is claiming that his essay submissions are being "eaten" by the website. After form submission he says his essay has been replaced by the following text: ...

how to store configurations for php app -- xml or ini or db

I've got an app written in PHP, and there are a number of configurable variables. We're implementing a feature where the user can create sets of configurations and easily switch between them. How should I store my configs? as XML? in a .ini file? in multiple .ini files? in a db? What's going to provide the most flexibility if we add fie...

Problem with rss reading

Hello Everyone, I have a problem with reading an rss feed in my site. When i add an feed to my site I cache it in the database by serializing it and when I do a refresh I unserialize it again from the database if it is within a certain time limit. Else I read again the feed from the remote site. I think the problem has to do with th...

Login into Facebook with PHP script, but let me logged in the browser after the end of this script

Please, I am solving this problem.. I need to login into Facebook or Twitter or any other website from my PHP script running on my server. I am normaly doing that with CURL, saving cookies to some predefined file. But now I need something new.. I need to stay logged in with my browser, even when the script ends the login process. Is that...

Performance differences running PHP under Windows/IIS 7 vs. Linux/Apache?

There is a PHP application right now on a Linux box running under Apache with MySQL. Since we are a windows shop, management wants to get rid of the Linux box and move everything over to windows. Is there a performance difference between the two platforms? Or, is there any significant difference at all, in terms of performance or managem...

PHP simpleXML how to save the file in a formatted way?

I'm trying add some data to an existing XML file using PHP's SimpleXML. The problem is it adds all the data in a single line: <name>blah</name><class>blah</class><area>blah</area> ... And so on. All in a single line. How to introduce line breaks? How do I make it like this? <name>blah</name> <class>blah</class> <area>blah</area> I...

How to get modules to work in the Zend Framework

I'm getting the following error when trying to use a modular layout in my Zend Framework application: Undefined index: authentication in C:\PHP\includes\Zend\Controller\Dispatcher\Standard.php on line 385 The following code runs before this error: if (!$this->_acl->isAllowed($role, $resource, $privilege)) { $request->setModuleName('...

Symfony - How can I insert behaviors in my doctrine migrations ?

Hello everybody ! Is it possible to add behaviors (eg. actAs Timestampable) in a doctrine migration to avoid defining the created_at and updated_at columns ? Thank's in advance ! ...

Why does Xdebug throw an error for a file that's included, not required

I'm running LAMP server on Ubuntu 9.04(Desktop edition). I'm very new to Ubuntu, so I did most of this via the Synaptic Packet Manager. I then removed php5-common and just installed php5 via: apt-get install php5 My error reporting is set to: error_reporting = E_ALL & ~E_NOTICE I installed Xdebug and inserted the following in my php.i...

PHP ignoring __set method inside the class

I'm building a class with a number of input validations, and I've decided to place them inside a __set method (I'm not sure if this is proper form as I have limited OOP experience). This seems to work fine, throwing the proper errors when invalid values are passed from outside the class. However, if a variable is modified inside the clas...

Apache rewrite rule forces download

...

How to cancel ajax request that has run (on server side)

I was wondering if there's a simple way to cancel an AJAX request? Beyond just calling an 'abort' on the XMLHTTPRequest on the client side, is there a way to easily stop the server process? The server is using Apache. Thanks ...

How to do a get and post in php with restful web service server side

Hi can anyone past some code how to do a restful web service get and post method. This would be server side so I would be able to invoke the two services from a client. Thanks! ...

PHP - Delete Item from Hash Table (array) using array_filter

Hi In PHP, I know there is no official way to delete items once they have been put into an array. But there must be a "best-method" solution to my problem. I believe this may lie in the array_filter function. Essentially, I have a shopping cart object that stores items in a hashtable. Imagine you can only ever buy one of any item at a ...