I recently installed apache and php on a ubuntu vps and i'd like to be able to make web requests from an iPhone app to php files on the server namely files inside the www folder ex:'var/www/myfolder/echo.php'
by ways of a web request from the app to the URL 'http://ipaddress/myfolder/echo.php'
or whatever the correct url is. I do not know the URL i need to type in to access the echo.php file. can anybody shed some light on this confusing situation I'm in?
ps. this is my first time working with servers
Asked
Active
Viewed 3,815 times
2
2 Answers
0
You need to check what your DocumentRoot
is set to in your Apache configuration.
So if /var/www
is the DocumentRoot
, which is the default on Ubuntu, then your URL will be http://machinename/myfolder/echo.php
, which is what you have.
Before doing any coding on the iPhone, test the .php
file in a web browser.
Any errors during development and testing, then check the Apache error log (/var/log/apache/error.log
).

trojanfoe
- 120,358
- 21
- 212
- 242
-
thanks for clarifying that for me! i tried testing the php file at that url and i got a 404 error. – Sep 03 '14 at 09:13
-
@user2038460 OK, as I explained, check the Apache error log and then the configuration and get it working before touching a line of iOS code. – trojanfoe Sep 03 '14 at 09:16
-
yea the error logs display no errors, the access log just shows me that there indeed was a 404. i'm testing with safari not on iOS yet. i checked the document root and its var/www . the permissions of the files and folders I'm trying to access are all 711. is that what is stopping me? – Sep 03 '14 at 09:31
-
@user2038460 Well I cannot provide a complete guide to how to configure an Apache server, but the directory is `/var/www` and not `var/www` and a 404 error should appear in the `error.log` as well as the `access.log`. These logs will tell you why a request could not be satisfied and it's possible the error is coming from the `.php` file itself, so you will need to ensure php logging is enabled as well. – trojanfoe Sep 03 '14 at 09:37
0
consult https://stackoverflow.com/a/23175981/2038460 solved my problem! i just had to specify the document root to actually be the folder i was working on, i though it'd be enough just having it at/var/www but apparently not, had to be /var/www/folder

Community
- 1
- 1