I motored on over to the wamp\www directory and I tried this from the command prompt (brackets [ ] used here instead of < > to preserve formatting here):
[?php phpinfo.php; ?]
but Windows just complains that the command syntax is incorrect.
When using PHP from the command line you're using the Windows command line interface, not a web server. The command would be
if you have the PHP executable's directory in your system PATH.
And it's not necessary to create a whole PHP file just to run phpinfo():
Code:
C:\arbitary\path> php -r "phpinfo()"
More information about PHP's CLI is of course in the manual. Note that one of the differences is that as a CLI program PHP reads php.ini on every invocation, instead of only when the web server is restarted (because of course there is no web server in this case).
Ok, here is part of the phpinfo() output from the command line as dumped to a text file (red emphasis mine):
mysql
MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 321634 $
Directive => Local Value => Master Value
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => no value => no value
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MysqlI Support => enabled
Client API library version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 321634 $
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Directive => Local Value => Master Value
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
C:\path\> php -r "echo function_exists('mysql_query') ? 'function exists' : 'function does not exist';"
I got back the value "exists". So, the PHP interpreter must be seeing the library, right? So, why does this not work when the local WAMP server runs the code? I'm starting to believe this has something to do with port 3306. Just what, I don't know, as I don't think the .Net environment cares about that port for its IIS stuff. I may change the default port to something else, just to try it.
If everybody's thinking alike, somebody isn't thinking.
I got back the value "exists". So, the PHP interpreter must be seeing the library, right?
Correct.
Originally Posted by Stinger51
So, why does this not work when the local WAMP server runs the code?
Not to sound repetitive, but the culprit that comes to my mind is the php.ini configuration file. Have you verified that the same php.ini used when PHP is invoked via Apache is being used during your CLI tests?
Originally Posted by Stinger51
I'm starting to believe this has something to do with port 3306.
No port number configuration, conflict, preference, or... anything... would cause PHP to not load an extension.
Image #2 shows the path to the php.ini file that Apache is using. I've scrolled down in the file to show that the extensions are indeed enabled (uncommented).
If everybody's thinking alike, somebody isn't thinking.
I had WAMP use Apache 2.2.22 (instead of 2.2.21) and PHP 5.4.3 (instead of 5.3.10) and my scripts are now able to talk to MySQL again. The phpinfo() display also shows that MySQL is back in the mix now. Note that I sill had to set Apache to listen on port 8080 (not port 80). I'm also liking WAMP again rather than XAMPP as WAMP gives you much better control at their control panel.
Why did this work? Dunno. Both Apache .conf files and both PHP .ini files are identical. Beats the F**K out of me. But I'll take it. Windoze must have woken up in a different mood after I did this, that's all I know.
And Viz Web Dev 2010 is still working too (knock on wood). Sometimes the computer gods smileth down on thee, and sometimes they don't.
If everybody's thinking alike, somebody isn't thinking.
Bookmarks