Jump to content
The Uniform Server Community
tomk358

[Solved] php includes

Recommended Posts

I have a site that I'm trying to run locally with uniform server, and am having issues.

 

For some reason I can't get my include() statements in php to work.

They just come through as text, rather than get interpreted as php scripts.

The includes are all .php files.

 

I tried adding "allow_url_include = on" to both the php.ini file in my site's top directory,

and adding it to the main php.ini, but neither worked.

 

I tried running uniserver as a service, and as a process, that also didn't work.

 

Any ideas?

Share this post


Link to post
Share on other sites

I am sure the helpful members will point you in the right direction. I am off to be bed.

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Hi tomk358,

 

Are you able to show me those two files? I'll be able to help you from a PHP viewpoint.

 

Thanks

Kalpz

Share this post


Link to post
Share on other sites

Ok, so I've got index.php

in the body of that document I have the following:

<? include("topnav.php");?>

 

Then I have topnav.php with just some text to test.

 

When I view index.php on localhost through uniserver, it doesn't include the content from topnav.php, as it would on my ISP's webserver.

 

Ideas?

Share this post


Link to post
Share on other sites

You are using short tags this has been disabled in Uniform Server to force users to be standards compliant!

 

The line: include("topnav.php");?>

Should be: <?php include("topnav.php");?>

 

Uniform Server is not draconian hence you can enable short tags in php.ini

 

Edit the three ini files:

UniServer\usr\local\php\php.ini

UniServer\usr\local\php\php.ini_delvelopment_nano

UniServer\usr\local\php\php.ini_production_nano

 

Search for line: short_open_tag = Off

Change to: short_open_tag = On

 

I would recommend always use the long tag <?php format.

Think about it, what happens if you move to an ISP that is standards compliant!

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Ah, I too should have known that! As soon as I get Uniform Server I turn on the short tags. Oh well, glad its solved!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...