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.
Unix OSPHP

Avatar of undefined
Last Comment
flyskyhigh

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Maciej S

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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.
Maciej S

../../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
flyskyhigh

ASKER
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?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Maciej S

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.
flyskyhigh

ASKER
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?
Maciej S

You need to run this as root.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
flyskyhigh

ASKER
Ok. Will try to get a root account. Will return with more info. Thanks so far.
flyskyhigh

ASKER
I got access via sudo. It works great, thanks!