Link to home
Start Free TrialLog in
Avatar of flyskyhigh
flyskyhigh

asked on

How do I install TIdy for PHP5 on FreeBSD?

I am very experienced in Apache and PHP on Windows, but now I am working on a FreeBSD server  and I know almost nothing about FreeBSD and *nix.

I have to install and enable Tidy for PHP 5. Under Windows it is as easy as downloading the appropriate DLL, modify php.ini and restart the web server. Takes 2 minutes.

After googling a lot, it seems that on FreeBSD I have to download the source code, compile the module, and even recompile PHP as many sites suggest. But these sites presume the reader is experienced in FreeBSD!

How do I compile the module source?
It is really necessary to recompile PHP?
If so, how do I recompile PHP?

Although my question is specifially about Tidy, I will need to install other modules as well. so I am interested in a generel solution if possible.

Please give exact guidings as just saying "recompile this or that" really don't help me on this stage.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Maciej S
Maciej S
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of flyskyhigh
flyskyhigh

ASKER

This is the content of Makefile:

CATEGORIES=      www
MASTERDIR=      ${.CURDIR}/../../lang/php5
PKGNAMESUFFIX=      -tidy
.include "${MASTERDIR}/Makefile"

Does this mean that the compiled file will end up in /../../lang/php5?

I ask before I see no PHP binary there.
../../lang/php5 is in fat /usr/ports/lang/php5. It's path to php5 port.
After installing php5-tidy port, you should have three additional files.
# pkg_info -L php5-tidy-5.2.8
Information for php5-tidy-5.2.8:

Files:
/usr/local/lib/php/20060613/tidy.so
/usr/local/include/php/ext/tidy/config.h
/usr/local/include/php/ext/tidy/php_tidy.h

One more question - how did you install your apache and php? Was it installed via ports?
Can you run below commands?
pkg_info | grep apache
pkg_info | grep php5
Re. your questions:

1. I don't know how it was installed. The server was set up for me.

2. Yes. The output is:

$ pkg_info | grep apache
apache-2.2.9_5      Version 2.2.x of Apache web server with prefork MPM.

$ pkg_info | grep php5
php5-5.2.8          PHP Scripting Language
php5-mysql-5.2.8    The mysql shared extension for php
php5-mysqli-5.2.8   The mysqli shared extension for php
php5-session-5.2.8  The session shared extension for php
php5-simplexml-5.2.8 The simplexml shared extension for php
php5-spl-5.2.8      The spl shared extension for php

Will there be any harm in running "make install clean" or should I just give it a try?
Ok - as you have apache and php5 as packages, then they are probably in default directories - so far so good :)
There shouldn't be any problems with running "make install clean" in /usr/ports/www/php5-tidy. In case of any problems, you will end up without php5-tidy, so you will be in same situation as you are now.
Remember to restart apache (/usr/local/etc/rc.d/apache22 restart) after successful installation.
Ok, tried it and got:

$ make install clean
===>  Vulnerability check disabled, database not found
===>  Extracting for php5-tidy-5.2.8
=> MD5 Checksum OK for php-5.2.8.tar.bz2.
=> SHA256 Checksum OK for php-5.2.8.tar.bz2.
mkdir: /usr/ports/www/php5-tidy/work: Permission denied
*** Error code 1

Stop in /usr/ports/www/php5-tidy.


I guess it is due to insufficient rights?
You need to run this as root.
Ok. Will try to get a root account. Will return with more info. Thanks so far.
I got access via sudo. It works great, thanks!