php

How can I speed up my PHP based website?

I just built a small PHP based site from scratch, yay for me! But given the size of it, it's running a little slower than I expected. I have the files/folders organized like this: articles [folder] css [folder] html [folder] images [folder] js [folder] photography [folder] resources [folder] articles.php [file] bio.php [file] ...

htaccess conditionals

I have setup htpasswd authentication on my live site and it works great, but I don't want to be asked for a password when I am working on the development environment. In my httpd.conf file I have: SetEnv APP_ENV "development" In my .htaccess file I have: AuthName "Restricted Area" AuthType Basic AuthUserFile /path/to/file/.htpasswd ...

what is the best php library to parse RSS feeds?

I am trying to parse iTunes top movies (top songs, albums etc) RSS feed, using PHP. Is there a library that I can use to parse them, without writing too much XML code (or using simplexml)? I tried simplepie, but it gave me some inconsistent results, and it is no longer maintained. ...

phpinfo() difference between master and local value

I have a clean install of a CentOs with php 5.2.13. In php.ini that is loaded and present in the header of phpinfo() I have safe_mode=off in the phpinfo() information I have // local value - safe_mode: On // master value - safe_mode: off the php file has only a phpinfo() function. I am still looking for vhost file to see if any d...

Figuring SQL QUERY for EACH ISSET ?

Hello guys I'm stucked in a point and I need your help. I want to change SQL QUERY for each $_GET parameters. I'm using this: <? if (isset($_GET['page']) ) { $pageno = $_GET['page']; } else { $pageno = 1; } // if $query = mysql_query("SELECT count(id) FROM m3_music_mp3"); $query_data = mysql_fetch_row($query); $numrows = $query_da...

PHP Memory Management

I have a few time-consuming and (potentially) memory-intensive functions in my LAMP web application. Most of these functions will be executed every minute via cron (in some cases, the cron job will execute multiple instances of these functions). Since memory is finite, I don't want to run into issues where I am trying to execute a funct...

Is there a common practice for updating product pricing from vendors?

We have tons of products on our site. The vendors often raise the prices of their product line. If it is something easy like +10% we can easily make this change in the data base. But if the prices are changing chaotically; some up, some down with no common denominator. It can be a hassle keeping track that all the products pricing are up...

image editor to add to my web site

hEY, Do You know any image editor with functions like draw on picture which I can add to my html web site ? It's something like paint for www ...

Can sql multi query be considered an atomic instruction?

Hi all, For the php implementation point of view, is the multi_query an atomic instruction on the data base or all it does is executing all queries sequentially? Thanks. ...

GET request from a PHP script in a limited environment...

I have to run a get request from a PHP script, but I'm in a fairly limited environment (tight firewalls, can't modify the PHP install, etc...). fsockopen() returns an error and http_get() seems to not be installed. The only other way I know of is to call file_get_contents(), which works OK, except for the fact that I need to set the re...

Scrape a website URL to get the path of an image

I'm hacking together a simple php script that will build a list of photo albums I have on my Facebook fan page. Facebook kindly offer the Graph API which gives me back a nice list of Albums, however they no longer provide the path of the default album image. I want to write a PHP script that loads an album url via curl and somehow grab...

How do I link an OpenID provider to multiple databases

Does an OpenID provider need to create his own database or can he use multiple databases(for example when the user creates an OpenID, the user,pass,email are provided from one of those databases). I wouldn't like to create another database containing the info from the others , I would like to write in them the ids and probably some flag...

"PHP-ext" -like PHP widget libraries ?

I've asked a similar question a while back (actually nearly 1 year)...back then I was looking for a good widget library, generated from server-side in PHP. The most interesting candidate I find was PHP-ext, but the project seems pretty much dead. So one year later, is there any new open source project of that kind ? Or any widget (PHP-d...

Matching a nonquoted string

Hi- I'm trying to work with regexes in PHP on my school's news site (running WordPress). The idea is, whenever someone saves a post, all instances of "Regis" (without 'Jesuit' at the end) are replaced with "Regis Jesuit." (I go to Regis Jesuit High School, and they're picky about their branding). Overall this works fine with the followin...

How to read big file by 100 lines?

Hello, I have a rather big .txt file (~220Mb) and I need to read it by 100 lines (\n symbol) chunks (for example). How can I do it using php? Thank you. ...

ASP.NET or PHP? Soft for Real Estate Agencies

Hi everybody! Soon I begin create CRM for Real Estate Agencies sphere. In my backround 2 years of PHP-programming & then 5 years of ASP.NET (intranet applications). & I think maybe ASP.NET (i write code on C#) have good IDE (VS 2010), but this is monster :) My application will be multiplayer webapplication for different real estate agen...

PHP: Convert variable to array.

I'm trying to convert a variable to an array and split each character using PHP. So say I have a variable $name = 'John Smith'; How do I convert it to: array('J','o','h','n',' ','S','m','i','t','h'); Notice the space between John and Smith as well. Thank you. ...

php include problem

When i try to load a page that resides in /var/www/vhosts/mypage/httpdocs/index.php using a browser I get an include error that it cannot include file which is in /var/www/fw/trunk. include path is set to include_path='.:/var/www/fw/trunk'. But when I try to load it from console using 'php index.php' it loads fine, i guess it some kind...

Rearranging Array in PHP

Hello, I have an array similar to {A,B,C,D,E,F,G,H}. I would like to be able to pick an index or entry and have the array be reordered. So say if i had a function reorder('C'); It would return the array starting at C, with anything before this index added on to the end, so this example would give {C,D,E,F,G,H,A,B} Is there a functi...

adding an additional link to the wp_pages_dropdown menu in wordpress

I'm working on a wordpress theme that uses dropdowns for part of the site navigation. I'm using wp_pages_dropdown and wp_dropdown_categories to output my menus as a dropdown jump menu, this is all good,works fine, but I would like to add a 'home' link to the end of the list of <option>'s I have been having a go at it - my html/css is ...