-1

This is my php.ini

extension_dir = "ext"
extension=php_tidy.dll

[Tidy]
;tidy.default_config = /usr/local/lib/php/default.tcfg
tidy.clean_output = Off

Can you belive when I type php -m, I get tidy in the list but when I check the phpinfo() function, there is no mention about tidy ?

And when I write $tidy = new tidy; in a php file, I get this error Fatal error: Class 'tidy' not found in E:\DEV\WWW\lexique\load.php on line 32. (The application worked fine under a previous install)

PHP 5.4.15 Apache 2.4

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
Baghera
  • 53
  • 6
  • 2
    Yes, i can `belive` that. Is your question answered now? – Justinas Sep 03 '14 at 08:19
  • Double check if both sides loading the same php.ini – Raptor Sep 03 '14 at 08:19
  • 4
    `php -m` runs the CLI version, whereas your www script certainly uses the Apache module. Different php.ini, or invalid relative path. – mario Sep 03 '14 at 08:20
  • The previous question, before stackoverflow ask me to change it was like "Installing tidy on php". The question is not if you belive it but: I can't deal with this error. Does someone have an idea about what shoult I check not to get a valid installation ? – Baghera Sep 03 '14 at 08:24
  • `php -i | grep "php.ini"` (or `php -i | findstr /C:"php.ini"` if you're on windows) should show you which php.ini your CLI version uses. `phpinfo()` has the same info somewhere at the top. They are most certainly using different config files. – ccKep Sep 03 '14 at 08:30
  • LoadModule php5_module "C:/sys/php-5.4.15/php5apache2_4.dll"¶ PHPIniDir "C:/sys/php-5.4.15"¶ This is the path to the php.ini file I'm dealing with. – Baghera Sep 03 '14 at 08:30
  • php -i says:¶ Configuration File (php.ini) Path => C:\Windows¶ Loaded Configuration File => C:\sys\php-5.4.15\php.ini¶ but C:\Windows\php.ini doesn't exists. – Baghera Sep 03 '14 at 08:37
  • `Loaded Configuration File => C:\sys\php-5.4.15\php.ini` was the important bit from the php -i command. What does `phpinfo()` in your browser tell you? – ccKep Sep 03 '14 at 08:42
  • Also: Are you sure you're not trying to load an x64 library in an x86 mod_php / apache? Check your logs. – ccKep Sep 03 '14 at 08:42
  • phpinfo() says the expected C:\sys\php-5.4.15\php.ini – Baghera Sep 03 '14 at 08:49
  • apache error.log says `AH00354: Child: Starting 64 worker threads`. My system is x64... I'm not sure about apache and php. I'm checking. – Baghera Sep 03 '14 at 08:54
  • phpinfo() says:¶ Compiler = MSVC9 (Visual C++ 2008)¶ Architecture = **x86** ¶ Apache Version = Apache/2.4.4 ( **Win32** ) OpenSSL/1.0.1e PHP/5.4.15¶ **Is it ok ?** – Baghera Sep 03 '14 at 09:02
  • It's only ok if your php_tidy.dll is also x86. (If you don't know how to check: [Link](http://stackoverflow.com/questions/480696/how-to-find-if-a-native-dll-file-is-compiled-as-x64-or-x86)) – ccKep Sep 03 '14 at 09:04
  • I got php_tidy.dll in the same downloaded file as my php. I don't know how to check if x86 or not. – Baghera Sep 03 '14 at 09:10
  • If I set `include_path = .;E:/DEV/PHP_off/libs_off`, I can see the change in phpinfo(). But the existing path is `E:/DEV/PHP/libs` and I still have access to my libs. I don't understand. – Baghera Sep 03 '14 at 09:20
  • If I modify short_open_tag = On/Off in php.ini, I'm sure I'm working the right php.ini. But settings about include_path and tidy have no effects. – Baghera Sep 04 '14 at 06:18
  • include_path problem was due to Alias in httpd.conf – Baghera Sep 05 '14 at 05:36
  • Inside php_tidy.dll binary code, ligne 861, I can see: `` – Baghera Sep 05 '14 at 05:43

2 Answers2

0

CLI and Apache environments use seperate php.ini configs. As such they separately define the extensions they use.

php_tidy will have to be enabled on both configurations to work.

This depends on your setup however. I am using a Ubuntu install as an example which typically contains both directories /etc/php5/apache2 and /etc/php5/cli, each containing their own php.ini file.

The extensions themselves however are usually shared, so you shouldn't need to install them twice.

Flosculus
  • 6,880
  • 3
  • 18
  • 42
0

I have resolved it adding the PHP folder to the PATH and restarting the computer.

Baghera
  • 53
  • 6