PHP vs Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I have two PHP apps on the same (local) box. One handles financial
transactions (A) and the other handles budgeting (B). I want B to query
A for information for the budget. So I'm technically querying a remote
PHP script from within a different "site" and PHP script on the same
box. Like this:

http://localhost:8000/budget/get_expenses.php queries

I hope that makes sense. I have "allow_url_fopen = On" in my php.ini.
There are three ways I've seen to do this:


Curl is complex, so I haven't tried it yet.
I've tried file_get_contents() via the PHP development server. Doesn't
work. Generates an error.
I've tried fopen() on the PHP development server, but it too fails with
the same error. The error looks like this:

[Mon Jul 11 14:45:26 2022] PHP Warning:
fopen(http://localhost:8000/slowen/index.php): Failed to open stream:
HTTP request failed! in /home/paulf/public_html/budget/test.php on line

The call to the "remote" script is on line 7 in test.php above.

Here's the wrinkle: fopen() works if I'm using the Apache server. 

For what it's worth, the script being queried should return a PHP array
in JSON format. The box is an Arch current box.

Can anyone explain why Apache can do this, but PHP's dev server can't?


Paul M. Foster
Personal Blog:
Company Site:
Software Projects:

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux