Making a CakePHP 1.2 page work on localhost - php

So I need to copy a site from a webserver and run it from my localhost.
The site is created with CakePHP 1.2.3.8166 (it says in VERSION.txt).
I am new to CakePHP, so i started with the 2.0 tutorial and i have also a fresh install of 1.2.11 and both work perfectly. (I just had to fix the mod_rewrite issues by enabling AllowOverride All).
However when i tried to run my downloaded site i just got "page not found" error.
With a little searching, the solution was to remove the first "/" in
"RewriteRule ^$ /app/webroot/ [L]" and other places in the .htaccess files.
So now my page looks wired, like this:
http://pastebin.com/ZMX3RjZG
Clearly the page does't load properly and i don't know what is wrong.
Now i am stuck, anyone have come across similar problem?
I run:
Windows 7 Pro 64bit,
PHP 5.3.6,
Apache 2.2.19
Any help appreciated.

Based on the second code sample you've provided and the way the rendered content is garbled I would say that shorthand tags aren't enabled in your version of PHP.
This shorthand notation might be the root of your problem:
<?= //Some PHP script ?>
There are two solutions, either change all the shorthand tags to the full declaration:
<?php //Some PHP script ?>
Which might be quite an undertaking as you're working with an existing project. It all depends on the size of it and if this shorthand notation is present in all of the files (the Cake core uses the full declaration). Or you could enable shorthand in your php.ini and restart the Apache server.
More information on shorthand tags can be found in the PHP manual.

Related

visual studio does not recognize php

i added php code in my cshtml view under asp.net mvc.
<body>
<?php echo"hello";?>
...
however it seems that vs does not understand that it's php and when I inspect element, the php code was automatically commented out.
<!--?php echo"hello";?-->
how can I solve this? I have already installed php tool extension in vs.
To run php script, you need to have .php files, or it won't be recognized.
To enable the script to be recognized as php without changing file suffix, add config files depending on the server you are using. (most likely Apache/IIS)

PHP 5.5 -> 5.6: Include not working any more (Codeigniter)

I´m moving an application from a PHP 5.5 server to a PHP 5.6 server. The application is based on Codeigniter 2.2.
On the old server I had something like this in my views to include other template parts:
include('header.php');
This simple and direct include works like a charm on the old server.
On the new server I get the exception, that the file for inclusion could not be found.
I found out, that the PHP preprocessor tries to grab the file from the linux include paths and also from the "system/core" directory. But not from the directory where the view itself is located.
I´ve not idea what makes the difference between these two systems... Has anybody an idea where I can search for the issue?
Check the file path. Whether its inside some other folder or not.
Also can try with
$this->load->view('header.php');
or can load header in Controller as well
As well there are some useful keyword.
APPPATH - Outputs application path. Ex application/
Thanks guys for all your input - I´ve already tried most of these debugging attempts.
Now I digged a little deeper and found the reason for my problems. The short_open_tag directive in PHP caused the issue. Cause this new server had some slight differences in php.ini.
In core/loader.php Codeigniter tries to replace short open tags with normal tags, if the .ini setting for short_open_tags is disabled. For any reason this replacement isn´t working as expected and that caused my issues.
So if anyone has the same issue after moving a Codeigniter installation from one machine to another, that might be a point where you can start.
Thanks to all of you,
Michael

Cannot visit Wordpress normally

As you can see, it gives me a weird view. I use apache+php5+mysql for my wordpress, and everything seems to work right during installation of Wordpress. But it just gives me such a strange scene.
Has anyone seen similar problem as I do? When could be the reason for this?
Can't say for sure without visiting the site, but it looks like you didn't add index.php to DirectoryIndex in your httpd.conf file (for Apache, or whatever the equivalent is in whichever server you're using)
I am not sure - pic resolution is low but it looks like the directory contents. make sure php is (a) installed (b) enabled on the directory (c) after you make changes to the server config, restart it (d) php files are set to execute php interpreter

I'm having issues stopping Apache from rewriting URLs, even after a restart

All I want to do is be able to see a PHP file from the root without it going through the rewrites (thus our custom CMS).
Here's what I've done:
In my httpd.conf, I've commented out the call to load the mod_rewrite module.
Next, I've removed the .htaccess file from the root as it had the rewrite rules in it.
I've rebooted the server.
I've searched through phpinfo() and there are no "rewrite" strings to be found
The problem is that the server still rewrites and the request passes through our CMS.
I'm using XAMP (PHP 3.3.1, Apache 2.2.14)
What am I missing?
maybe cache problem in your browser? because a similar thing happened to me and deleting the cache solved it.
Leave it to the details... I was trying to access my_file.php on the root. However, the filename was actually my-file.php (dash vs underscore).
The page I was getting was a 404, which went through the CMS. When I access the proper file, the one with the dash, I get what I'm supposed to.
I appologize for the waste of time :)

web browser not processing PHP code as PHP code

I have Joomla installed in my computer, but recently have been writing php files that aren't related to the Joomla-managed site. For some reason, when I try to open those php files in the web browser using xampp (note: Joomla also is using xampp), the browser doesn't process the code w/in the tags as php code.
For example, after opening a basic page (a page with title "test", no content except in the body tags) in the web browser and going to the source code, the following is shows up in the source code:
<body>
<?php echo "hello"; ?>
</body>
instead of the HTML conversion. (i.e. just "hello")
Does anyone have an idea about what's going on here?
Thanks.
It's probably because PHP module isn't loaded in your apache. Be sure it is enabled
PHP is interpreted in the server, not the browser. Whatever's going wrong, you need to look at the SERVER side to resolve it.
My first guess: maybe you didn't suffix the file ".php" (so the server doesn't recognize it as a PHP file?)
Second guess: is the directory containing your PHP files configured to parse PHP?
If you have Joomla, you probably have PHP. You probably also have Apache.
So check your Apache configuration, and check your file naming conventions.
Is the file extension .php? The server doesn't magically know when you're serving php files, this is a good way to ensure it knows what you're doing.
Apache is looking into your localhost's defined root directory for files it can parse. In this case htdocs. This is the default for XAMPP. As far as Apache is concerned, it will not interpret any files outside of that folder.
if the problem in php module it better to re install php5 in to the system and it will work fine. probably the problem is in php module you should try re installing php in your system.
Just restart httpd service. It will work fine.
sudo systemctl restart httpd.service
if it has not worked please reinstall PHP once again.

Categories