php

IMAP enabled, but functions undefined?

One of our email parsing scripts is having a problem using imap functions: Fatal error: Call to undefined function imap_open() IMAP is definitely enabled, it was compiled with the php and shows up in the phpinfo() and when doing get_loaded_extensions() or extension_loaded("imap") Is there any reason why these functions may not be...

Documenting a PHP extension with PHPdoc

I've written a PHP extension in C, and I want to create PHPdoc documentation so that my users will get inline docs in their PHP IDE (in this case, Netbeans) when calling my extension. Ideally I'd like to do this by embedding the PHPdocs in the C code, to keep implementation and documentation together. Assuming it's possible to embed PH...

[mysql&php], what is the first day of a week, Monday or Sunday?

What is the first day of the week in mysql, Monday or Sunday?? I want to do this: (i am using php btw) Get today date (no problem) Display information of this week (stuck here) Previous and next week button, to display previous and next week data (cant do anything here) I am kinda of stuck while playing with the "date" thing. Can an...

I need to collect an array of classes to call their static variables in php

First thing i want to say that it's not an easy question to explain, so please be patient if it seems confusing. I have a set of classes like this class Product { public static $static_type = 'product'; public static $static_table = 'product_table'; public function __construct($params) { //do some } } and then there are t...

PHP Startup: Timezone database is corrupt

Hi, I have juste updated my CentOS server. PHP is now at the 5.2.10 version (php-5.2.10-1.el5.remi.i386), and I have installed PECL Runkit. tzdata was updated too (tzdata-2009i-2.el5.noarch). Since the update, Apache refuse to start Here is the httpd/error.log [Wed Jul 08 11:40:21 2009] [notice] suEXEC mechanism enabled (wrapper: /us...

Escape double quotes of HTML attributes output by PHP

Often when writing PHP I'll have it output some HTML like this - echo "<a href="../" title="link title">".$link_text."</a>"; Obviously this won't parse as I need to escape the double quotes in the attributes of the <a> element. Is there a regex that would quickly do this rather than me manually adding the backslashes? One other thing...

How to display weekly(Mon to Sun) data in php and mysql??

In php i can get today date/day by using : $today = date('D, Y-m-d'); If today is wednesday 8 july, i want to display data from 6 - 11 July (9, 10 and 11 will be blank). How do I do that? Now my system is like, today is 8 July, i will display 2 - 8 july, but start on wednesday. Not very like this way. I prefer, start on Monday to sunda...

Session start

In header.php I have: <?php if(!isset($_SESSION)) { session_start(); } ?> and further down I have: $_SESSION[theme] = $_GET[theme]; Basicly there is a drop down box where the user selects the website theme, this sets the value of $_GET[theme] and I would like the selection to be remembered, however whenever the page is changed the...

Flex problem in saving PDF at server

Hi All. I am a new bee to flex. What i am trying to do is to generate and save the layout design which nothing but canvas to a pdf format at the server. Currently i am able to display the pdf in browser (see the function below:) but cannot save the file at the server. private function continueToPdf():void{ myPDF = new PDF( Orienta...

How to handle mail delivery errors with PHP

I am building a symfony module for sending newsletters. the idea is to build a queue list of adreeses to receice the mail and then ,with a cron job, send let's say 50 at a time. What i don't now how to do is to read the Mail Delivery reports that are sent back by the server when an email adress doesn't exist or the mail is full. The ide...

Which one is faster rewrite or folder based URLs?

I am creating URLs in my website as http://example.com/register/ http://example.com/login/ I am creating above URLS by writing following rules in htaccess RewriteRule register/ /register.php RewriteRule login/ /login.php Now its working fine for me, but if I create my URLs by creating seprate folder for /login/index.php and /reg...

Turning off redirect loop error in apache

I'm crawling a website using php. As I don't know much about turning php into a CGI and runing from command line the method I've chosen is, after one succesful iteration, to redirect back to the same php file so it runs again (it's not an infinite loop as I use both a cookie and a timestamp check to make sure it ends within a set time or...

Frequent "Connection Timeout" errors on a shared server using PHP/MYSQL

I have a Drupal site on a shared web host, and it's getting a lot of connection errors. It's the first time I have seen so many connection timeout errors on a server. I'm thinking it's something in the configuration settings. Non-drupal parts of the site are not giving as many connection errors. Since this hosting provider doesn't give...

Using locale date format in Joomla modules

How to output a date in the locale date/time format in Joomla? I'm creating a module which is supposed to print dates. I know I can dirty-hack it like that: strftime(format_string, strotime($date)); ... but I would like a smoother solution, that would use Joomla's built-in locale handling functionality. ...

Creating IMage from Text in PHP - how can I make multiline?

Hi guys, I have a script that generates images from text using Php. Its working fine except that I would like it to generate multiline text as well with differing colors. How can it be done. Below is the code I use to generate single line text images. I'm using Php here. $textval = 'This is some text to be an image'; $textcolor = '66666...

Are primitive data types in PHP passed by reference?

In PHP, I'm frequently doing lots of string manipulation. Is it alright to split my code into multiple functions, because if primitive types like strings are passed by value I would be significantly affecting performance. ...

Getting all the users from LDAP

How can i get all the users from the LDAP using PHP. function getUsers() { $process = new process(); //ldap->s_Host('domain.com'); //$ldap->s_Domain('domain.com'); $process->s_Host('domain.com'); $process->s_Domain('domain.com'); $process->s_LdapSecure(false); if($process->LdapConn()){ ...

Tips for internationalization of a plugin

Hello, I am not sure if the is a duplicate post. But I have a plugin (js + forms + html + php) which can be added to various sites. These sites may have different encoding say ISO-8859-1,ISO-8859-9, utf8 etc. I cannot control their encoding of the html or anything. I am wondering what is the best way to make my php + js + html + forms...

number of pages in a pdf file

Does anyone know how I can count the number of pages in a pdf file using php? Thanks! ...

Any tips for switching from CakePHP to Ruby on Rails?

I've been wanting to make the switch from PHP. Anyone care to highlight the similar classes or the key differences between CakePHP and Ruby on Rails? Thank you! ...