Setting up PHP dev environment on a Centos 5.2 VM

I’m actually setting up a VMWare image from Linhost, so I installed VMWare server, gave it 1024MB of RAM, and I tried to set up Bridged networking, but couldn’t get it working, so I decided to use Apache on Windows as a Proxy.

I added my centos VM IP address to my C:/windows/system32/drivers/etc/hosts

127.0.0.1 windows
192.168.41.128 centos.vm

And similarly to my /etc/hosts on the VM

127.0.0.1 centos
192.168.41.128 centos.vm

I edited /etc/sysconfig/network and changed the hostname

HOSTNAME=centos

I found that Apache was blocked, so I disabled SELinux, by editing /etc/selinux/config and set

SELINUX=disable

and disabled the iptables firewall by typing:

chkconfig iptables off

I could have also ran “system-config-securitylevel” to specify what services to allow but I get:

sh: setenforce: command not found

(maybe it needs SELinux running)

to enable apache httpd on startup, I typed:

chkconfig --level 235 httpd on

I found some useful advice on upgrading from

http://www.howtoforge.com/perfect-server-centos-5.2

And a good yum repository with PHP 5.2 for CentOS 5.2 is at

http://www.jasonlitka.com/yum-repository/

More information about using this repository is at:

http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum

I then edited my windows Apache configuration to set up the Proxy:

#http://windows/centos
ProxyPass /centos http://centos.vm/
ProxyPassReverse /centos http://centos.vm/

# http://centos.windows:10080

Listen 10080
NameVirtualHost *:10080

<VirtualHost *:10080>
 ServerName centos.vm
 ServerAlias windows
 ProxyPass / http://centos.vm/
 ProxyPassReverse / http://centos.vm/
</VirtualHost>

Now I can access it two different ways, either from the path via the Windows server, or as a VirtualHost via an alternate port (10080).

Now to upgrade PHP to version 5.2 (which is not available on the official CentOS 5.2 repository), follow directions at

http://www.jasonlitka.com/yum-repository/

create a yum repository at /etc/yum.repos.d/utterramblings.repo

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

install the gpg key:

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Then run:

yum update
Updated:
 apr.i386 0:1.3.8-1.jason.1             apr-devel.i386 0:1.3.8-1.jason.1       apr-util.i386 0:1.3.9-1.jason.1         apr-util-devel.i386 0:1.3.9-1.jason.1
 httpd.i386 0:2.2.14-jason.1            httpd-devel.i386 0:2.2.14-jason.1      httpd-manual.i386 0:2.2.14-jason.1      mod_perl.i386 0:2.0.4-7.jason.1
 mod_python.i386 0:3.3.1-8.jason.1      mod_ssl.i386 1:2.2.14-jason.1          mysql.i386 0:5.0.86-jason.2             mysql-server.i386 0:5.0.86-jason.2
 pcre.i386 0:7.8-1.jason.1              php.i386 0:5.2.11-jason.1              php-cli.i386 0:5.2.11-jason.1           php-common.i386 0:5.2.11-jason.1
 php-devel.i386 0:5.2.11-jason.1        php-gd.i386 0:5.2.11-jason.1           php-imap.i386 0:5.2.11-jason.1          php-ldap.i386 0:5.2.11-jason.1
 php-mysql.i386 0:5.2.11-jason.1        php-odbc.i386 0:5.2.11-jason.1         php-pdo.i386 0:5.2.11-jason.1           php-pear.noarch 1:1.7.2-2.jason.1
 php-xml.i386 0:5.2.11-jason.1          php-xmlrpc.i386 0:5.2.11-jason.1

install APC

pecl install apc
yum install php-apc

see also http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s