PHP is a general-purpose scripting language that is especially suited for Web development. The online manual is an excellent resource for the language syntax and has an extensive list of the built-in and extension functions. Most extensions can be found in PECL.

learn more… | top users | synonyms

56
votes
10answers
41k views

memcache vs memcached?

I want to use memcached http://www.danga.com/memcached/ I have installed it through yum install memcached But now I need to connect to PHP, and there is an extension named memcache and one named ...
34
votes
11answers
2k views

Got Hacked. Want to understand how

Someone has, for the second time, appended a chunk of javascript to a site I help run. This javascript hijacks Google adsense, inserting their own account number, and sticking ads all over. The ...
32
votes
4answers
51k views

how do I upgrade from php 5.3 to php 5.4.6 in ubuntu?

Is there an easy way out to get the latest PHP? I have tried updating my package but none of it has 5.4.6 yet.. if anyone knows on how to do it quickly, can it be shared here? I've tried compiling ...
30
votes
7answers
55k views

How do you restart php-fpm?

I need to reload my php.ini and there's nothing in the help dialog about restarting it.
29
votes
4answers
36k views

Setup ubuntu server to send mail()

I tried searching a lot but unable to find how to actually setup a ubuntu server, so that I can send mails through php using mail() function in php. I have apache2, mysql and php5 installed on my ...
28
votes
8answers
3k views

Securing PHP webservers

PHP applications have a reputation for higher than average security problems. What configuration techniques do you use for making sure the application is secure as possible? I'm looking for ideas ...
27
votes
5answers
21k views

Which PHP (opcode) cache one should use and why?

I keep hearing about some PHP (opcode) caches like - APC, XCache, Memcache, eAccelerator, etc. But I couldn't ever figure out how to go about choosing one. Apart from performance benefit, which a ...
26
votes
4answers
3k views

Why Swap is used when plenty of free memory is left?

I have pretty good web (dedicated) server with good memory resource System information Server load 2.19 (8 CPUs) Memory Used 29.53% (4,804,144 of 16,267,652) Swap Used 10.52% ...
25
votes
15answers
49k views

Why is the response on localhost so slow?

I am working on a tiny little PHP project for a friend of mine, and I have a WAMP environment setup for local development. I remember the days when the response from my local Apache 2.2 was immediate. ...
21
votes
5answers
20k views

Can a pool of memcache daemons be used to share sessions more efficiently?

We are moving from a 1 webserver setup to a two webserver setup and I need to start sharing PHP sessions between the two load balanced machines. We already have memcached installed (and started) and ...
21
votes
5answers
28k views

Where is apc.php?

Using Ubuntu server 10.4, I apt-getted php-apc Where is the apc.php file that I'm meant to copy? Thanks!
20
votes
16answers
1k views

Why is it bad to have a weak mysql user password?

I was presented with an argument to the tune of "you don't need a strong mysql user password because in order to use it, they'd already have access to your server." We're talking about a 4 digit ...
20
votes
3answers
7k views

PHP: What are the advantages of FastCGI over mod_php?

It was recently suggested to me that I use FastCGI with PHP. Now I went to the FastCGI page and read it but I don't really understand what the advantages are.
18
votes
8answers
6k views

Dropbox alternative [closed]

I'm looking for something like Dropbox (or centraldesktop) that I can host locally. I would like users to be able to upload (bonus for multiple upload) and download files into a file structure. ...
16
votes
1answer
533 views

Install APC RedHat

i am trying to install apc on redhat so i did: pecl install apc i said yes to: Use apxs to set compile flags (if using APC with Apache)? [yes]: and i get this: checking for re2c... no ...
16
votes
3answers
29k views

How do I upgrade to the latest PHP version in CentOS with yum?

I found some blog posts about this, but it's rather lack of descriptions on possible side effects. I could really use some detailed on these steps: How to add a repo that provides PHP 5.4 into yum ...
16
votes
4answers
6k views

What's a secure alternative to using a MySQL password on the command line?

We have a PHP command-line script to version a database. We run this script whenever a developer has added a new database patch. The script runs the patch with the MySQL command-line: system('mysql ...
16
votes
4answers
12k views

How can I determine the cause of an apparent memory leak in my Apache/PHP based web app?

About once a week, but sometimes even a couple of times a day after running fine for days, my EC2 instances become unresponsive. Munin's memory graphs tell a pretty straightforward story: memory ...
15
votes
4answers
11k views

Failed to instal APC via pecl install APC

Hy when i try to install APC via pecl install APC-3.1.5 or even pecl install APC I get following error when the package comes to the make command: running: make /bin/sh ...
15
votes
5answers
9k views

php mail() function painfully slow on local development machine

Background: If you have set up a local apache server for development purposes you may have run into the problem where sendmail takes a long time (at least one minute) to send emails. This is extremely ...
15
votes
9answers
13k views

Mysteriously empty $_POST array

I have the following HTML/PHP page: <?php if(empty($_SERVER['CONTENT_TYPE'])) { $type = "application/x-www-form-urlencoded"; $_SERVER['CONTENT_TYPE'] = $type; } echo "<pre>"; ...
14
votes
1answer
59k views

Can't start php-cgi.exe - MSVCR110.dll is missing [closed]

Trying to setup nginx and php on my Windows machine, but every time I try to start php-cgi.exe I get a system error. The program can't start because MSVCR110.dll is missing from your computer. ...
13
votes
2answers
32k views

How can I display and log PHP errors on IIS7?

We're running PHP 5.2.5 on an IIS 7 Server and we're having problems making PHP errors visible... At the moment whenever we have a PHP error the server sends back a 500 error with the message "The ...
13
votes
1answer
8k views

Memory Usage Numbers In top/htop

Can someone please explain this top output. Each PHP process is using 30% of the total memory or of the used memory? Furthermore how can it be that the combined used memory across all the PHP ...
13
votes
1answer
5k views

Multiple php versions simultaneously on Ubuntu

I want to be able to run multiple php versions on my development box running Ubuntu 12.04. What I want to accomplish is that when I use localhost as domain a default is used (let's say php 5.3.17). ...
12
votes
8answers
2k views

is this a hack attempt?

Looking through my 404 logs I noticed the following two URLs, both of which occurred once: /library.php=../../../../../../../../../../../../../../../../../../../../../../../../proc/self/environ and ...
12
votes
8answers
12k views

MySQL cannot connect via “localhost”, only 127.0.0.1

this is somewhat of a mystery to me. The only way I can connect to MySQL is if I call it via "127.0.0.1" ... for example, my PHP connect script will NOT work with localhost I'm running Mac OS X Lion, ...
12
votes
2answers
3k views

How do you Install PHP5 without installing Apache in ubuntu?

Is it possible to install PHP5 without installing apache, in Ubuntu? If so, how?
12
votes
4answers
4k views

Ubuntu's garbage collection cron job for PHP sessions takes 25 minutes to run, why?

Ubuntu has a cron job set up which looks for and deletes old PHP sessions: # Look for and purge old sessions every 30 minutes 09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] \ ...
12
votes
2answers
5k views

Apache file negotiation failed

I'm having the following issue on a host using Apache 2.2.22 + PHP 5.4.0 I need to provide the file /home/server1/htdocs/admin/contents.php when a user makes the request: ...
12
votes
10answers
7k views

How to scale php5+MySQL above 200 requests/second?

I am tweaking my homepage for performance, currently it handles about 200 requests/second on 3.14.by which eats 6 SQL queries, and 20 req/second on 3.14.by/forum which is phpBB forum. Strangely ...
12
votes
2answers
765 views

improve our deployment strategy

We have an ecommerce app that we develop at our company. Its a reasonably standard LAMP application that we have been developing on and off for about 3 years. We develop the application on a testing ...
11
votes
3answers
25k views

How can I upgrade PHP to a higher version for Debian Squeeze?

Currently, my PHP is on 5.3.3, how can I upgrade it? Also how can I upgrade anything? For example, if I want to upgrade phpMyAdmin as well?
11
votes
5answers
12k views

Why are my PHP files downloading instead of processing with Nginx

I have seen the same problem, and many resolutions for it pointing to adding the type handler, but that was for Apache. I am using Arch Linux, Nginx, PHP and PHP-FMP and I cannot figure out why php ...
11
votes
3answers
1k views

The A to Z of setting up a Linux box for secure local hosting

I am in the process of reinstalling the OS on a machine that will be used to host a couple of applications for our business. The applications will be local only; access from external clients will be ...
10
votes
5answers
1k views

Safe to have /.svn/ folders on live site? (How to remove them but retain svn update capability?)

I'm doing svn update to update the code for my php website, but it leaves .svn/ folders all over. I think its dangerous to leave those files publically readable, but its very easy to update the ...
10
votes
3answers
19k views

Connecting to MySQL from PHP is extremely slow

I just did a fresh install of XAMPP. When first opening PHPMyAdmin I noticed it was extremely slow. It didn't make sense that on localhost it should take almost 5 seconds for every page to open. I ...
10
votes
7answers
665 views

Making the move to source control

Ours is a fairly small company (3-4 programmers and 3-4 site designers) that develops a single-purpose PHP web app which provides the functionality to about 100+ websites. We've operated for a couple ...
10
votes
8answers
6k views

The most powerful open source web analytics tools? [closed]

Need some advices on choosing open source web analytics tools, including both of page tagging and log file analysis type. I know some of them: piwik, open web analytics, awstats and more... what are ...
10
votes
8answers
31k views

How do I install PHP 5.3 on CentOS?

I have to install PHP 5.3 on my CentOS server. If I do yum install php, the base repository installs 5.1.6 which is too old for the applications I need to install. So I've been trying to use the IUS ...
10
votes
5answers
47k views

How to install mcrypt for PHP 5.3.3 on CentOS 5.7 64 bit?

I installed php 5.3 and some modules using yum install php53-{module-name} But mcrypt did not work. I searched like this: yum list php* | grep mcry The only package that came up was ...
10
votes
3answers
3k views

Secure LAMP server for production use

What is the procedure for securing a Linux, Apache, MySQL, PHP Server (or even Perl) for production use? Other than setting the MySQL password and the root password for Linux what other (maybe not so ...
10
votes
4answers
578 views

Common PHP setup insecurity?

I work with the systems administration at a university and just stumbled across something which is probably common, but was quite a shock to me. All public_html directories and web areas are stored ...
10
votes
1answer
3k views

apache on centos 5.6 gives me permissions denied error

I'm running apache on centos 5.6 and whenever i try to load a php script in any directory, other than /var/www/html (the apache default root dir) it gives me a permissions denied error. However when ...
10
votes
3answers
12k views

How to investigate a memory leak with Apache and PHP?

We're running a heavy Drupal website that performs financial modeling. We seem to be running into some sort of memory leak given the fact that overtime the memory used by apache grows while the number ...
10
votes
2answers
3k views

Should I impersonate PHP via FastCGI?

I am installing the latest version of PHP onto IIS 7.5 via FastCGI, and all of the instructions say that FastCGI should impersonate the calling client by setting fastcgi.impersonate = 1 If my ...
10
votes
2answers
12k views

What are the steps to make the php mail() function work on ubuntu-server?

I want to enable the simple php mail() function on an Ubuntu server. This will only be used for sending administration stuff and logs. This is all the mail functionality that I want on this machine. ...
9
votes
8answers
832 views

Building a Student Storage server

I work for a school district. I've been put in charge of building a storage server for students. A place for them to work off of from school and home. My challenge is getting this to work from ...
9
votes
4answers
15k views

How do I set up per-site php.ini files on a LAMP server using NameVirtualHosts?

I have a LAMP server serving a number of different websites using NameVirtualHosts. Until recently having a global php.ini file has been just fine, but recently one of our developers has requested ...
9
votes
4answers
32k views

How to --enable-dom without recompiling PHP?

From the output of phpinfo(), --disable-dom are included the configure command. How do I change it to --enable-dom without recompiling PHP? Edit: I'm using Fedora 10. The PHP i'm using is the one ...