# PHP (5.3) How can I completely remove and reinstall?



## juv123 (Dec 17, 2010)

I have hosed PHP5.3

After hosing, I did read UPDATE and followed the directions.  Still hosed installing extensions.

```
/usr/local/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre'
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c: In function 'php_filter_validate_regexp':
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:411: error: 'pcre' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:411: error: (Each undeclared identifier is reported only once
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:411: error: for each function it appears in.)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:411: error: 're' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:412: error: 'pcre_extra' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c: In function 'php_filter_validate_email':
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:527: error: 'pcre' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:527: error: 're' undeclared (first use in this function)
/usr/ports/security/php5-filter/work/php-5.3.3/ext/filter/logical_filters.c:528: error: 'pcre_extra' undeclared (first use in this function)
*** Error code 1
1 error
*** Error code 1

Stop in /usr/ports/security/php5-filter.
*** Error code 1

Stop in /usr/ports/lang/php5-extensions.
*** Error code 1

Stop in /usr/ports/lang/php5-extensions.
```

How can I just remove and reinstall everything?  This was an upgrade attempt from ports php52

Thanks in advance


----------



## juv123 (Dec 17, 2010)

Oh - and I am using Portupgrade if that matters (Please help a newbie!)


----------



## juv123 (Dec 17, 2010)

Ok - well, I removed the php5-filer from the extensions config. and then deinstalled and reinstalled.  Seemed to have worked, but then I was receiving all sorts of errors in my php_error.log:


```
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/pdf.so' - Cannot open 
"/usr/local/lib/php/20090626/pdf.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/xmlwriter.so' - Cannot open 
"/usr/local/lib/php/20090626/xmlwriter.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/iconv.so' - Cannot open 
"/usr/local/lib/php/20090626/iconv.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/pdo_mysql.so' - Cannot open 
"/usr/local/lib/php/20090626/pdo_mysql.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/json.so' - Cannot open 
"/usr/local/lib/php/20090626/json.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/gettext.so' - Cannot open 
"/usr/local/lib/php/20090626/gettext.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/ftp.so' - Cannot open 
"/usr/local/lib/php/20090626/ftp.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/hash.so' - Cannot open 
"/usr/local/lib/php/20090626/hash.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/pdo_sqlite.so' - Cannot open 
"/usr/local/lib/php/20090626/pdo_sqlite.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/tokenizer.so' - Cannot open 
"/usr/local/lib/php/20090626/tokenizer.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/mysqli.so' - Cannot open 
"/usr/local/lib/php/20090626/mysqli.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/sqlite.so' - Cannot open 
"/usr/local/lib/php/20090626/sqlite.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/xmlreader.so' - Cannot open 
"/usr/local/lib/php/20090626/xmlreader.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/filter.so' - Cannot open 
"/usr/local/lib/php/20090626/filter.so" in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'dom' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'bz2' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'calendar' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'gd' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'mysql' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'openssl' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'posix' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'session' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'SimpleXML' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'snmp' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'soap' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'xml' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'zip' already loaded in Unknown on line 0
[17-Dec-2010 15:05:05] PHP Warning:  Module 'zlib' already loaded in Unknown on line 0
```

Read those are due to having duplicate calls in the extensions.ini - which I did, and it appeared it also was calling some old extensions as well. So I moved it:

`mv extensions.ini extensions.ini.bak`

then recompiled:

```
cd /usr/ports/lang/php5-extensions
make deinstall
make reinstall clean
```

This errored out:

```
===>  Checking if print/pecl-pdflib already installed
===>   pecl-pdflib-2.1.8 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of print/pecl-pdflib
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop in /usr/ports/print/pecl-pdflib.
*** Error code 1
```

So I removed print/pecl-pdflib:

```
cd /usr/ports/print/pecl-pdflib
make deinstall
```

Then went back to extensions:

```
cd /usr/ports/lang/php5-extensions
make reinstall clean
```

All seemed to go smoothly, but I check extensions.ini and there is only one extension:
`pico /usr/local/etc/php/extensions.ini`


```
extension=pdf.so
```

-----------------------------------------
Now I am only receiving 1 error:


```
PHP Warning:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
```
every 5 minutes or so.


So what now?


----------



## juv123 (Dec 17, 2010)

Ok - php does not work - I guess this is due to the extensions.  Is there a way to completely redo JUST the extensions?  if I make deinstall and make reinstall it doesn't rewrite the extensions.ini... and doesn't load extensions.


----------



## graudeejs (Dec 17, 2010)

Did you restart fastcgi?


----------



## juv123 (Dec 17, 2010)

I don't think I have fastcgi installed - at least if you have to install it manually


----------



## graudeejs (Dec 17, 2010)

Show your /etc/rc.conf


----------



## juv123 (Dec 17, 2010)

Here it is

```
defaultrouter="xxx.xxx.xxx.xxx"
hostname="mydomain.com"
ifconfig_em0="inet xxx.xxx.xxx.xxx  netmask 255.255.255.248"
linux_enable="YES"
sshd_enable="YES"
# -- sysinstall generated deltas -- # Fri Dec 10 09:12:38 2010
ifconfig_em0="inet xxx.xxx.xxx.xxx  netmask 255.255.255.248"
defaultrouter="xxx.xxx.xxx.xxx"
hostname="mydomain.com"
# -- sysinstall generated deltas -- # Fri Dec 10 09:13:58 2010
ifconfig_em0="inet xxx.xxx.xxx.xxx  netmask 255.255.255.0"
defaultrouter="xxx.xxx.xxx.xxx"
hostname="mydomain.com"
clamav_clamd_enable="YES"
clamav_milter_enable="YES"
clamav_milter_flags="--local --outgoing --max-children=50 --quarantine-dir=/var/quarantine --dont-log-clean --headers --timeout=0 --postmaster-only"
freshclam_flags="--daemon --checks=12"
freshclam_enable="YES"
apache22_enable="YES"
webmin_enable="YES"
mysql_dbdir="/home/mysql"
mysql_enable="YES"
monit_enable="YES"
dovecot_enable="YES"
munin_node_enable="YES"
icmp_drop_redirect="YES"
icmp_log_redirect="YES"
log_in_vain="YES"
tcp_drop_synfin="YES"
firewall_enable="YES"
firewall_script="/etc/rc.firewall"
proftpd_enable="YES"
```


----------



## juv123 (Dec 17, 2010)

I'm guessing that completely removing and reinstalling PHP is not that easy - or there is too many complications.  I have been down for 5 hours now, and it only took 10 minutes to install PHP 5.2 initially.


----------



## graudeejs (Dec 17, 2010)

Sometimes shit happens when you aren't prepared 

So it looks like you aren't running fastcgi, but you're using Apache, which I haven't used (ever).
Try restarting Apache... if it handles fastcgi (maybe some kind of mod_fcgi...), it could solve problem. (But I'm really guessing)


----------



## juv123 (Dec 17, 2010)

No - I've restarted apache many times in my attempts to get the extensions working - no luck.

I have since just gone into my backup extensions.ini.bak and moved it to extensions.ini and restarted apache.

Now I am still stuck with no 'filter' extension (which caused this whole problem in the first place) - and I did read UPDATING:



> 20100409:
> AFFECTS: users of php5-pcrelang/php5
> AUTHOR: ale@FreeBSD.org
> 
> ...



That did not fix the problem - and I still get this error:


```
PHP Warning:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
```
So, I guess I am in purgatory.  :-(


----------



## DutchDaemon (Dec 18, 2010)

juv123, use correct formatting in your posts. Makes them much more readable.


----------

