php

How to turn off php safe_mode off for a particular directory in a shared hosting environment?

Hi I'm used shared hosting. I want to turn off php safe_mode off for my site. My provider gave me a php.ini file and asked me to put it with my settings in my public_html folder to override the settings, but it didn't work. ...

calling and executing a file in php

hi! this might sound weird :) i want to "call" a file( test_2.php ) i.e execute the file like how it would have been when clicking on the following link: <a href="home/test_2.php">click here</a> //this code is currently in test_1.php file is there any method to do that? ...

PHP - problem with urls and charsets

When my URL contains a get with "בלה בלה" , the url stays in hebrew and when I do echo $_GET['hebrew'], it outputs it in hebrew, great. However, when it contains "São Paulo", it starts going nuts, the URL changes to "S%E3o%20Paulo" and the output is "S�o Paulo". This gets me extremely frustrated, can anyone of you guys help me with this...

Php CLI script ignoring memory_limit, crashing at much lower number than limit

Hello, for some reason, my one of my php scripts are ignoring the php.ini memory limit or ini_set. When i do a print_r(ini_get_all) it shows the global memory limit set to 100M (and local for that matter), when my script dies at Fatal error: Out of memory (allocated 24714304) (tried to allocate 571 bytes) Any tips on diagnosing this?...

Creating a cron job in php

hi! i wanna create a cron job which has to execute a file every 30 minutes. I don't have a cpanel or any frontend to do that :( how do i do it? ...

Setting break points in a PHP script (not a web page) using eclipse

I'm running eclipse 3.5 (Galileo) with the PHP development tools (PDT) plug in. I also installed XDebug by following these instructions. It works great when I debug a web page running on localhost. I can set break points and step through the code. However, I can't debug a PHP script. I can run it, and I see the output from print statem...

if statement on one line if poss...

I am printing an image using an ID which is generated. however i wanted to do a check to see if this image exists and if it doesnt print no-image.jpg instead... <img src="phpThumb/phpThumb.php?src=../public/images/'.$row["id"].'/th.jpg&w=162" alt="" width="162" /> It would be great if this could be kept on one line is possible. Any...

Check the value of a text input (Web Programming / PHP)

I have a PayPal button with a quantity text field. How could I check to ensure this textfeild is > 0 so that it does not add to cart if quantity is not an integer >= 1? Thanks ...

joomla performance

hi i had a very noob question for site speed point of view which method is more effective caching or reducing http request .I am using smartoptimizer for the caching ,Gzip and for minify purpose , I have a doubt in my mind related with caching issue ,which one is best default joomla cache or smartoptimizer when i used both i got 404 er...

Properties of a PHP Worker Pool for Background Processing with Gearman

Hello, I did some reading about Gearman and i am wondering if it can be used as a worker pool for background processing. I am interested in a PHP worker pool with the following properties: A. Workers should be able to run concurrently That is, i should be able to have a worker pool and i am expecting gearman to dispatch multiple work...

Codeigniter - HTML not getting rendered

I have deployed my PHP application built on Codeigniter. When I call the root URL, browser is successfully redirected to login view but not HTML is rendered. What can be the issue? ...

Convert function from recursion to iteration

Hello, I have this function that I wrote that is abysmally slow since php does not handle recursion well. I am trying to convert it to a while loop, but am having trouble wrapping my head around how to do it. Can anyone give me some tips? public function findRoute($curLoc, $distanceSoFar, $expectedValue) { $this->locationsVis...

Implications of basing a web application on Open Source like PHP and jQuery

Hi! I am very new to web development and the use of Open Source. I have tried to read about the GPL, BSD, MIT, LGPL licenses, but cant seem to understand what they mean to me in real life. I am asked to develop a web based application for a customer. My agreement with them is that they pay a fixed fee for my development of the applica...

Internal Server Error on php submit with MySQL commands

I get an internal server error with the following code... any suggestions: <form name="user" action="this.php" method="post"> <input type="text" name="description" id="description" value="" /> <input type="submit" name="" id="" value="Edit Page" /> </form> There is no other code on the page, and it self submits fine UNLESS I pla...

Zend Form Multiselect Question

The following is a drop down menu I am trying to add to a Zend Form. Currently the value of the form is 0 for Running and 1 for Triathlon. Instead I want the values to be the same as the labels. What am I doing wrong? I checked Google but seems like I am doing it right. I have checked this against another one and they seem to be the ...

Logging into a PHP forum using lib-cURL and getting a page contents

This is my code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.membersite.com/login.php"); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=deleted&password=deleted'); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'C:\xampp\htdocs\scrape\cookie.txt'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);...

jquery - find last element with a certain class and pass it to php?

Basically, I have a list: <li class="list">fruit</li> <li class="list">vegetables</li> <li class="list">protein</li> And, I want to find the last list item, get the text from it, and then assign it to a php variable, so that: <?php $variable = 'protein'; ?> I'm fuzzy on how to get it into a php variable? ...

calling a file inside another file in php

hi! i've two files a.php which contains <?php echo "i'm a.php"; ?> and b.php which contains <?php echo "i'm b.php"; // some code here to "execute" a.php so that it prints i'm a.php as the output. ?> so finally, when i click on b.php it should display: i'm b.php i'm a.php ...

appropiate MVC structure for a forum

i want to use a good mvc naming convention for a forum im creating. i wonder, should i use this structure: controller: threads model: threads_model (eg. $threads_model->get_all_threads, $threads_model->add_thread, $threads_model->add_post, $threads_model->add_comment) controller: tags model: tags_model (eg. $tags_model->get_all_tags, ...

What is the best way to store and retrieve an array in PHP/MySQL DB

Lets say I wanted to build an app that will pull url links from a database and show 50 on a page. I am just using links as an example. What if I had to store multiple values, an array into 1 mysql field for each link/record posted. If there is 5 items for every Link, I could have an array of 5 items on the page, a list of 5 items s...