I’m working on Chapter 4: Publishing MySql Data on the Web.
I’ve downloaded the code and I’m using the folder structure as it is.
I then click here: http://localhost/php-ninja/chapter6/ and then the directory totaljokes-global1
But that page http://localhost/php-ninja/chapter6/totaljokes-global1/ doesn’t show anything. Is that what is supposed to happen?
The same happens here in Chapter 7: A content management system, when I look at the folders through this link http://localhost/php-ninja/chapter9/admin/jokes/, that pages doesn’t show anything.
See attached files with screenshots of both cases. The names of the first set of photos refers to chapter 7.
It depends on the configuration of your local server. Normally the server will be configured to look for one or more ‘default home’ pages which it will show when a directory is opened, often named index, default, home and with a suitable extension .php, .html, .htm, .asp or whatever. So have a look in those directories for something that looks like it ought to be the default page, then check your server config to see if it matches, or add that name onto the end of the url just to get it running.
What I’m saying is all the other files in the book work as they are when you download them with the file structure as it is -after changing username and password for the connection files. But those two don’t.
The files I was referring to are in chapter 6 and 7. Here’s the photo with the file structure as it is: http://localhost/php-ninja/chapter6/totaljokes-global1/ and http://localhost/php-ninja/chapter7/jokes/
And here’s what you see when you see it on the screen (not) working:
The CMS for the joke database here: http://localhost/php-ninja/chapter7/admin/ doesn’t show anything when you click on the options. Why?
I have a server from a webhost, it saves me trouble from setting up a server and maintaining it. Reality is a good programmer may not be a good server admin, its unnecessary anyway.
OK, to be fair though you didn’t say that some were working and some were not, just that these specific ones were not.
In each of your folders there’s a file called index.php - if your server is configured as mine is, that should execute when you open that folder. First check whether it’s executing - stick an echo at the top to just print a string and see if it appears. If that’s OK, all you can do is run through the code until you find out what’s happening. When you get the blank screen, if you right-click and view page source, what is there?
OK, I had to move the includes to the root - confusing as all the other files for all the exercises in the book work where they are.
Did you set up your server with LAMP/WAMP/XAMP or did you do separate installs of Apache, PHP and MySQL?
I have a Mac and configured Apache, PHP, MySql manually and also installed PHP My Admin.
May or may not help but either way, I find it a good way to learn PHP
Update your php.ini to have the following error_reporting value
error_reporting = E_ALL | E_STRICT
and have display_errors turned on
display_errors = On
Restart apache, and reload the pages that appear to be blank to see if any errors/warnings show up.