php5

Remote File Existance Problem

Hi, I am creating pdf document for downloading for e.g. someone clicked a PDF link then a pdf is generated and browser opens new window with path of that pdf file. Problem is that browser is giving 404 NOT found error for that file for about 40-50 seconds after its creation but after that when I refresh browser that file is present for v...

why are my php files showing as plain text?

I've been writing php apps using php for a while in wamp. Now I'm installing PHP & apache separately on my work PC. I've installed PHP 5, and the latest apache. I go to localhost and see it works! now I add a file called test.php which displays: <?php phpinfo(); ?> but in the browser it just displays plain text. Is there somewher...

How to split a string on * and - in PHP?

Inorder to split the string i have used the following code. $string = "-sev*yes-sev1*no-sev2*yes"; split('[-*]', $string). As split is deprecated, can you please suggest an alternative to split the string into an array. I have tried with explode, but it is not serving my purpose. The output should look like, Array ( [0] => sev ...

Warning: Cannot modify header information - headers already sent

I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at E:\www\dev\elearning1\WebProjects\elearning\public\test.php:1) in E:\www\dev\elearning1\WebProjects\elearning\public\test.php on line 3 This is my entire PHP file: <?php header('Content-Type: text/html; charset=utf-8')...

One 404 page for Admin controller and other 404 page for other controllers, how?

Hello, I'm very new to MVC and now I'm reading about CakePHP, ZendFramework etc. I can't understand how can I set one 404 page for missing Admin controller methods and other 404 page for all other controller's methods. Question is not about ZendFramework, CakePHP etc. - it's about MVC. I'm writing my own MVC and I can't realize how t...

How to call class A method inside class B method and to make class B methods and parameters available from class A method?

Hello, class User { private $_var_1 = 10; private $_var_2 = 20; private function _preExecute() { //do something here before executing sub-class's method } private function _postExecute() { //do something here after executing sub-class's method } private function _anyMethod() { echo "Hello!"; } public f...

Add elements(nodes) to existing xml file using php

Hi I want to add elements(nodes) to existing xml file. Ex: s I want to add node author tag after title tag .How can write? can i have to use xpath? ...

parsing returned array from a function call

I'm searching for a short syntax like in PERL <?php # instead of this ( PHP ) $f = returnArray(); echo $f[2]; unset($f); # just do this ( PERL short code ) echo (returnArray())[2]; # or this ( PERL short code ) echo returnArray()->[2]; function returnArray() { return array(0=>'x', 1=>'...

Best practices for a PDO class?

I want to create a PDO class for handling data base connections. Here is what I have: require('php/packages/store/store_db_settings.php'); class store_pdo { private $DBH; // Data Base Handler function __construct() { $DBH = new PDO(DB_DSN,DB_USER,DB_PASSWORD); } public function getHandler() { ...

findDependentRowset returning all rows

I have these two models: class Application_Model_List extends Zend_Db_Table_Abstract { protected $_name = 'list'; protected $_primary = 'list_id'; protected $_dependentTables = array('Application_Model_Task'); public function getUserLists($user) { $select = $this->select()->from($this->_name)->where('list_us...

Problem saving edited zip archive (docx)

So here is my code: <?php $zip = new ZipArchive; if ($zip->open('test.docx') === TRUE) { $xmlString = $zip->getFromName('word/document.xml'); $xmlString = str_replace('$FIRST_AND_LAST_NAME', 'John Doe', $xmlString); $zip->addFromString('word/document.xml', $xmlString); echo 'ok'; $zip->close(); } else { echo 'failed';...

range() issuing a warning when date_diff is used

The following script issues a 'Warning: range() [function.range]: step exceeds the specified range in' only when the date_diff function is called. Does anyone know why? <?php $array = array( "Interno", "id" ); $step = count($array) - 1; foreach (range(0, $step) as $number) { echo '<p>'.$number.'</p>'; } $datetime1 = n...

Find *actual* character encoding of data in MySQL DB: UTF8 Latin1 illegal collation problem

Spent hours on this now and could use some help! Our website queries our db - table columns are set to Latin1 collation, website has set names to UTF8 for queries. The data is French and when we do a search for a string including accented characters we get the "*Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_c...

What Apache/PHP/Server settings might affect the speed of a CodeIgnitor model instantiation from one server to another?

One of the pages in one of my apps runs very slowly on the web server compared to my local test server. There are some radical differences in the environments that might explain it, but I'm hoping for a more solvable solution than that. Server: Solaris 10 Apache 2.2.9 Prefork PHP 5.2.6 The server is run on a cluster of 4 not-even-a-yea...

PHP: Is it secure to use index.php as the bootstrap?

I ask because it seems like the only thing ever called in a proper app index.php file is the require_once bootstrap file. I'm assuming this adds a layer of security but if not, this pattern seems pointless. Why not just use the index.php file as the bootstrap? Any opinions, cautions, thoughts etc. are appreciated! (By the way, my htacce...

Alphabetize results in view

I'm trying to do this in CodeIgniter. Here's my code I put into pastebin. As you can guess, it's not working. I need the view to render the results like this: A A Client A CLIENT 2 Another Client B Big Client Brother client C Course I'm a Client Coming Over Client You get the picture. I really need the help. Thank you! ...

i want help to build my logic ?

hey i guys i want help from you. i am working on website project, in that i want to create "if user upload some data then it will be stored in his folder" for this i want currently login username.Because the folder name=username. when user register to my website it will create folder in webspace which name=username. now i want to take cu...

Zend Framework correct naming convention for utilising configs from application.ini

Hi, I am using Zend_Oauth_Consumer which requires a number of config values to be passed. Currently i am passing an array into the constructor like so: $config = array( 'callbackUrl' => 'http://www.domain.com/twitter/callback', 'siteUrl' => 'http://twitter.com/oauth', 'consumerKey' => 'XXXXXXXXXXXXXXXXXX', ...

CakePHP - TinyMceHelper helper error: Method TinyMceHelper::__name does not exist

So I'm wanting to implement the TinyMce helper. I've followed instructions from the cakephp bakery but am still getting a error. This is the helpers array in my project controller: var $helpers = array('Form', 'Time', 'Crumb', 'Text', 'Tinymce'); This is the tinymce helper I downloaded: <?php class TinyMceHelper extends AppHelper {...

Imagemagick JPEG-2000 problem and PHP

Hi, i'm experiencing some problems with the JPEG-2000 file format and Imagemagick. First of all i needed to identify a jpf file, i couldn't get this to work after lots of tries, any idea if this is supported? I always got following error: identify -format "%m" Schutters_1.jpf error: cannot decode code stream identify: unable to dec...