Running php scripts on apache in your Ubuntu desktop won’t be sweat at first. You might notice that php scripts start downloading when you start accessing them via browser. This is mainly because of small configuration issues that we can find on machine. If you have enabled userdir module (http://localhost/~yourusername), it contains a line to disable php values as follows in /etc/apache2/mods-enabled/php5.conf :
php_admin_value engine Off
All that you have to do is to disable the above line and restart apache to get php working.
/etc/php.ini, or enabling few options via LxAdmin might not get work in LxAdmin servers. I faced this problem while trying to enable error logging. Whlie I was digging for the reasons, I found that each domain is provided with a separate php.ini under
/home/httpd/domainname.com folder (replace domainname.com with domain’s name). php.ini found under this file needs to be edited in order to make the changes required for error logging etc.
If you use phpinfo() in a test php file, you can see that
/home/user/__processed_stats/domainame.com.phplog file is quoted as the php
error_log file. If you;re using suphp, ensure that this file is owned by the account user. If you use
mod_php you might have to change this to
apache.apache or permissions should be given for others to write into this file.
I wanted to change the log_error value for all accounts on the server. I accomplished the task by writing the following one liner.
for i in `find /home/httpd -name php.ini`; do replace “log_errors = off” “log_errors = on” — $i; done
I had dedicated few days of past few weeks for Debian in search of stable, secure and reliable solutions. With Debian, I ended up finding robust solutions for lots of questions which we had while setting up LAN resources.
Debian net install CD which weighed around 160MB was more than enough to get started. I could setup RAID1 for disks to ensure quick and easy data recovery incase of disk failures. Installed Apache, PHP, Mysql for Intranet, NIS for centralized network authentication, NFS for network mounts and centralized home directories for users, Quota to ensure we don’t run out of disk space etc. It was fast and yet stable. I could find the solutions for various issues which I faced during the installation very quickly (there were very few issues though). Extensive documentation found on the internet made it easy for me and my collegues to get on with complex configurations. We could easily integrate debian into our heterogenious OS environment and network.
I will be adding articles related to Debian to my blog in coming days. That should make it much more easier for you all to find solutions for your questions. Do comment and let me know if you have any unanswered questions with debian. I would be happy to dig deep into those issues and update you.
Debian – apt-on to get it
It’s all about FREEDOM
What is suPHP?
suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.
Hey, I think I know about it. Isn’t it called as phpsuexec in Cpanel servers?
Not really, phpsuexec is now deprecated by Cpanel. where php used to be setup as cgi instead of apache module.
Its nothing but an apache module of php. When you process php scripts with mod_php files written by PHP are saved as the apache process (usually apache/apache user/nobody/group). So you need to assign 777 permission to the files and folders which needs write permission from PHP scripts. It means less security though its 25 – 30% faster than suPHP/phpsuexec. PHP safe mode is also not safe.
So, what is the permission required for the files if I choose to use suPHP?
PHP files can have perms of 640 as Files/folders written by PHP are written as user/group (no apache or other global user)
Is it is possible to continue using .htaccess to have custom php directives with suPHP?
No, Custom php.ini file can be used in your document root instead of .htaccess file.
Can I run both PHP4 and PHP5 with SuPHP?
Yes, You can run both PHP4 and PHP5 with suPHP at the same time. Earlier to run two different versions of PHP on servers, we used to compile one PHP version with mod_php and another one with phpsuexec. Now its not required.
eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.
Yes, i’m having trouble with eAccelerator on my VPS server. I could find that shared memory needs some alterations to the hardware node on which my VPS has been created. Luckily I could find the following solution in eAccelerator FAQ page itself.
I’m using linux 2.6 kernel and eAccelerator doesn’t get loaded when the shm_size is set to value bigger than 32mb. Php gives this warning: PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0
The default shared memory size for the 2.6 kernel is 32mb. You can change this size by setting /proc/sys/kernel/shmmax to the disired maximum value. You can do this by echo VAL > /proc/sys/kernel/shmmax or add the line kernel.shmmax=VAL to /etc/sysctl.conf so you don’t have to set it manualy every time you reboot.
(My bad, I can’t use this as this variable is not supported on VPS kernels)
If you are using VPS solution, make sure the share memory and socket buffers in VPS configuration are sufficient. For OpenVZ or similar type, you can check them by cat /proc/user_beancounter. In normal case all the fail count (failcnt) should be zero. You would need to ask your VPS provider to enlarge the barrier and limit value if you encountered any fail count increase once failed loading eaccelerator.
I need to get in touch with my VPS provider to get this working now.
You can find more solutions on eAccelerator on FAQ page here.
Its really hard to compiling php on plesk servers, that too for newbies. I have been searching for PHP 4.4.7 source rpm or ready solution or a script so that I can quickly give it to my team to resolve such requests coming from our customers.
By chance I found it on Hans Rackers DazeWorld blog space.This php-4.4.7 source rpm is found to be magic.
Remove all the existing php rpms which are on your box. Don’t worry you just have to take the backup of /etc/php.ini. Ignore all dependencies no worries.
Once you’re done with it, download and build the source rpm as follows.
rpmbuild –rebuild php-4.4.7-1.hrak.src.rpm
This will compile php for your box and build the rpms required. You will find all the rpms required for your system in /usr/src/redhati386 folder.
Go ahead and install them all
rpm -ivh /usr/src/redhat/i386/php-*.rpm
restart apache and psa from /etc/init.d . Your plesk box will have latest PHP 4.4.7