Archive for the ‘Apache’ category

500: [warn] Directory / is not owned by username

May 21st, 2010

If your site is getting a 500 error, you’ll want to check Apache’s error_log at /usr/local/apache/logs/error_log.

If you see the following error, you’ll want to check the ownership of “/” to ensure it’s owned by root:root, and not a user on your server.

[Mon May 03 22:26:47 2010] [warn] Directory / is not owned by rrsdd

Let’s check the ownership:

# stat /
File: `/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 1bh/27d Inode: 99717474 Links: 26
Access: (0755/drwxr-xr-x) Uid: ( 535/ cpus123) Gid: ( 0/ cpus123)

This shows that the / folder is owned by “cpus123″ which is incorrect, and you’ll want to change the ownership to root:root.

#chown root:root /

Now let’s verify:

# stat /
File: `/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 17h/23d Inode: 917505 Links: 25
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)

Share

info [rebuildhttpdconf] User ‘username’ data set has no ‘main_domain’ key.

May 21st, 2010

Error: info [rebuildhttpdconf] User ‘username’ data set has no ‘main_domain’ key.

Solution: Check to see if there is a file called “main” for the user(s) affected users in /var/cpanel/userdata/username.

If it’s not present, verify the domain exists in httpd.conf, and run /usr/local/cpanel/bin/userdata_update to recreate the “main” file based off the apache configuration.

Share

Apache error: RewriteCond> directive missing closing ‘>’

May 21st, 2010

Error:

httpd: Syntax error on line 13 of
/home/girit/public_html/.htaccess.igvjRiTOB3TiKlh0Pf8wcDk4yuRcH5ba:
RewriteCond> directive missing closing '>'

Solution: edit the .htaccess file in vi (or your favorite text editor) and ensure there is a blank line (new line) at the bottom of the file.

Share

PHPInfo

April 22nd, 2010

PHPInfo pages can be useful when needing to verify what php modules are installed/loading properly, or to see which php.ini a site is using.

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

http://us3.php.net/phpinfo

Share

How to Install EAccelerator, IonCube, Zend Optimizer, SourceGuardian, and SuHosin outside of EasyApache

April 10th, 2010

Many don’t know that you don’t need to run EasyApache to install EAccelerator, IonCube Loader, Zend Optimizer, SourceGuardian, or SuHosin. Why waste your time?

You can use /scripts/phpextensionmgr to install or uninstall these modules!

# /scripts/phpextensionmgr list
Available Extensions:
EAccelerator
IonCubeLoader
Zendopt
SourceGuardian
PHPSuHosin

So, if you wanted to install Zend Optimizer, you’d run:

# /scripts/phpextensionmgr install Zendopt
Installing Zendopt
Determining PHP version
Installing Zend Optimizer binary
Activating Zend Optimizer in /usr/local/lib/php.ini
Zend Optimizer activated
Skipping install to /usr/local/php4, missing php.ini

Easy peasy. :)

Share

Modifying your PHP Handler Configuration via SSH

April 10th, 2010

Your PHP handler and SuExec configuration can be modified in WHM >> Apache Configuration >> PHP and SuExec Configuration, but if you’d like to make your change via SSH, you can use rebuild_phpconf.

Note: with this utility, you can not add new handlers, or enable an alternate PHP version if it’s not installed. You’d need to use EasyApache to enable that change.

What’s my current configuration?
# /usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled

Let’s say I wanted to switch to DSO, keeping PHP4 disabled, and SuExec enabled:
# /usr/local/cpanel/bin/rebuild_phpconf 5 none fcgi 1

For reference, the usage details:
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available]
--dryrun : Only display the changes that would be made
--no-restart : Don't restart Apache after updating the php.conf link
--no-htaccess : Don't update user configurable PHP mime mapping.
--current : Show current settings
--available : Show available handlers and PHP SAPIs
: Version of PHP to set as default handler for .php files
: Type of Apache module to use in serving PHP requests
: enabled, disabled, 1 or 0

Share

configure: error: Problem with libXpm.(a|so) or libX11.(a|so)

January 7th, 2010

Error: configure: error: Problem with libXpm.(a|so) or libX11.(a|so)

This happens most times when compiling with gd enabled for the first time. Reinstall X11 libraries and try again:

cd /usr/ports/x11/libX11/
make deinstall
make install

Share

EasyApache Fails Due to YUM Failing

November 15th, 2009

EasyApache requires a working package manager to be able to run properly, as it needs to confirm several RPMs are up to date before proceeding with the build.

!! The server's system package manager, 'YUM', failed. !!
!!
This is the command that failed:
	yum --exclude=kernel* -y install aspell aspell-devel automake19 gettext
libstdc++.x86_64 libpng-devel openssl libpng-dev zlib-devel autoconf261
libidn-devel gmake libidn libXpm openssl-devel automake coreutils patch
libltdl3-devel libltdl libopenssl0.9.7-static-devel libtool-ltdl-devel
libXpm-devel sed libXpm-dev lsof krb5-dev flex glibc-dev expat-dev krb5-devel
pspell-devel libstdc++-devel.x64_64 xorg-x11-devel libtool-ltdl libssl-dev
pam-devel libopenssl0-devel zlib1-devel expat-devel pspell libopenssl0-dev
expat glibc-devel gcc-c++ zlib bison libjpeg-devel libtool-libltdl-devel
libtool openssl-dev libopenssl0 libz-devel libjpeg-dev pam-dev fileutils
libltdl-devel libopenssl0.9.7-devel e2fsprogs-devel make libstdc++-dev.x86_64
libX11-devel gd cpp xorg-x11-dev gcc ssl-dev autoconf lex
!!
!!
Since EasyApache was unable to resolve it automatically you should:
	1) Manually run the failed YUM command (shown above) via SSH
        2) See if your particular error is addressed at 

http://www.cpanel.net/support/could_not_ensurepkgs.htm

	3) Resolve the YUM problem manually
	4) Re-run EasyApache
!!
!! Please visit 

http://www.cpanel.net/support/could_not_ensurepkgs.htm

 for help with this error. !!

!! Restoring original working apache !!

First things first. Try running ‘yum -y update’ and see if it completes. You may see the following when running yum update.

error: rpmdbNextIterator: skipping h#      27 region trailer: BAD, tag 1507328 type 1507328 offset -1507328 count 1507328
error: rpmdbNextIterator: skipping h#      65 region trailer: BAD, tag 724250418 type 825833527 offset -740320047 count 842150704
error: rpmdbNextIterator: skipping h#      69 region trailer: BAD, tag 942410249 type 1952543335 offset -1702113073 count 842610488
error: rpmdbNextIterator: skipping h#      99 region trailer: BAD, tag 1814980474 type 4544080 offset -1598245200 count 1212502623

and so on and so on….

Then it’ll actually show packages that require updates, and experience a segmentation fault.

---> Package hotplug.x86_64 3:2004_04_01-7.10 set to be updated
---> Package fetchmail.x86_64 0:6.2.5-6.0.1.el4_8.1 set to be updated
--> Running transaction check
Segmentation fault
[root@vps ~]#

This means that your RPM database is corrupt, which is easily fixed with the following:

[root@vps ~]#rm -f /var/lib/rpm/__db.*
[root@vps ~]#rpm -vv --rebuilddb

Once that finishes, run ‘yum update’ again, and it should complete successfully. If so, you’re all set. Go ahead and retry your easyapache build.

Share

How to install imagick for PHP

November 10th, 2009

The imagick.so PHP module can’t currently be installed via PECL, due to it’s inability to write to /var/tmp. To get around that, you can install it manuall:

# yum install ImageM* netpbm gd gd-* libjpeg libexif gcc coreutils make
# cd /usr/local/src
# wget http://pecl.php.net/get/imagick-2.2.2.tgz
# tar zxvf ./imagick-2.2.2.tgz
# cd imagick-2.2.2
# phpize
# ./configure
# make
# make test
# make install

This will compile imagick.so, and move it to your extensions directory specified in php.ini. Now you’ll need to add the following to php.ini:

extension=imagick.so

and restart apache:

/scripts/restartsrv_httpd
Share

suphp 500 error, Premature end of script headers

September 26th, 2009


[Sat Sep 26 22:02:33 2008] [error] [client 111.222.333.444] Premature end of script headers: phpinfo.php
[Sat Sep 26 22:02:33 2008] [error] [client 111.222.333.444] File does not exist: /home/username/public_html/500.shtml

First step: ensure that you’re using proper permissions on your files for suphp. Your php files should have 644 permissions, and ownership of the user whose home folder the files are in.

If ownership and permissions are correct, it could be a memory issue. I’ve found that some users who experience this error are running out of available memory for php to execute properly. You can try switching your PHP handler to cgi or fcgi, which will actually display an “out of memory” error in apache’s error_log, but suphp will not.


[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] Premature end of
script headers: php5
[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] File does not exist:
/home/username/public_html/500.shtml
[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] Out of memory

If you do have available RAM, but PHP isn’t able to use it, try increasing the RLimit value in httpd.conf and see if your script will execute then. If you look at “free” and you don’t have much free memory, you may need to upgrade your server or VPS.

Share

cPanel Web Site Hosting by IntraHost