Running an instance of httpd and the /var/www/html directory has an index.php file.
If I go to http://localhost the page appears to render properly and when I hover over certain areas a drop-down menu appears and I can see the corresponding URL showing in the lower part of my browser.
However, when I click on any of these nothing changes. It appears that index.php is being served up.
Also, even if I enter the URL of one of the links I get only index.php.
In the access log I see....
127.0.0.1 - - [14/Jun/2016:16:09:22 +0800] "GET /index.php?action=intro&lang=en&id=162 HTTP/1.1" 200 6598 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36"
and no errors.
Ideas of what I'm doing wrong OR a better place to ask this question.
Allegedly, on or about 14 June 2016, Ed Greshko sent:
Ideas of what I'm doing wrong OR a better place to ask this question.
Truly hard to say without any concrete examples. We can't tell if you've got a PHP mistake, a server configuration mistake, or it's your browser (e.g. does your page also rely on the browser doing something with JavaScript, or cookies, or an issue with caching).
My first thing would be to try simplifying the page, until it contains just the element you're working with.
On 06/14/16 23:41, Tim wrote:
Allegedly, on or about 14 June 2016, Ed Greshko sent:
Ideas of what I'm doing wrong OR a better place to ask this question.
Truly hard to say without any concrete examples. We can't tell if you've got a PHP mistake, a server configuration mistake, or it's your browser (e.g. does your page also rely on the browser doing something with JavaScript, or cookies, or an issue with caching).
Well, the files were given to me by someone else and are coming from a website that works. That's why I'm thinking it *should* be some sort of configuration issue.
Would be nice to have a way to trace what is happening on the server....
My first thing would be to try simplifying the page, until it contains just the element you're working with.
Easier said than done for me. Not being a php person and this not being my code. But something to consider.
On 06/14/2016 02:43 PM, Ed Greshko wrote:
On 06/14/16 23:41, Tim wrote:
Allegedly, on or about 14 June 2016, Ed Greshko sent:
Ideas of what I'm doing wrong OR a better place to ask this question.
Truly hard to say without any concrete examples. We can't tell if you've got a PHP mistake, a server configuration mistake, or it's your browser (e.g. does your page also rely on the browser doing something with JavaScript, or cookies, or an issue with caching).
Well, the files were given to me by someone else and are coming from a website that works. That's why I'm thinking it *should* be some sort of configuration issue.
Would be nice to have a way to trace what is happening on the server....
My first thing would be to try simplifying the page, until it contains just the element you're working with.
Easier said than done for me. Not being a php person and this not being my code. But something to consider.
One other thing. By default, PHP no longer permits "short open tags". So all PHP code must be prefixed with
<?php php code goes here; ?>
If all you have is
<? php code goes here; ?>
then you must have "short_open_tag = On" in your /etc/php.ini (or in one of the files in /etc/php.d). By default it's set to "Off". ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 - - - - Time: Nature's way of keeping everything from happening at once. - ----------------------------------------------------------------------
On 06/15/16 06:23, Rick Stevens wrote:
One other thing. By default, PHP no longer permits "short open tags". So all PHP code must be prefixed with
<?php php code goes here; ?>
If all you have is
<? php code goes here; ?>
then you must have "short_open_tag = On" in your /etc/php.ini (or in one of the files in /etc/php.d). By default it's set to "Off".
That didn't help. But I found something "interesting"
If I remove index.php and directly access a URL like http://localhost/index.php?action=contact I get "The requested URL /index.php was not found on this server." But if I copy index.php?action=contact to index-X.php and access http://localhost/index-X.php it displays properly in the browser.
On 06/14/2016 05:54 PM, Ed Greshko wrote:
On 06/15/16 06:23, Rick Stevens wrote:
One other thing. By default, PHP no longer permits "short open tags". So all PHP code must be prefixed with
<?php php code goes here; ?>
If all you have is
<? php code goes here; ?>
then you must have "short_open_tag = On" in your /etc/php.ini (or in one of the files in /etc/php.d). By default it's set to "Off".
That didn't help. But I found something "interesting"
If I remove index.php and directly access a URL like http://localhost/index.php?action=contact I get "The requested URL /index.php was not found on this server." But if I copy index.php?action=contact to index-X.php and access http://localhost/index-X.php it displays properly in the browser.
Ok, that sounds like two possible issues:
1. Are you sure the code you got from the guy is installed in the document root for your Apache (check the "DocumentRoot" directive in your Apache config file) and that the files including the document root directory itself are all readable by Apache (the default is that Apache runs as user "apache", group "apache").
2. You may be using the default index directive which only uses "index.html" as the substitute for a directory listing.
a. Edit your httpd.conf file. Assuming a normal, repo-based install, this will be the "/etc/httpd/conf/httpd.conf" file.
b. You'll probably find a default section like:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
in it. If you do, then change that second line to read something like:
DirectoryIndex index.html index.htm index.php
This causes the system to look for one of those three files if someone requests a directory listing, e.g. "http://your.server.com/" and serves it up in place of a directory listing.
c. Save the file.
d. Verify you have mod_dir.so:
ls /usr/lib[64]/httpd/modules/mod_dir.so
(obviously, use "/usr/lib" on 32-bit, "/usr/lib64" on 64-bit).
e. If you have all of that stuff, restart Apache and try to access the top level again:
See https://wiki.apache.org/httpd/DirectoryListings for more info on this last bit. ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 - - - - I haven't lost my mind. It's backed up on tape somewhere, but - - probably not recoverable. - ----------------------------------------------------------------------
On 06/15/16 09:50, Rick Stevens wrote:
- Are you sure the code you got from the guy is installed in the
document root for your Apache (check the "DocumentRoot" directive in your Apache config file) and that the files including the document root directory itself are all readable by Apache (the default is that Apache runs as user "apache", group "apache").
Yes, the Document Root is /var/www/html and the files are there owned by apache:apache and all references in the files to other files are relative.
- You may be using the default index directive which only uses
"index.html" as the substitute for a directory listing.
a. Edit your httpd.conf file. Assuming a normal, repo-based install, this will be the "/etc/httpd/conf/httpd.conf" file.
b. You'll probably find a default section like:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
in it. If you do, then change that second line to read something like:
DirectoryIndex index.html index.htm index.php
This causes the system to look for one of those three files if someone requests a directory listing, e.g. "http://your.server.com/" and serves it up in place of a directory listing.
c. Save the file.
I added that...
d. Verify you have mod_dir.so:
ls /usr/lib[64]/httpd/modules/mod_dir.so
(obviously, use "/usr/lib" on 32-bit, "/usr/lib64" on 64-bit).
I have that...
e. If you have all of that stuff, restart Apache and try to access the top level again:
http://localhost
I've always been able to access the top level.
As I pondered why http://localhost/index.php?action=contact shows that in my browser but http://localhost/index.php is served up....but if I change the name to http://localhost/index-X.php I get what I would expect with the http://localhost/index.php?action=contact URL I wonder if my version of PHP is incompatible with the very used on the guy's working server.
Thanks for you help and suggestions to this point. Not sure it is worth the time to continue banging my head without visiting the working server.
On 06/14/2016 01:12 AM, Ed Greshko wrote:
Running an instance of httpd and the /var/www/html directory has an index.php file.
If I go to http://localhost the page appears to render properly and when I hover over certain areas a drop-down menu appears and I can see the corresponding URL showing in the lower part of my browser.
However, when I click on any of these nothing changes. It appears that index.php is being served up.
Also, even if I enter the URL of one of the links I get only index.php.
In the access log I see....
127.0.0.1 - - [14/Jun/2016:16:09:22 +0800] "GET /index.php?action=intro&lang=en&id=162 HTTP/1.1" 200 6598 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36"
and no errors.
Ideas of what I'm doing wrong OR a better place to ask this question.
Do you have modphp installed and a section in your Apache config to the effect:
<FilesMatch .php$> SetHandler application/x-httpd-php </FilesMatch>
to cause Apache to actually execute the PHP? ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 - - - - Real Time, adj.: Here and now, as opposed to fake time, which only - - occurs there and then - ----------------------------------------------------------------------
On 06/15/16 00:28, Rick Stevens wrote:
Do you have modphp installed and a section in your Apache config to the effect:
<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
to cause Apache to actually execute the PHP?
The installation of php placed a file named php.conf in /etc/httpd/conf.d containing that stanza. Also, it placed a file named 10-php.conf in /etc/httpd/conf.modules.d which I believe causes the needed modules to be loaded.