PEAR
-
I have a site I wrote so long ago it might as well be someone else's code. I am trying to bring it back online on a new server after the old one went kerblooey, using a backup.
I have dumped the php files into the new server, restored the database, set up a new apache config, and voila! It... doesn't run, because I used pear and HTML//Template//IT.
okay, whatever.
sudo apt-get install pear
, andsudo pear install HTML_Template_IT
Site gives me a 500 still:
[Sun Sep 04 15:33:50 2016] [error] [client 74.219.227.230] PHP Warning: require_once(HTML\\Template\\IT.php): failed to open stream: No such file or directory in /var/www/Sites/SiteName/index.php on line 2 [Sun Sep 04 15:33:50 2016] [error] [client 74.219.227.230] PHP Fatal error: require_once(): Failed opening required 'HTML\\Template\\IT.php' (include_path='.:/usr/share/php') in /var/www/Sites/SiteName/index.php on line 2
it should be able to read it, given my /usr/share/php looks like
total 120 drwxrwxrwx 2 root root 4096 Sep 4 15:11 Archive drwxrwxrwx 2 root root 4096 Sep 4 15:11 Console drwxrwxrwx 3 root root 4096 Sep 4 15:11 data lrwxrwxrwx 1 root root 20 Jun 25 11:33 doc -> ../doc/php-pear/PEAR drwxrwxrwx 3 root webftp 4096 Sep 4 15:11 HTML drwxrwxrwx 2 root root 4096 Sep 4 15:11 OS drwxrwxrwx 11 root root 4096 Sep 4 15:11 PEAR -rwxrwxrwx 1 root root 1087 Jun 25 11:16 PEAR5.php -rwxrwxrwx 1 root root 14507 Jun 25 11:16 pearcmd.php -rwxrwxrwx 1 root root 33852 Jun 25 11:16 PEAR.php -rwxrwxrwx 1 root root 1004 Jun 25 11:16 peclcmd.php drwxrwxrwx 3 root root 4096 Sep 4 15:11 Structures -rwxrwxrwx 1 root root 20833 Jun 25 11:16 System.php drwxrwxrwx 3 root root 4096 Sep 4 15:11 test drwxrwxrwx 2 root root 4096 Sep 4 15:11 XML
(HTML contains Template which contains the following)
total 72 -rwxrwxrwx 1 root webftp 2227 Sep 4 15:11 IT_Error.php -rwxrwxrwx 1 root webftp 36606 Sep 4 15:11 IT.php -rwxrwxrwx 1 root webftp 29555 Sep 4 15:11 ITX.php
But nothing happens. How do I fix this?
-
@Yamikuronue the require_once has backslashes in it... PHP does normally fix both \ and / to work as \ on Windows but I don't know if it does it the other way around on Linux.
-
-
@Arantor This was hosted on linux before, and I haven't touched it in years. Maybe a php version mismatch though?
(It was probably developed on windows, but it did used to run on linux)
-
the require_once has backslashes in it...
alright now I'm second guessing myself, let me just try...
goddammit...
fuck you, php, what the actual fuck. Maybe I had a newer version on my old server? anyway that worked.
-
@Yamikuronue said in PEAR:
fuck you, php, what the actual fuck.
Welcome to the wonderful world of PHP
-
@Yamikuronue this is why PEAR is best avoided.
-
I think this backup was taken just before I migrated to linux.
My database connections have all kinds of funky case folding.
CREATE VIEW Users AS select * from users
FTW.
-
@Arantor Yeah, I have backups of this site going back to.... 2008? Thereabouts? I'm proud I used a templating engine at all >.>
-
PHP does normally fix both \ and / to work as \ on Windows
I don't know whether PHP does anything special in this case, but for the record, \ and / have always been interchangeable in pathnames passed to any DOS or Windows API. Even in command lines, / and \ are still equivalent provided the shell can be persuaded not to parse / as a switch prefix.
So if you're building stuff that needs to be portable, and it has relative pathnames embedded in it, just use / for all pathname separators. As a bonus, it makes your pathnames look less retarded in languages that use \ for an escape prefix in string literals.
-
@Yamikuronue
Why don't you take the oportunity and migrate it to mongodb ? I heard it's webscale
-
@flabdablet I assumed it was PHP 'fixing' it since the last time I did anything with the Windows API, I never did file manipulation where I ever had the risk of / in it...
-
@flabdablet Only since Vista AFAIK, I think XP didn't like forward slashes. Maybe.
-
Only since Vista AFAIK
Nope. It was in DOS, from the first version that implemented hierarchical directories (PC DOS 2.0).
-
What's this? Another backup drive? From 2 years later?
And what's this? THE SLASHES ARE THE OTHER WAY
fml. Couldn't I have found this before I manually fixed all of them?
-
<david-crusoe> It sounds to me like... ...the whole thing went PEAR shaped. </david-crusoe>
-