Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Christopher Bergin

Chapter 4 / Example 1

Recommended Posts

I was able to get most of the scripts to work. Registration works properly. When I attempt to log in, I receive a blank page; no errors, no information. After the login is submitted, the URL http://localhost/site1/index.php reflects the index page as designed, just no content. When the site is initially visited, the index page displays properly. Any ideas?

Share this post


Link to post
Share on other sites

Since I wasn't receiving error messages from my error handler, I went about commenting out certain conditions such as the script that redirects unauthorized users. What I did find was that a syntax error could prevent the page from rendering. A couple of times in other parts of the project, I just used the author's  script and it cleared up problems. I'll report back if I still get stuck. 

Share this post


Link to post
Share on other sites

Excellent. Thanks for sharing. Make sure display_errors is enabled on your server, too, which will help you debug these issues.

Share this post


Link to post
Share on other sites

I noticed that the error_display setting in my php.info page is set to Off. I thought it would be as simple as opening up the php.ini file and editing the feature to read On but it doesn't seem to be working, even after shutting down the server and restarting. What could I being doing wrong?

Share this post


Link to post
Share on other sites

You could be editing the wrong php.ini file or your changes may not be being saved due to permissions issues. 

Share this post


Link to post
Share on other sites

No. The changes are made by editing the correct php.ini script, making the correct edits within that script, saving it, and restarting the web server.

Share this post


Link to post
Share on other sites

yes, I created a script and placed in htdocs with the rest of the scripts and ran it but I saw no results. 

 

 

<?php
ini_set('display_errors', '1');
echo 'the setting has been set!';
?>
 
the version of PHP is 5.4.10 in the preferences tab on the MAMP widget and also reflected in the phpinfo document. The php.ini file I'm modifying is 5.4.10 in the config folder and the permissions setting reads admin and Christopher Bergin with read/write capabilities.

Share this post


Link to post
Share on other sites

i'm not sure what you think that script is supposed to do. It should just echo the message. But ini_set() doesn't permanently change a setting; it just changes a setting for the duration of that script.

Share this post


Link to post
Share on other sites
When I attempt to log in, I receive a blank page; no errors, no information.

 

 

I may be able to help with this. When I tried running index.php at the end of chapter 3, I also received a blank page, without errors or anything. Inspecting the source code showed that none of the php ran:

<html>
<body>
</body>
</html>

Initially I tried to enable error messaging, but that wasn't the problem. The real error (for me) was a syntax error in my header.html file: I mistakenly typed $foreach instead of foreach. Instead of letting me know an error occurred, the entire script simply failed to run. I suggest that you try and find out which file you might have an error in (by commenting out different portions of different files), and then very closely inspect it for any missing brackets, semi-colons, and other syntax errors. 

 

Cheers!

Greg

 

PS: re: your post #11

You say the script doesn't show any results. Here's what I suggest you do. Create a file called '.htaccess' and place it in your webroot directory. In that file, paste this code:

AddType application/x-httpd-php .html .htm

This is what I did when my footer.html did not run the php scripts. Let me know if this works!

Share this post


Link to post
Share on other sites

I was able to resolve my issue. I noticed on the first screen of the phpinfo file that the correct path to the php.ini file is listed in plain sight.

The file that I was editing was located at /Applications/MAMP/conf/php.ini.

The file that I needed to be editing is /Applications/MAMP/bin/php/php5.4.10/conf/php.ini.

 

All set for now.

Share this post


Link to post
Share on other sites

Excellent. Glad to here it. The thing with MAMP is that it uses its own php.ini file which it then copies over. You have to make edits to the ini file within MAMP.

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...
Sign in to follow this  

×
×
  • Create New...