Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Moderated Pro PHP
|
Moderated Pro PHP This is a moderated forum for discussing advanced, professional level issues with PHP. Your posts will not appear until a moderator approves them. Posts that are not the right level for this forum will be responded to and you'll be asked to post them in the [url="http://p2p.wrox.com/sql-server-2000-20/9"]Beginning PHP[/url] forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Moderated Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2005, 11:45 AM
Authorized User
 
Join Date: Dec 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default CLI PHP and Webbased

I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? I run the command script as the apache user. Also, when I run the script from the browser, I see no data traffic going to the sql server.
 
Old November 10th, 2005, 01:30 AM
Authorized User
 
Join Date: Dec 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to colin.horne
Default

Hi

CLI PHP and Apache's PHP are different. Apache uses mod_php, while your CLI scripts are getting executed with /usr/bin/php, probably.

They _can_ (and quite often do) use different php.ini files. For example, on my Gentoo server:

$ ls /etc/php/*
/etc/php/apache2-php4:
lib php.ini

/etc/php/cli-php4:
php.ini

One thing you might want to try is:

$ diff /etc/php/*/php.ini
495,497c495
< ; allow_url_fopen = On
< ; Closed for security - <[email protected]>
< allow_url_fopen = Off
---
> allow_url_fopen = On

This shows you the difference between the two different php.ini files. On your webserver, the paths are no doubt going to be different. Try:

$ locate php.ini

Hope this helps

--
Please contact me at:
Colin (dot) Horne (at) gmail (dot) com
My blog: http://colinhorne.blogspot.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
c++/cli and c# elvisfeverr C++ Programming 2 December 19th, 2011 02:17 PM
Webbased project and 3D Model Andraw Other Programming Languages 0 October 14th, 2008 02:15 PM
C++/CLI to C# jsbsudha XML 1 November 19th, 2007 02:30 PM
editor and webbased lists lisav General .NET 0 June 29th, 2007 06:06 AM
c++/CLI dll for c# lavi C# 1 April 23rd, 2007 11:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.