Archive

Posts Tagged ‘php 5.3’

PHP 5.3 symlink() in Windows Vista and Server 2008

June 17th, 2009

I just discovered that Vista can create symbolic links via the command mklink! It performs the same thing as ln in linux with both hard and soft links. My understanding of links is fairly limited but I use them on my web server to apply seam-less templates. Until now, this was something that I could only test on my web server and not my Windows 7 development PC. PHP 5.3 automatically uses the mklink command when you use symlink() but the problem comes with enabling it in Windows Vista or 7.

If you pull up a command prompt and try to use mklink, you’ll see something like this:

D:\Web>mklink /D nnnnn.com\content templates\bluemoon
You do not have sufficient privilege to perform this operation.

Or PHP will throw this back at you:

Debug Warning: /includes/templates.inc.php line 78 - symlink() [function.symlink]: Cannot create symlink, error code(1314)

To fix this:

  1. Bring up your run box, type “secpol.msc” and click OK.
  2. Navigate under the Security Settings \ Local Policies \ User Rights Assignment folder.
  3. Find “Create symbolic links” and add the Users group to it.

I think you need to restart your computer or something after doing this.

Josh Guides, Web Development , , , , , ,

Install PHP 5.3.0 on CentOS 5 as CGI along side PHP 5.2.9

June 16th, 2009

Well, turns out I’d rather play with just PHP 5.3 RC4 for now. Here is my guide to installing it onto my CentOS 5 64-bit VPS from 1&1.

Update: PHP 5.3.0 has been released and there are some changes.

It went pretty smoothly. Here is the guide, minus the hours of trial and error, of course:

First, install anything you may need to compile with.

yum install gcc gcc-c++.x86_64

yum install \
  libicu-devel.x86_64 \
  libxml2-devel.x86_64 \
  mysql-devel.x86_64 \
  libpng-devel.x86_64 \
  libjpeg-devel.x86_64 \
  curl-devel.x86_64 \
  bzip2-devel.x86_64 \
  gettext-devel.x86_64 \
  gmp-devel.x86_64 \
  pcre-devel.x86_64 \
  freetype-devel.x86_64 \
  gd-devel.x86_64 \
  aspell-devel.x86_64

NOTE: You can copy that entire block and paste it, the backslash (\) will carry the command over to the next line automatically.

Next, make the folders for the configs and binaries.

mkdir /usr/local/php53 /etc/php53 /etc/php53.d


Begin, by downloading and extracting the latest snapshot. Don’t use the file name I have below, get it fresh from snaps.php.net.

cd ~
wget http://us2.php.net/get/php-5.3.0.tar.bz2/from/us.php.net/mirror
tar xjf php-5.3.0.tar.bz2
cd php-5.3.0.tar.bz2

# gz: tar xzf php-5.3.0.tar.gz
# bz2: tar xfj php-5.3.0.tar.bz2
# zip: tar xfZ php-5.3.0.zip


Now, set up all of your configuration options. You may want to adjust these. To see what they mean, type: ./configure --help

./configure \
  --prefix=/usr/local/php53 \
  --with-libdir=lib64 \
  --with-config-file-path=/etc/php53 \
  --with-config-file-scan-dir=/etc/php53.d \
  --with-bz2 \
  --with-curl \
  --with-exec-dir=/usr/bin \
  --with-freetype-dir=/usr \
  --with-png-dir=/usr \
  --enable-gd-native-ttf \
  --without-gdbm \
  --with-gettext \
  --with-gmp \
  --with-iconv \
  --with-jpeg-dir=/usr \
  --with-openssl \
  --with-png-dir=/usr \
  --with-pspell \
  --with-libexpat-dir=/usr \
  --with-pcre-regex=/usr \
  --with-zlib \
  --with-layout=GNU \
  --enable-exif \
  --enable-ftp \
  --enable-magic-quotes \
  --enable-sockets \
  --enable-sysvsem \
  --enable-sysvshm \
  --enable-sysvmsg \
  --enable-wddx \
  --with-kerberos \
  --enable-ucd-snmp-hack \
  --enable-shmop \
  --enable-calendar \
  --with-mysql=mysqlnd \
  --with-mysqli=mysqlnd \
  --with-pdo-mysql=mysqlnd \
  --with-mysql-sock=/var/lib/mysql/mysql.sock \
  --with-libxml-dir=/usr \
  --without-mysql \
  --with-gd=/usr


Finally, compile and install!

gmake
gmake install


Lastly, you’ll likely want to use it in Apache… Here is how I set up my domain to use PHP 5.3:

<VirtualHost 74.208.46.111:80>
  ServerName php53.mainelan.com:80
  ServerAlias www.php53.mainelan.com
  UseCanonicalName On
  ServerAdmin "webmaster@mainelan.net"
  DocumentRoot /var/www/vhosts/php53.mainelan.com/httpdocs

  # PHP 5.3
  ScriptAlias /php53-cgi /usr/local/php53/bin/php-cgi
  Action application/x-http-php53 /php53-cgi
  AddHandler application/x-http-php53 .php

  . . .

Josh Guides, Web Development ,